public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Linus Heckemann <git@sphalerite.org>
Cc: edumazet@google.com, davem@davemloft.net, eric.dumazet@gmail.com,
	horms@kernel.org, kuba@kernel.org, morikw2@gmail.com,
	netdev@vger.kernel.org, pabeni@redhat.com,
	syzbot+d4dda070f833dc5dc89a@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] selftests/net: add test for IPv4-in-IPv6 tunneling
Date: Tue, 10 Feb 2026 01:59:19 +0000	[thread overview]
Message-ID: <aYqQ9zPAisaNLpMX@fedora> (raw)
In-Reply-To: <20260209190008.139099-2-git@sphalerite.org>

Hi Linus,

For the subject, please also provide the target repo. e.g. [PATCH v2 net-next]

On Mon, Feb 09, 2026 at 08:00:09PM +0100, Linus Heckemann wrote:
> commit 81c734dae203 ("ip6_tunnel: use skb_vlan_inet_prepare() in
> __ip6_tnl_rcv()") was fine in and of itself, but its backport to 6.12
> (and 6.6) broke IPv4-in-IPv6 tunneling, see [1]. This adds a self-test
> for basic IPv4-in-IPv6 and IPv6-in-IPv6 functionality.
> 
> [1]: https://lore.kernel.org/all/CAA2RiuSnH_2xc+-W6EnFEG00XjS-dszMq61JEvRjcGS31CBw=g@mail.gmail.com/
> 
> --
> Thanks for the review, Hangbin!
> ---
>  tools/testing/selftests/net/Makefile      |  1 +
>  tools/testing/selftests/net/ip6_tunnel.sh | 43 +++++++++++++++++++++++
>  2 files changed, 44 insertions(+)
>  create mode 100644 tools/testing/selftests/net/ip6_tunnel.sh
> 
> diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
> index 45c4ea381bc36..5037a344ad826 100644
> --- a/tools/testing/selftests/net/Makefile
> +++ b/tools/testing/selftests/net/Makefile
> @@ -43,6 +43,7 @@ TEST_PROGS := \
>  	io_uring_zerocopy_tx.sh \
>  	ioam6.sh \
>  	ip6_gre_headroom.sh \
> +	ip6_tunnel.sh \
>  	ip_defrag.sh \
>  	ip_local_port_range.sh \
>  	ipv6_flowlabel.sh \
> diff --git a/tools/testing/selftests/net/ip6_tunnel.sh b/tools/testing/selftests/net/ip6_tunnel.sh
> new file mode 100644
> index 0000000000000..4886618fd2689
> --- /dev/null
> +++ b/tools/testing/selftests/net/ip6_tunnel.sh
> @@ -0,0 +1,43 @@
> +#!/bin/bash
> +# Test that IPv4-over-IPv6 tunneling works.
> +
> +source lib.sh
> +
> +setup_prepare() {
> +  ip link add transport1 type veth peer name transport2
> +
> +  setup_ns ns1
> +  ip link set transport1 netns $ns1
> +  ip -n $ns1 address add 2001:db8::1/64 dev transport1 nodad
> +  ip -n $ns1 address add 2001:db8::3/64 dev transport1 nodad
> +  ip -n $ns1 link set transport1 up
> +  ip -n $ns1 link add link transport1 name tunnel4 type ip6tnl mode ipip6 local 2001:db8::1 remote 2001:db8::2
> +  ip -n $ns1 address add 172.0.0.1/32 peer 172.0.0.2/32 dev tunnel4
> +  ip -n $ns1 link set tunnel4 up
> +  ip -n $ns1 link add link transport1 name tunnel6 type ip6tnl mode ip6ip6 local 2001:db8::3 remote 2001:db8::4
> +  ip -n $ns1 address add 2001:db8:6::1/64 dev tunnel6
> +  ip -n $ns1 link set tunnel6 up
> +
> +  setup_ns ns2
> +  ip link set transport2 netns $ns2
> +  ip -n $ns2 address add 2001:db8::2/64 dev transport2 nodad
> +  ip -n $ns2 address add 2001:db8::4/64 dev transport2 nodad
> +  ip -n $ns2 link set transport2 up
> +  ip -n $ns2 link add link transport2 name tunnel4 type ip6tnl mode ipip6 local 2001:db8::2 remote 2001:db8::1
> +  ip -n $ns2 address add 172.0.0.2/32 peer 172.0.0.1/32 dev tunnel4
> +  ip -n $ns2 link set tunnel4 up
> +  ip -n $ns2 link add link transport2 name tunnel6 type ip6tnl mode ip6ip6 local 2001:db8::4 remote 2001:db8::3
> +  ip -n $ns2 address add 2001:db8:6::2/64 dev tunnel6
> +  ip -n $ns2 link set tunnel6 up
> +}
> +
> +cleanup() {
> +  cleanup_all_ns
> +  # in case the namespaces haven't been set up yet
> +  ip link delete transport1 || true

Maybe
  ip link delete transport1 &> /dev/null || true

since this cmd usually would fail and report
  Cannot find device "transport1"
> +}

You forgot to add `set -e`,
> +
> +trap cleanup EXIT
> +setup_prepare
> +ip netns exec $ns1 ping -W1 -c1 172.0.0.2
> +ip netns exec $ns1 ping -W1 -c1 2001:db8:6::2

So if the first ping failed, and the second ping pass, the total test will
still return 0.

Thanks
Hangbin

  reply	other threads:[~2026-02-10  1:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-09 19:00 [PATCH v2] selftests/net: add test for IPv4-in-IPv6 tunneling Linus Heckemann
2026-02-10  1:59 ` Hangbin Liu [this message]
2026-02-11  2:14 ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aYqQ9zPAisaNLpMX@fedora \
    --to=liuhangbin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=git@sphalerite.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=morikw2@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+d4dda070f833dc5dc89a@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox