Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp2312338ybn; Thu, 26 Sep 2019 10:01:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwn3C3HJp5aIlV8p8qMzRTkiC/s4T/rqugZYCaWIkGj00NN71GVE0zs7OHwnXnfi/sh6pmL X-Received: by 2002:a50:ab0f:: with SMTP id s15mr4835280edc.119.1569517270491; Thu, 26 Sep 2019 10:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569517270; cv=none; d=google.com; s=arc-20160816; b=iDmYztJwnRXihne4WsXWJW/H6kTajNNnSzxNFSJAdrIhH3JyeDjfSwKOJk5kTItcVX NxwNFWxsad90NqwJ6rhN6jAEe0rBrTxAtB1DAHgSthHvxvxHr4RnGSC2itPeHZdC6TWw 2HJ2WB12zJLpuY8kcJp/Xe0m32BOwJnbCkiK7sBGeU7YbJyvHdWYX9Bt67669rho+mE0 iwkf1fiQZLiknsrYDNpvbN6WdSKEkWbMFYNSxCb2aJwyJj9bzkUqk5QXKLc35an1xe9e rp6Jfw5sRwD2AaPOshyu/vyMEukZrFE5FJQfLPKFizdWbzYW50np1NMsX2FcbHhVQwP0 zATw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=J7elvfXkCv88mokpKxgzNDf51NxVE/k8vkpYrGUsot4=; b=sKdVX3OAEJMxupLGX1l7eMjy4Tns31W71hDkNag11llALWDVh771xCSQPtZdQXb/K5 6QnDsnZOgttbjZ5ANwhcBGG73/+av/fwYoM/faTm4y+ustujCzDYs1TaZ6sI4Dfyq0DI 65ggLumFy0J/wH29M6pEARjOpQotJEZUH0dhXt07QdjBn1tZw0VlzWg1k01KcnLzoqIx NfdhozR/c6MIx5NpHkBGA7qFiTwMExAEXfZW6z5h9YpEgxVwoso5TDnxq0cmU88zhR2m 2TLjDw/GnO3cj1iI3rZUlyp4QMwcOVZvzv4CkYSIkst/beT8BnMHn1Pmy6+REfE3EceR Zmbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x20si1347302ejb.393.2019.09.26.10.00.44; Thu, 26 Sep 2019 10:01:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727591AbfIZQ65 (ORCPT + 99 others); Thu, 26 Sep 2019 12:58:57 -0400 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:4845 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727512AbfIZQ64 (ORCPT ); Thu, 26 Sep 2019 12:58:56 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.15]) by rmmx-syy-dmz-app06-12006 (RichMail) with SMTP id 2ee65d8cec1ff87-2eb90; Fri, 27 Sep 2019 00:49:37 +0800 (CST) X-RM-TRANSID: 2ee65d8cec1ff87-2eb90 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost (unknown[223.105.0.241]) by rmsmtp-syy-appsvr08-12008 (RichMail) with SMTP id 2ee85d8cec20ac9-71c3b; Fri, 27 Sep 2019 00:49:37 +0800 (CST) X-RM-TRANSID: 2ee85d8cec20ac9-71c3b From: Haishuang Yan To: Shuah Khan , Pablo Neira Ayuso , "David S. Miller" Cc: Julian Anastasov , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Haishuang Yan Subject: [PATCH 3/3] selftests: netfilter: add ipvs tunnel test case Date: Fri, 27 Sep 2019 00:48:52 +0800 Message-Id: <1569516532-708-4-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569516532-708-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1569516532-708-1-git-send-email-yanhaishuang@cmss.chinamobile.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Test virtual server via ipip tunnel. Tested: # selftests: netfilter: ipvs.sh # Testing DR mode... # Testing NAT mode... # Testing Tunnel mode... # ipvs.sh: PASS ok 6 selftests: netfilter: ipvs.sh Signed-off-by: Haishuang Yan --- tools/testing/selftests/netfilter/ipvs.sh | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tools/testing/selftests/netfilter/ipvs.sh b/tools/testing/selftests/netfilter/ipvs.sh index 40058f9..2012cec 100755 --- a/tools/testing/selftests/netfilter/ipvs.sh +++ b/tools/testing/selftests/netfilter/ipvs.sh @@ -167,6 +167,33 @@ test_nat() { test_service } +test_tun() { + ip netns exec ns0 ip route add ${vip_v4} via ${gip_v4} dev br0 + + ip netns exec ns1 modprobe ipip + ip netns exec ns1 ip link set tunl0 up + ip netns exec ns1 sysctl -qw net.ipv4.ip_forward=0 + ip netns exec ns1 sysctl -qw net.ipv4.conf.all.send_redirects=0 + ip netns exec ns1 sysctl -qw net.ipv4.conf.default.send_redirects=0 + ip netns exec ns1 ipvsadm -A -t ${vip_v4}:${port} -s rr + ip netns exec ns1 ipvsadm -a -i -t ${vip_v4}:${port} -r ${rip_v4}:${port} + ip netns exec ns1 ip addr add ${vip_v4}/32 dev lo:1 + + ip netns exec ns2 modprobe ipip + ip netns exec ns2 ip link set tunl0 up + ip netns exec ns2 sysctl -qw net.ipv4.conf.all.arp_ignore=1 + ip netns exec ns2 sysctl -qw net.ipv4.conf.all.arp_announce=2 + ip netns exec ns2 sysctl -qw net.ipv4.conf.all.rp_filter=0 + ip netns exec ns2 sysctl -qw net.ipv4.conf.lo.arp_ignore=1 + ip netns exec ns2 sysctl -qw net.ipv4.conf.lo.arp_announce=2 + ip netns exec ns2 sysctl -qw net.ipv4.conf.lo.rp_filter=0 + ip netns exec ns2 sysctl -qw net.ipv4.conf.tunl0.rp_filter=0 + ip netns exec ns2 sysctl -qw net.ipv4.conf.veth21.rp_filter=0 + ip netns exec ns2 ip addr add ${vip_v4}/32 dev lo:1 + + test_service +} + run_tests() { local errors= @@ -182,6 +209,12 @@ run_tests() { test_nat errors=$(( $errors + $? )) + echo "Testing Tunnel mode..." + cleanup + setup + test_tun + errors=$(( $errors + $? )) + return $errors } -- 1.8.3.1