Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2209446ybp; Sat, 5 Oct 2019 07:42:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTUK4FlYJ5Y8mWn2ADEgRO1K34FOj8ds4yLVEkHwQNJ0NEHE65+bPmpwiU8dOmBUpF/AZv X-Received: by 2002:a17:906:b259:: with SMTP id ce25mr16326367ejb.229.1570286560922; Sat, 05 Oct 2019 07:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570286560; cv=none; d=google.com; s=arc-20160816; b=wzgpmzDYMygnm2b+JI17MKFWkA2Vlzh9wtpGeTOKwN1ryu7GUG+lA+QKxgbgzaJlCf 9n5aiLC9otFEin5jKTehIbCBIsa7d8qRE05lrKRRP5VBMnm4ntTiRfGutKq3ybT9TF4+ aHVeOFHMHuxrKq+nDj3US1mcZVTacbkQIh4ZdVoGd24c8X+pkGeCqQq8O5OBMv9uquGd PrqFmipwlP9j0KLtS4CjK6+VAbUAdQC3K2GhcK3QrMkAwoIerKcc5zHYmwZeE8d2+GO/ DzDUPW8PdSOQW54EBCLRE7V9BetwwQ1d/kuMohJWx10zCdzi7+MegW/zQRJ9F/kF0bc8 EjMA== 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=KpwyAOc6E5KhYVV2atm6EnF83B+KSPfMHjSmJ5iHKUQ=; b=hDDvrDuyvXoLx6b5EoyQXwJcUFkeQjmW/lrgaL4Z+a3kyz0TGXT1aOiC7uQu95TMO0 4cqfyjJxWl9XqgJAgVyi2+xFkLKjEkl1SDbw/06MNfiGiWPyNLLBVsoevKJrrS+WzVQE cdZC+eLE53mXRKlf9hT9htlzyl2ppTeltRRKLtjZFXT5KSJ1/Gt55kCSwfVaQH0pmZjq 9EbqForpYjRbNIC1tSMVGIuRkydqttFwG/z71VnwBeQDVCx184HCMGPxxvI8b25hqYTg dGvgZISst2a+ZfC+SRs2El/9MxTKJxN2m8cIal/o21Eo+c9T76e2QwavNLILscqrZawZ SSIQ== 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 d1si4566226ejh.281.2019.10.05.07.42.16; Sat, 05 Oct 2019 07:42:40 -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 S1728720AbfJEOiX (ORCPT + 99 others); Sat, 5 Oct 2019 10:38:23 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:2130 "EHLO cmccmta1.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726853AbfJEOiW (ORCPT ); Sat, 5 Oct 2019 10:38:22 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app04-12004 (RichMail) with SMTP id 2ee45d98aad1471-c330e; Sat, 05 Oct 2019 22:38:11 +0800 (CST) X-RM-TRANSID: 2ee45d98aad1471-c330e 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 2ee35d98aad14aa-fee6e; Sat, 05 Oct 2019 22:38:11 +0800 (CST) X-RM-TRANSID: 2ee35d98aad14aa-fee6e 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 v4 3/3] selftests: netfilter: add ipvs tunnel test case Date: Sat, 5 Oct 2019 22:37:45 +0800 Message-Id: <1570286265-15855-4-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1570286265-15855-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1570286265-15855-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 2601a7c..48647ae 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