Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8382995ybn; Tue, 1 Oct 2019 07:23:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUL4wps3gD7+EKXA/Tuwk5CIv1fQLyVbpJdpeEktE3gN8S+kRKI5GIC96WZIZ2kBWFzAYC X-Received: by 2002:a05:6402:a50:: with SMTP id bt16mr25445923edb.114.1569939829232; Tue, 01 Oct 2019 07:23:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569939829; cv=none; d=google.com; s=arc-20160816; b=qH/Yrd5uZnf2o7teFCLcNoq1SGqs9Lc4YxrVs0Ypd20pj/zcbPXk7ik0I1Iwp66Eog yt3xsaEz6B9VW1Qai+BH65Fru/gJxWSqXp9IMCo7LM+FDQTUl+Fydc1J2XW6/6lty9aS qYXspE2bPMy2Duckk7fZ6J0Q/or6GOdV0BjJ0j35vT3igVxKn2BTLSmw/XeTXNfbdZ7N imQiPN4ORJoI1WYud6UhasfKNhOYWE28dAZ5PrVwBKChO7TY6R+WY+NrB6uOKmWePueH +FPs5n1jp5RbFvF0i/jcaREyV+0InWK7IO7okPN8rpQ/DWA+0pFsb7+3TrhsegLvB+NT w4Lw== 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=IEJdO5WxZjD5uyu+map0D/fNRdO4WYouv5jx1xXL4rk=; b=B5CcnXTxpVnLs7ZK8lsOPifzb8lCMqoAB301VRdtEQebVL7NAp5gpDn7GQM6OLT2R4 pmV0sPVMikahmjR7wHIHLT9lqw2zo0DSid8v5HuqGQTvpzBWWhTbiN3F/An4jGpkcurj lsUtmS2hmwO2Zw57ZJI54gf3ke9x3dwNv8k8Zoh5RzLy6USGctuWel6CcJ1cWO4uVINI 0Ko2nwoQuiqVyLORLGx2ARuMxfDZvNvqvftsnY7YjnKoxjde0nCSUMrQeecDd1OShvJr I5KCQOrc1f+C0yCoPmsMsVtOfFVUWtGAR0Cg7k+vEAho994zdnNIqKvmMTcU+63+fsKb Hr0g== 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 y47si9139318edd.236.2019.10.01.07.23.24; Tue, 01 Oct 2019 07:23:49 -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 S2389068AbfJAOWg (ORCPT + 99 others); Tue, 1 Oct 2019 10:22:36 -0400 Received: from cmccmta3.chinamobile.com ([221.176.66.81]:25105 "EHLO cmccmta3.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389055AbfJAOWg (ORCPT ); Tue, 1 Oct 2019 10:22:36 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app11-12011 (RichMail) with SMTP id 2eeb5d936119580-943cf; Tue, 01 Oct 2019 22:22:17 +0800 (CST) X-RM-TRANSID: 2eeb5d936119580-943cf X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost (unknown[223.105.0.241]) by rmsmtp-syy-appsvr03-12003 (RichMail) with SMTP id 2ee35d936118070-0678c; Tue, 01 Oct 2019 22:22:16 +0800 (CST) X-RM-TRANSID: 2ee35d936118070-0678c 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 v3 3/3] selftests: netfilter: add ipvs tunnel test case Date: Tue, 1 Oct 2019 22:19:59 +0800 Message-Id: <1569939599-1872-4-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569939599-1872-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1569939599-1872-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 270b5da..a8f6e70 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