Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2473308ybp; Thu, 10 Oct 2019 07:55:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKB2SaAYhP6rzCzxn5TO+Fl5mX8Pk9Ln63j6xMXtKrdKCwr6dyk5IjS6EpkEUgspkLJ3sX X-Received: by 2002:a05:6402:7d7:: with SMTP id u23mr8520061edy.218.1570719302172; Thu, 10 Oct 2019 07:55:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570719302; cv=none; d=google.com; s=arc-20160816; b=P8sVaDlqrDAw75OD8gVijZE0gNGr3iuvKILTiu6u8IJcgZdPh0PhCgl8eV/GyVqxd6 GeoGWpdWn3KOt4+FkpMamtg8YXddQxLK1PQD9ysatWDX09AWiaVJMwW3ob19O/7qOHLK vlHEzm8jwIZae2w7xoyoWkXLolEtrROH5+F1FxoEc2zvTOiKEYDCnWNFtIILrX9WyUZK e3H6n7kXIvNCuH4lQMtKzgtVFF9hdLCysImWvfWKc0zP1MMsW+JweoRrDwCktcis3cXF F5ae2C4m1Oayd0YJr7LSIbo2QnpMYDEkslZsRcgDJpWVGFMdtJ4GUVowHi7dBPHJH1N+ sO3A== 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=Ir6hEkuEqtW/f+E71OmsCX92h9pvFdqueWJXXuDzqvc=; b=Jo+wmzafbfANOhsqdYlH6BUrMUjpZcKasL/JnrZi14HX+x1Eaw8tgH0egooivrV4y2 Pu768nim+fgEUUaPxeGuApD21ZOwDA8nRccXjsvjmwio3crllekYAWR9bnbt7gJMtNTq D81/XNBllRVFnDmVlA7dDVbnA6ZVNrTk+yZLl3kqLs9bfUOrc8O1rd2QCzi3t7aOKp3X DxkfCfNUxu69zscCsogBBLrvpKoVL5Wxej6p6jTl6oBz3/hZbyeY8YeAjzE7aAuCqmjV vwH4zDEvPSfa92CxfPj32BLNmh+xqmLay7xg58chM/yPgGd8jIMbis8wp/8GljSovKE0 /z3w== 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 f6si3221107ejx.293.2019.10.10.07.54.38; Thu, 10 Oct 2019 07:55:02 -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 S1726437AbfJJOwC (ORCPT + 99 others); Thu, 10 Oct 2019 10:52:02 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:2391 "EHLO cmccmta1.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbfJJOwC (ORCPT ); Thu, 10 Oct 2019 10:52:02 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.13]) by rmmx-syy-dmz-app02-12002 (RichMail) with SMTP id 2ee25d9f4569809-229e5; Thu, 10 Oct 2019 22:51:21 +0800 (CST) X-RM-TRANSID: 2ee25d9f4569809-229e5 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost (unknown[223.105.0.241]) by rmsmtp-syy-appsvr07-12007 (RichMail) with SMTP id 2ee75d9f4566e8f-c4fb8; Thu, 10 Oct 2019 22:51:20 +0800 (CST) X-RM-TRANSID: 2ee75d9f4566e8f-c4fb8 From: Haishuang Yan To: Shuah Khan , Pablo Neira Ayuso , "David S. Miller" , Simon Horman 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 v6 3/3] selftests: netfilter: add ipvs tunnel test case Date: Thu, 10 Oct 2019 22:50:55 +0800 Message-Id: <1570719055-25110-4-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1570719055-25110-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1570719055-25110-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 8b2e618..c3b8f90 100755 --- a/tools/testing/selftests/netfilter/ipvs.sh +++ b/tools/testing/selftests/netfilter/ipvs.sh @@ -168,6 +168,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= @@ -183,6 +207,12 @@ run_tests() { test_nat errors=$(( $errors + $? )) + echo "Testing Tunnel mode..." + cleanup + setup + test_tun + errors=$(( $errors + $? )) + return $errors } -- 1.8.3.1