From patchwork Tue Nov 6 21:39:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Brivio X-Patchwork-Id: 993888 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42qNHL0K5cz9sDn for ; Wed, 7 Nov 2018 08:39:42 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388053AbeKGHGz (ORCPT ); Wed, 7 Nov 2018 02:06:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42158 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387612AbeKGHGz (ORCPT ); Wed, 7 Nov 2018 02:06:55 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CAF327F6C5; Tue, 6 Nov 2018 21:39:39 +0000 (UTC) Received: from epycfail.redhat.com (ovpn-200-16.brq.redhat.com [10.40.200.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 342D810840C8; Tue, 6 Nov 2018 21:39:37 +0000 (UTC) From: Stefano Brivio To: "David S. Miller" Cc: Sabrina Dubroca , Xin Long , netdev@vger.kernel.org Subject: [PATCH net-next 07/11] selftests: pmtu: Introduce tests for IPv4/IPv6 over GENEVE over IPv6 Date: Tue, 6 Nov 2018 22:39:03 +0100 Message-Id: <30bc36eea991cd6f35418c9ddc4cf322ed99e6e9.1541533786.git.sbrivio@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 06 Nov 2018 21:39:39 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use a router between endpoints, implemented via namespaces, set a low MTU between router and destination endpoint, exceed it and check PMTU value in route exceptions. Reviewed-by: Sabrina Dubroca Signed-off-by: Stefano Brivio --- This only introduces tests over GENEVE over IPv6 right now. I'll introduce tests over IPv4 (they can be added trivially) once DF configuration support is accepted into iproute2. tools/testing/selftests/net/pmtu.sh | 78 ++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 23 deletions(-) diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh index 19ede74af560..e9bb0c37bdfc 100755 --- a/tools/testing/selftests/net/pmtu.sh +++ b/tools/testing/selftests/net/pmtu.sh @@ -37,6 +37,12 @@ # - pmtu_ipv6_vxlan6_exception # Same as pmtu_ipv4_vxlan6_exception, but send IPv6 packets from A to B # +# - pmtu_ipv4_geneve6_exception +# Same as pmtu_ipv4_vxlan6, but using a GENEVE tunnel instead of VxLAN +# +# - pmtu_ipv6_geneve6_exception +# Same as pmtu_ipv6_vxlan6, but using a GENEVE tunnel instead of VxLAN +# # - pmtu_vti4_exception # Set up vti tunnel on top of veth, with xfrm states and policies, in two # namespaces with matching endpoints. Check that route exception is not @@ -85,6 +91,8 @@ tests=" pmtu_ipv6_exception ipv6: PMTU exceptions pmtu_ipv4_vxlan6_exception IPv4 over vxlan6: PMTU exceptions pmtu_ipv6_vxlan6_exception IPv6 over vxlan6: PMTU exceptions + pmtu_ipv4_geneve6_exception IPv4 over geneve6: PMTU exceptions + pmtu_ipv6_geneve6_exception IPv6 over geneve6: PMTU exceptions pmtu_vti6_exception vti6: PMTU exceptions pmtu_vti4_exception vti4: PMTU exceptions pmtu_vti4_default_mtu vti4: default MTU assignment @@ -222,27 +230,42 @@ setup_vti6() { setup_vti 6 ${veth6_a_addr} ${veth6_b_addr} ${tunnel6_a_addr} ${tunnel6_b_addr} ${tunnel6_mask} } -setup_vxlan() { - a_addr="${1}" - b_addr="${2}" +setup_vxlan_or_geneve() { + type="${1}" + a_addr="${2}" + b_addr="${3}" + + if [ "${type}" = "vxlan" ]; then + opts="ttl 64 dstport 4789" + opts_a="local ${a_addr}" + opts_b="local ${b_addr}" + else + opts="" + opts_a="" + opts_b="" + fi - ${ns_a} ip link add vxlan_a type vxlan id 1 local ${a_addr} remote ${b_addr} ttl 64 dstport 4789 || return 1 - ${ns_b} ip link add vxlan_b type vxlan id 1 local ${b_addr} remote ${a_addr} ttl 64 dstport 4789 + ${ns_a} ip link add ${type}_a type ${type} id 1 ${opts_a} remote ${b_addr} ${opts} || return 1 + ${ns_b} ip link add ${type}_b type ${type} id 1 ${opts_b} remote ${a_addr} ${opts} - ${ns_a} ip addr add ${tunnel4_a_addr}/${tunnel4_mask} dev vxlan_a - ${ns_b} ip addr add ${tunnel4_b_addr}/${tunnel4_mask} dev vxlan_b + ${ns_a} ip addr add ${tunnel4_a_addr}/${tunnel4_mask} dev ${type}_a + ${ns_b} ip addr add ${tunnel4_b_addr}/${tunnel4_mask} dev ${type}_b - ${ns_a} ip addr add ${tunnel6_a_addr}/${tunnel6_mask} dev vxlan_a - ${ns_b} ip addr add ${tunnel6_b_addr}/${tunnel6_mask} dev vxlan_b + ${ns_a} ip addr add ${tunnel6_a_addr}/${tunnel6_mask} dev ${type}_a + ${ns_b} ip addr add ${tunnel6_b_addr}/${tunnel6_mask} dev ${type}_b - ${ns_a} ip link set vxlan_a up - ${ns_b} ip link set vxlan_b up + ${ns_a} ip link set ${type}_a up + ${ns_b} ip link set ${type}_b up sleep 1 } +setup_geneve6() { + setup_vxlan_or_geneve geneve ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 +} + setup_vxlan6() { - setup_vxlan ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 + setup_vxlan_or_geneve vxlan ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 } setup_xfrm() { @@ -501,15 +524,16 @@ test_pmtu_ipv6_exception() { test_pmtu_ipvX 6 } -test_pmtu_ipvX_over_vxlan6_exception() { - family=${1} +test_pmtu_ipvX_over_vxlan6_or_geneve6_exception() { + type=${1} + family=${2} ll_mtu=4000 - setup namespaces routing vxlan6 || return 2 - # IPv6 header UDP header VxLAN header Ethernet header - exp_mtu=$((${ll_mtu} - 40 - 8 - 8 - 14)) + setup namespaces routing ${type}6 || return 2 + # IPv6 header UDP header VxLAN/GENEVE header Ethernet header + exp_mtu=$((${ll_mtu} - 40 - 8 - 8 - 14)) - trace "${ns_a}" vxlan_a "${ns_b}" vxlan_b \ + trace "${ns_a}" ${type}_a "${ns_b}" ${type}_b \ "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ "${ns_b}" veth_B-R1 "${ns_r1}" veth_R1-B @@ -527,21 +551,29 @@ test_pmtu_ipvX_over_vxlan6_exception() { mtu "${ns_b}" veth_B-R1 ${ll_mtu} mtu "${ns_r1}" veth_R1-B ${ll_mtu} - mtu "${ns_a}" vxlan_a $((${ll_mtu} + 1000)) - mtu "${ns_b}" vxlan_b $((${ll_mtu} + 1000)) + mtu "${ns_a}" ${type}_a $((${ll_mtu} + 1000)) + mtu "${ns_b}" ${type}_b $((${ll_mtu} + 1000)) ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s $((${ll_mtu} + 500)) ${dst} > /dev/null # Check that exception was created pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})" - check_pmtu_value ${exp_mtu} "${pmtu}" "exceeding link layer MTU on VxLAN interface" + check_pmtu_value ${exp_mtu} "${pmtu}" "exceeding link layer MTU on ${type} interface" } test_pmtu_ipv4_vxlan6_exception() { - test_pmtu_ipvX_over_vxlan6_exception 4 + test_pmtu_ipvX_over_vxlan6_or_geneve6_exception vxlan 4 } test_pmtu_ipv6_vxlan6_exception() { - test_pmtu_ipvX_over_vxlan6_exception 6 + test_pmtu_ipvX_over_vxlan6_or_geneve6_exception vxlan 6 +} + +test_pmtu_ipv4_geneve6_exception() { + test_pmtu_ipvX_over_vxlan6_or_geneve6_exception geneve 4 +} + +test_pmtu_ipv6_geneve6_exception() { + test_pmtu_ipvX_over_vxlan6_or_geneve6_exception geneve 6 } test_pmtu_vti4_exception() {