Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp864270pxb; Tue, 3 Nov 2020 14:50:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhqIixYl4TLwaAEeG7qpz494ky1dhk9tvY5fCBiwO8DGOG8E1ur/YyRtbnRri0YxmG11Tg X-Received: by 2002:a05:6402:4c6:: with SMTP id n6mr24616068edw.204.1604443812242; Tue, 03 Nov 2020 14:50:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604443812; cv=none; d=google.com; s=arc-20160816; b=WAN/vPcTKyYwIxirGptRtpMAJ7LCRIVA/wvkVHE8kYE1lpgFP2oB6DCGXppOCJ444v G4zR232/4AfV8TXsS+H28LwjfaVmwR408wm/XEiaqv4BcLT7AwOjGeQkj8hONAWwiKib BBUowwlktQiTu6Npn7yReMjP+hq7YTL64tCrqe90PglH62fk9yxx4aPVZy6mHfXD6l0K m+HafvcAXMksFLjF8bKSiKIeSlbTj/rvdG57VcpPaciBarEustwqWzYao2BnAKF/80c6 AFSGrrkdXGPwDzdSKlMpqgo/tBi3N5gh8PfJvTZwW037PzGMcjINgR+vNMOI6TV/zvAn 8xCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=lH5i5uFYniMMbkFnLq314abTav522BASpBwrryyYWwY=; b=FEFnZpRFpuEvAX34Yw7Doba9wRvUHgmcSgiSwB+pr9eGKN81w0EbxkwP8RhuPOhJa+ 5uv2JsjsMTZwgPpif3ShOq8HamRRIMZKYmuPB7S6eeIE8C14uGbRWNH8mPUjBmO4jqNw ULqSwI+V9rnPyJrCdBmVgap0YtrZUP72QpGzc4OjlfLauPyvGjqZVO9e5Q/bGwD+PRfS S9SyGh96YF7JNd1EzJcepsUwfnIIhEjypymjymIKMqNAzsdl5rr9dZFIBw3qRIRS7eTL +ARwtE6W2/NCWPitEqDcIINecpfcVQnh1rPSBe/F1H128fUW/35FNHamBz/J+TE54TY7 ifig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tT3lywau; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a14si43773edn.216.2020.11.03.14.49.48; Tue, 03 Nov 2020 14:50:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tT3lywau; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730497AbgKCWqZ (ORCPT + 99 others); Tue, 3 Nov 2020 17:46:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729575AbgKCWqY (ORCPT ); Tue, 3 Nov 2020 17:46:24 -0500 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7331CC0613D1; Tue, 3 Nov 2020 14:46:24 -0800 (PST) Received: by mail-il1-x141.google.com with SMTP id n5so17636486ile.7; Tue, 03 Nov 2020 14:46:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=lH5i5uFYniMMbkFnLq314abTav522BASpBwrryyYWwY=; b=tT3lywaupetn0TrYjXdzpPpxeD9U/1IlHZPYYir0qeOhE2FYiVW92l943BHtWSbs2v Df9YMKONfCDMM1nbDOgjntrym7OaJEdA8+oONqvsOKySS4L9Qw/7MuuZWFfm7/BupbCu xbNMTft7hB9pp83NslYC59CPvn1P5Feuxszcb13db+to4mZkXIzpuYTfU/j2W8La/Aiz Cr18py9cDYlTKTlt1nWXzElBMaoS4xpysLNjS8O27SXhh6/caIQxDGgm7Zpb4IFA4L0m YxDDVJQhVwZG/7dlBxY9QYJxSFPK0Ubj5a++0c0RBoO09xg17u1LlAfAy0TZQlpyOLOU UO5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lH5i5uFYniMMbkFnLq314abTav522BASpBwrryyYWwY=; b=Sf4oakqRG0I4j+dI7WkcwIluxZ/uo8i13m+YjRnlBaPb8QEz7/usoiwihRy2VyMbeN NKAEZIM3OafFiKo5QM1qyRSdGAF93ZI/1VAiJcW7qvJI6eM6Vl4F2hbLsmQFpncFLKXo hL4MCJI3yyjMq+x2Z7OsovTY0jMRutKrIi6Xoob3A70mj8Vpu3E9/Q/t0EL3mULbE0t4 oCq2kjbY1UI7BseB+oJFVK3N2K/FV03F1FZWyb2f5dZK1dQPMd34vJ3aKGQeD4CAy3VW OmMbYts2xEZ+wj0sn9xNAfEDTUIV8wI8OKtUh1k96iFALEtBVHMwZDxB1vhUfiqSJ8mG TtAQ== X-Gm-Message-State: AOAM531Jc5SZrGXioYpua11EOAjWSQflsAZICBxVrPbctR7gGQVsUn1H JIlgiFZ4Vsc0dVYejRhgYcw= X-Received: by 2002:a92:ae0e:: with SMTP id s14mr6751881ilh.94.1604443583815; Tue, 03 Nov 2020 14:46:23 -0800 (PST) Received: from Davids-MacBook-Pro.local ([2601:282:803:7700:def:1f9b:2059:ffac]) by smtp.googlemail.com with ESMTPSA id l18sm94436ioc.31.2020.11.03.14.46.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Nov 2020 14:46:23 -0800 (PST) Subject: Re: [net-next,v1,5/5] selftests: add selftest for the SRv6 End.DT4 behavior To: Andrea Mayer , "David S. Miller" , David Ahern , Alexey Kuznetsov , Hideaki YOSHIFUJI , Jakub Kicinski , Shuah Khan , Shrijeet Mukherjee , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: Stefano Salsano , Paolo Lungaroni , Ahmed Abdelsalam References: <20201103125242.11468-1-andrea.mayer@uniroma2.it> <20201103125242.11468-6-andrea.mayer@uniroma2.it> From: David Ahern Message-ID: <2f11e5f5-7010-36e2-1e9b-800dc76d0091@gmail.com> Date: Tue, 3 Nov 2020 15:46:19 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201103125242.11468-6-andrea.mayer@uniroma2.it> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/3/20 5:52 AM, Andrea Mayer wrote: > this selftest is designed for evaluating the new SRv6 End.DT4 behavior > used, in this example, for implementing IPv4 L3 VPN use cases. > > Signed-off-by: Andrea Mayer > --- > .../selftests/net/srv6_end_dt4_l3vpn_test.sh | 494 ++++++++++++++++++ > 1 file changed, 494 insertions(+) > create mode 100755 tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh > > diff --git a/tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh b/tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh > new file mode 100755 > index 000000000000..a5547fed5048 > --- /dev/null > +++ b/tools/testing/selftests/net/srv6_end_dt4_l3vpn_test.sh > @@ -0,0 +1,494 @@ > +#!/bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# > +# author: Andrea Mayer > + > +# This test is designed for evaluating the new SRv6 End.DT4 behavior used for > +# implementing IPv4 L3 VPN use cases. > +# > +# Hereafter a network diagram is shown, where two different tenants (named 100 > +# and 200) offer IPv4 L3 VPN services allowing hosts to communicate with each > +# other across an IPv6 network. > +# > +# Only hosts belonging to the same tenant (and to the same VPN) can communicate > +# with each other. Instead, the communication among hosts of different tenants > +# is forbidden. > +# In other words, hosts hs-t100-1 and hs-t100-2 are connected through the IPv4 > +# L3 VPN of tenant 100 while hs-t200-3 and hs-t200-4 are connected using the > +# IPv4 L3 VPN of tenant 200. Cross connection between tenant 100 and tenant 200 > +# is forbidden and thus, for example, hs-t100-1 cannot reach hs-t200-3 and vice > +# versa. > +# > +# Routers rt-1 and rt-2 implement IPv4 L3 VPN services leveraging the SRv6 > +# architecture. The key components for such VPNs are: a) SRv6 Encap behavior, > +# b) SRv6 End.DT4 behavior and c) VRF. > +# > +# To explain how an IPv4 L3 VPN based on SRv6 works, let us briefly consider an > +# example where, within the same domain of tenant 100, the host hs-t100-1 pings > +# the host hs-t100-2. > +# > +# First of all, L2 reachability of the host hs-t100-2 is taken into account by > +# the router rt-1 which acts as an arp proxy. > +# > +# When the host hs-t100-1 sends an IPv4 packet destined to hs-t100-2, the > +# router rt-1 receives the packet on the internal veth-t100 interface. Such > +# interface is enslaved to the VRF vrf-100 whose associated table contains the > +# SRv6 Encap route for encapsulating any IPv4 packet in a IPv6 plus the Segment > +# Routing Header (SRH) packet. This packet is sent through the (IPv6) core > +# network up to the router rt-2 that receives it on veth0 interface. > +# > +# The rt-2 router uses the 'localsid' routing table to process incoming > +# IPv6+SRH packets which belong to the VPN of the tenant 100. For each of these > +# packets, the SRv6 End.DT4 behavior removes the outer IPv6+SRH headers and > +# performs the lookup on the vrf-100 table using the destination address of > +# the decapsulated IPv4 packet. Afterwards, the packet is sent to the host > +# hs-t100-2 through the veth-t100 interface. > +# > +# The ping response follows the same processing but this time the role of rt-1 > +# and rt-2 are swapped. > +# > +# Of course, the IPv4 L3 VPN for tenant 200 works exactly as the IPv4 L3 VPN > +# for tenant 100. In this case, only hosts hs-t200-3 and hs-t200-4 are able to > +# connect with each other. > +# > +# > +# +-------------------+ +-------------------+ > +# | | | | > +# | hs-t100-1 netns | | hs-t100-2 netns | > +# | | | | > +# | +-------------+ | | +-------------+ | > +# | | veth0 | | | | veth0 | | > +# | | 10.0.0.1/24 | | | | 10.0.0.2/24 | | > +# | +-------------+ | | +-------------+ | > +# | . | | . | > +# +-------------------+ +-------------------+ > +# . . > +# . . > +# . . > +# +-----------------------------------+ +-----------------------------------+ > +# | . | | . | > +# | +---------------+ | | +---------------- | > +# | | veth-t100 | | | | veth-t100 | | > +# | | 10.0.0.254/24 | +----------+ | | +----------+ | 10.0.0.254/24 | | > +# | +-------+-------+ | localsid | | | | localsid | +-------+-------- | > +# | | | table | | | | table | | | > +# | +----+----+ +----------+ | | +----------+ +----+----+ | > +# | | vrf-100 | | | | vrf-100 | | > +# | +---------+ +------------+ | | +------------+ +---------+ | > +# | | veth0 | | | | veth0 | | > +# | | fd00::1/64 |.|...|.| fd00::2/64 | | > +# | +---------+ +------------+ | | +------------+ +---------+ | > +# | | vrf-200 | | | | vrf-200 | | > +# | +----+----+ | | +----+----+ | > +# | | | | | | > +# | +---------------+ | | +---------------- | > +# | | veth-t200 | | | | veth-t200 | | > +# | | 10.0.0.254/24 | | | | 10.0.0.254/24 | | > +# | +---------------+ rt-1 netns | | rt-2 netns +---------------- | > +# | . | | . | > +# +-----------------------------------+ +-----------------------------------+ > +# . . > +# . . > +# . . > +# . . > +# +-------------------+ +-------------------+ > +# | . | | . | > +# | +-------------+ | | +-------------+ | > +# | | veth0 | | | | veth0 | | > +# | | 10.0.0.3/24 | | | | 10.0.0.4/24 | | > +# | +-------------+ | | +-------------+ | > +# | | | | > +# | hs-t200-3 netns | | hs-t200-4 netns | > +# | | | | > +# +-------------------+ +-------------------+ > +# > +# > +# ~~~~~~~~~~~~~~~~~~~~~~~~~ > +# | Network configuration | > +# ~~~~~~~~~~~~~~~~~~~~~~~~~ > +# > +# rt-1: localsid table (table 90) > +# +----------------------------------------------+ > +# |SID |Action | > +# +----------------------------------------------+ > +# |fc00:21:100::6004|apply SRv6 End.DT4 table 100| > +# +----------------------------------------------+ > +# |fc00:21:200::6004|apply SRv6 End.DT4 table 200| > +# +----------------------------------------------+ > +# > +# rt-1: VRF tenant 100 (table 100) > +# +---------------------------------------------------+ > +# |host |Action | > +# +---------------------------------------------------+ > +# |10.0.0.2 |apply seg6 encap segs fc00:12:100::6004| > +# +---------------------------------------------------+ > +# |10.0.0.0/24|forward to dev veth_t100 | > +# +---------------------------------------------------+ > +# > +# rt-1: VRF tenant 200 (table 200) > +# +---------------------------------------------------+ > +# |host |Action | > +# +---------------------------------------------------+ > +# |10.0.0.4 |apply seg6 encap segs fc00:12:200::6004| > +# +---------------------------------------------------+ > +# |10.0.0.0/24|forward to dev veth_t200 | > +# +---------------------------------------------------+ > +# > +# > +# rt-2: localsid table (table 90) > +# +----------------------------------------------+ > +# |SID |Action | > +# +----------------------------------------------+ > +# |fc00:12:100::6004|apply SRv6 End.DT4 table 100| > +# +----------------------------------------------+ > +# |fc00:12:200::6004|apply SRv6 End.DT4 table 200| > +# +----------------------------------------------+ > +# > +# rt-2: VRF tenant 100 (table 100) > +# +---------------------------------------------------+ > +# |host |Action | > +# +---------------------------------------------------+ > +# |10.0.0.1 |apply seg6 encap segs fc00:21:100::6004| > +# +---------------------------------------------------+ > +# |10.0.0.0/24|forward to dev veth_t100 | > +# +---------------------------------------------------+ > +# > +# rt-2: VRF tenant 200 (table 200) > +# +---------------------------------------------------+ > +# |host |Action | > +# +---------------------------------------------------+ > +# |10.0.0.3 |apply seg6 encap segs fc00:21:200::6004| > +# +---------------------------------------------------+ > +# |10.0.0.0/24|forward to dev veth_t200 | > +# +---------------------------------------------------+ > +# > + > thanks for creating the very well documented test case. Reviewed-by: David Ahern