Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp784111ybp; Wed, 9 Oct 2019 04:17:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwHjCfndK7Fwu42MX/tMfktGUSm3echOi72wy0b64/U5MhfspgXJnDeZmxN8FnxEXcON7fN X-Received: by 2002:aa7:c959:: with SMTP id h25mr2398725edt.216.1570619872729; Wed, 09 Oct 2019 04:17:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570619872; cv=none; d=google.com; s=arc-20160816; b=G4JqNV8LOnPwk77cPEZRr8rw2igpI6DTbYzezFMUzvRfHtYbNoJcEt6r5W2qAYAqGd LLGXICh/qtp/2yT7TQQXbNlx2nV1T9g8bcPogjE9SWlg1ky4U5bV0Lj7SCuBmM41uBcH y1gBFUUnpos8+9Odc2YmtvcrlHszDhGJ3kVeEkhyGmWK4BnZCsH+zhxmenftGEzUcL2z kLbS0O3eFL3IycQ8Mc7+7uLCUb08XYyApuPZw0CN8zc93UgWZ9amUm13ApkDFzfr0jYG ThOxpAr37kmC6Sy7BqqxFeoopOh/83RhgCsuse4xV9lRJy38EO0Lbn3PndaPrx7omEjz 04aQ== 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=a7F6ewAsQWlIKQ8xD4/I2xC63WbolsJGHmWOD9+A7i4=; b=tU8ZgQFHs+PPci7x4d38NvkiWdt7EhiqAwhFr5DydrK2w+hkoqA5nUwEbPN4yoGDoL AWMzrjRmSDGrwGLmvdKgfpwtqNjJ8OrvFgx8c0p4viXdma5B/wZ/h1Z9GE2LV5LR+7Ov PkyQxx7SoOYJHGw6riPNSVV8+253IFL6J9nBhj7JLwKMjRjJHAE/g1+YE7drEB3dYSiM yABi7ZyDBBHUSud9zwzNktvWGeOnhOxm9m0yu+CiCem6G6bdWcGQz5feuolfD6H1nXXS kH6XiW9+eBVZoeDnAC5/otbadNu/1F8PEU6ticczUQIZawjI4VaSCx7XDqDuGVHq4ZDd HHvA== 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 re13si928059ejb.279.2019.10.09.04.17.28; Wed, 09 Oct 2019 04:17:52 -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 S1730807AbfJILRR (ORCPT + 99 others); Wed, 9 Oct 2019 07:17:17 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:5553 "EHLO cmccmta1.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727228AbfJILRQ (ORCPT ); Wed, 9 Oct 2019 07:17:16 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.13]) by rmmx-syy-dmz-app03-12003 (RichMail) with SMTP id 2ee35d9dc1a5921-087f3; Wed, 09 Oct 2019 19:16:55 +0800 (CST) X-RM-TRANSID: 2ee35d9dc1a5921-087f3 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 2ee75d9dc1a6c47-6ba43; Wed, 09 Oct 2019 19:16:55 +0800 (CST) X-RM-TRANSID: 2ee75d9dc1a6c47-6ba43 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 v5 3/3] selftests: netfilter: add ipvs tunnel test case Date: Wed, 9 Oct 2019 19:16:30 +0800 Message-Id: <1570619790-6086-4-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1570619790-6086-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1570619790-6086-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 60250f7..edea729 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