Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3035431ybn; Thu, 26 Sep 2019 23:27:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwabF2B/+LUGXdtyH8oKkXpq4aKJwix9yL82HGIvOf2YZyLE1wNQi1k9uqyXNbVI1n24B6J X-Received: by 2002:a17:906:c721:: with SMTP id fj1mr6296212ejb.177.1569565662074; Thu, 26 Sep 2019 23:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569565662; cv=none; d=google.com; s=arc-20160816; b=IAzas0dPupT+GnaEo6q6sJrtQsAC80+p6WJF2XVADAM62rtnwzhEZwnt4sU7P24nMD DSM9IHRp6GozchKEAFl82LxX40W7qaSkdC4Hii12YX2iD5qZbvJizEH4m6q9NQT9meV6 XNbYF//kBvMj+SUrC0Up8iFRWBc/UbqPWOTQHY2K9OfopEGUaoAuJJMwZYiF1sM5MfDC mhRgyn6mNRbw3UEoeVefX5jJs7KwGJhZUvQ7jJkh/FwabiQev/Eg1mJPiunlsVDahP21 vxQrda/vcMsSxNsLo8psdM60URuWbbLi4ayL8d5uDpXZFuVaenC6o9d6NGSsTVIttUsN 8UTw== 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=XM7GVOpDInuHXaZq9s51P36eQflj4FVM18a+mEAmqOc=; b=XUZOUB1h5oAfPEKkBWQEiwOFCFAMjCsWq08Pu+fC2fXeM6oKAZIBkRmtVW8Aef9v1M 2vBMgo89JztYO+6Muetsiz7xeKCNgNSb7+cH4wDriBUYfTYYGHCbaO/8GdcgVSqzuHXY tad9nHtRqS1/c6CTMEI1N3JCKUJLIJLtF2KJnG5niiBBvkfYUu7PbhtZoSW7UnmtSKZ4 vPkO0dMo5tCJFk1jaMwocPaQ78AzuQbw1ir+gEjVhH5EuazoWTomDh1ULUmnsPPrkvdY qANspxC0kkY3X5ktpwcV2LwkB+/miaD7W2rRRPaeB2bNRhIFrEXRybnFQPBbf/Z4SpMz mRSA== 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 l15si1885500ejz.74.2019.09.26.23.27.18; Thu, 26 Sep 2019 23:27:42 -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 S1726135AbfI0GWS (ORCPT + 99 others); Fri, 27 Sep 2019 02:22:18 -0400 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:2747 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725769AbfI0GWR (ORCPT ); Fri, 27 Sep 2019 02:22:17 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.1]) by rmmx-syy-dmz-app07-12007 (RichMail) with SMTP id 2ee75d8daa7e602-3c291; Fri, 27 Sep 2019 14:21:51 +0800 (CST) X-RM-TRANSID: 2ee75d8daa7e602-3c291 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost (unknown[223.105.0.241]) by rmsmtp-syy-appsvr01-12001 (RichMail) with SMTP id 2ee15d8daa7ddd2-9c951; Fri, 27 Sep 2019 14:21:51 +0800 (CST) X-RM-TRANSID: 2ee15d8daa7ddd2-9c951 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, lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, Haishuang Yan Subject: [PATCH v2 3/3] selftests: netfilter: add ipvs tunnel test case Date: Fri, 27 Sep 2019 14:21:06 +0800 Message-Id: <1569565266-31566-4-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569565266-31566-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1569565266-31566-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 --- v2: optimize test script --- tools/testing/selftests/netfilter/ipvs.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/testing/selftests/netfilter/ipvs.sh b/tools/testing/selftests/netfilter/ipvs.sh index e95453b..b09994e 100755 --- a/tools/testing/selftests/netfilter/ipvs.sh +++ b/tools/testing/selftests/netfilter/ipvs.sh @@ -174,6 +174,30 @@ 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.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= @@ -189,6 +213,12 @@ run_tests() { test_nat errors=$(( $errors + $? )) + echo "Testing Tunnel mode..." + cleanup + setup + test_tun + errors=$(( $errors + $? )) + return $errors } -- 1.8.3.1