From patchwork Mon Oct 29 13:03:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 990194 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="hDcuvg9u"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42kF0R2yFlz9s3Z for ; Mon, 29 Oct 2018 23:53:59 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id AA6893E79F8 for ; Mon, 29 Oct 2018 13:53:56 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) by picard.linux.it (Postfix) with ESMTP id 59EF73E7926 for ; Mon, 29 Oct 2018 13:53:37 +0100 (CET) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 9A240140096C for ; Mon, 29 Oct 2018 13:53:36 +0100 (CET) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9TChjWe030507 for ; Mon, 29 Oct 2018 12:53:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=tR/P0/w32wUn4JM21lCngP/M1dX1INzuG85X4uHvg8E=; b=hDcuvg9uuV1yAAe7tkm65rkJK3nPL7BdTcPHSX+SAAlBgqx5nJC14IoVjGGJdejrBgQ2 ecmOmWnSzIGUj/aVhAvmmsWowFvbs8YINK4nTNd9tgVg9XcYWW4J42At2auqm5+ApHGg GyRbSKggqhCLquSAe1HhR/wGKNTfc+aEzwipidyn32q37/T72Q7akkgdcNfDuxnULRmX N8EwUTfFZxGSmwFNkaL2z2b8Z7CKpO9d7QioedS6gtIVjoYH6Yrw7tBeislMek8wt0qX pGwEnGDI3RkyxlrspL12JFdSB+um7Z7MGpBNiPSMO2QI2Z8kl8aJlFC/uXepmjFL221i qA== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2ncfypndsx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 29 Oct 2018 12:53:35 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9TCrT52016571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 29 Oct 2018 12:53:29 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9TCrSqx019030 for ; Mon, 29 Oct 2018 12:53:29 GMT Received: from ak.ru.oracle.com (/10.162.80.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 29 Oct 2018 05:53:28 -0700 From: Alexey Kodanev To: ltp@lists.linux.it Date: Mon, 29 Oct 2018 16:03:21 +0300 Message-Id: <1540818202-11247-6-git-send-email-alexey.kodanev@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1540818202-11247-1-git-send-email-alexey.kodanev@oracle.com> References: <1540818202-11247-1-git-send-email-alexey.kodanev@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9060 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=924 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810290121 X-Virus-Scanned: clamav-milter 0.99.2 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, LOTS_OF_MONEY, SPF_HELO_PASS, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 5/6] network/mpls03: add MPLS over GRE and GREv6 X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Note, support for GREv6 was added in Linux 4.19. Signed-off-by: Alexey Kodanev Acked-by: Petr Vorel --- runtest/net.features | 3 ++ testcases/network/mpls/mpls03.sh | 24 ++++++++++++++ testcases/network/mpls/mpls_lib.sh | 59 ++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 0 deletions(-) create mode 100755 testcases/network/mpls/mpls03.sh diff --git a/runtest/net.features b/runtest/net.features index 29d5092..6076e2a 100644 --- a/runtest/net.features +++ b/runtest/net.features @@ -64,3 +64,6 @@ sit01 sit01.sh mpls01 mpls01.sh mpls02 mpls02.sh mpls02_ipv6 mpls02.sh -6 +mpls03 mpls03.sh +mpls03_ipv6 mpls03.sh -6 + diff --git a/testcases/network/mpls/mpls03.sh b/testcases/network/mpls/mpls03.sh new file mode 100755 index 0000000..0db6dbf --- /dev/null +++ b/testcases/network/mpls/mpls03.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved. + +TST_SETUP="setup" +TST_TESTFUNC="mpls_virt_test" +TST_CLEANUP="mpls_virt_cleanup" + +. virt_lib.sh +. mpls_lib.sh + +setup() +{ + virt_type="gre" + if [ -n "$TST_IPV6" ]; then + tst_kvcmp -lt "4.19" && \ + tst_brk TCONF "mpls + ip6gre requires kernel 4.19+" + virt_type="ip6gre" + fi + + mpls_virt_setup +} + +tst_run diff --git a/testcases/network/mpls/mpls_lib.sh b/testcases/network/mpls/mpls_lib.sh index 87aec5c..36c2335 100755 --- a/testcases/network/mpls/mpls_lib.sh +++ b/testcases/network/mpls/mpls_lib.sh @@ -22,6 +22,17 @@ mpls_cleanup() [ -n $rpf_rmt ] && tst_rhost_run -s -c "sysctl -q net.ipv4.conf.all.rp_filter=$rpf_rmt" } +mpls_virt_cleanup() +{ + ip route del $ip_virt_remote/32 dev ltp_v0 > /dev/null 2>&1 + ip route del $ip6_virt_remote/128 dev ltp_v0 > /dev/null 2>&1 + tst_rhost_run -c "ip route del $ip_virt_local/32 dev ltp_v0" > /dev/null + tst_rhost_run -c "ip route del $ip6_virt_local/128 dev ltp_v0" > /dev/null + + virt_cleanup + mpls_cleanup +} + mpls_setup() { local label="$1" @@ -44,3 +55,51 @@ mpls_setup() rpf_rmt="$(tst_rhost_run -c 'sysctl -n net.ipv4.conf.all.rp_filter')" tst_rhost_run -s -c "sysctl -q net.ipv4.conf.all.rp_filter=2" } + +mpls_setup_tnl() +{ + local ip_loc="$1" + local ip_rmt="$2" + local label="$3" + local mask + + echo "$ip_loc" | grep -q ':' && mask=128 || mask=32 + + ROD ip route add $ip_rmt/$mask encap mpls $label dev ltp_v0 + ROD ip -f mpls route add $((label + 1)) dev lo + + tst_rhost_run -s -c "ip route add $ip_loc/$mask encap mpls $((label + 1)) dev ltp_v0" + tst_rhost_run -s -c "ip -f mpls route add $label dev lo" +} +mpls_virt_setup() +{ + mpls_setup 62 + + virt_lib_setup + + tst_res TINFO "test $virt_type with MPLS" + virt_setup "local $(tst_ipaddr) remote $(tst_ipaddr rhost) dev $(tst_iface)" \ + "local $(tst_ipaddr rhost) remote $(tst_ipaddr) dev $(tst_iface rhost)" + + mpls_setup_tnl $ip_virt_local $ip_virt_remote 60 + mpls_setup_tnl $ip6_virt_local $ip6_virt_remote 50 + + ROD sysctl -q net.mpls.conf.ltp_v0.input=1 + tst_rhost_run -s -c "sysctl -q net.mpls.conf.ltp_v0.input=1" +} + +mpls_virt_test() +{ + local type=$2 + local max_size=10000 + + if [ "$type" = "icmp" ]; then + tst_ping $ip_virt_local $ip_virt_remote 10 100 1000 2000 $max_size + tst_ping $ip6_virt_local $ip6_virt_remote 10 100 1000 2000 $max_size + else + tst_netload -S $ip_virt_local -H $ip_virt_remote -T $type -n 10 -N 10 + tst_netload -S $ip6_virt_local -H $ip6_virt_remote -T $type -n 10 -N 10 + tst_netload -S $ip_virt_local -H $ip_virt_remote -T $type -A $max_size + tst_netload -S $ip6_virt_local -H $ip6_virt_remote -T $type -A $max_size + fi +}