Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests/net: add test for IP-in-IPv6 tunneling

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/

Signed-off-by: Linus Heckemann <git@sphalerite.org>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Ricardo B. Marlière <rbm@suse.com>
Tested-by: Ricardo B. Marlière <rbm@suse.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260221114806.1231666-1-git@sphalerite.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Linus Heckemann and committed by
Jakub Kicinski
f77c7b96 8bf22c33

+45
+1
tools/testing/selftests/net/Makefile
··· 44 44 io_uring_zerocopy_tx.sh \ 45 45 ioam6.sh \ 46 46 ip6_gre_headroom.sh \ 47 + ip6_tunnel.sh \ 47 48 ip_defrag.sh \ 48 49 ip_local_port_range.sh \ 49 50 ipv6_flowlabel.sh \
+44
tools/testing/selftests/net/ip6_tunnel.sh
··· 1 + #!/bin/bash 2 + # Test that IPv4-over-IPv6 tunneling works. 3 + 4 + source lib.sh 5 + set -e 6 + 7 + setup_prepare() { 8 + ip link add transport1 type veth peer name transport2 9 + 10 + setup_ns ns1 11 + ip link set transport1 netns $ns1 12 + ip -n $ns1 address add 2001:db8::1/64 dev transport1 nodad 13 + ip -n $ns1 address add 2001:db8::3/64 dev transport1 nodad 14 + ip -n $ns1 link set transport1 up 15 + ip -n $ns1 link add link transport1 name tunnel4 type ip6tnl mode ipip6 local 2001:db8::1 remote 2001:db8::2 16 + ip -n $ns1 address add 172.0.0.1/32 peer 172.0.0.2/32 dev tunnel4 17 + ip -n $ns1 link set tunnel4 up 18 + ip -n $ns1 link add link transport1 name tunnel6 type ip6tnl mode ip6ip6 local 2001:db8::3 remote 2001:db8::4 19 + ip -n $ns1 address add 2001:db8:6::1/64 dev tunnel6 20 + ip -n $ns1 link set tunnel6 up 21 + 22 + setup_ns ns2 23 + ip link set transport2 netns $ns2 24 + ip -n $ns2 address add 2001:db8::2/64 dev transport2 nodad 25 + ip -n $ns2 address add 2001:db8::4/64 dev transport2 nodad 26 + ip -n $ns2 link set transport2 up 27 + ip -n $ns2 link add link transport2 name tunnel4 type ip6tnl mode ipip6 local 2001:db8::2 remote 2001:db8::1 28 + ip -n $ns2 address add 172.0.0.2/32 peer 172.0.0.1/32 dev tunnel4 29 + ip -n $ns2 link set tunnel4 up 30 + ip -n $ns2 link add link transport2 name tunnel6 type ip6tnl mode ip6ip6 local 2001:db8::4 remote 2001:db8::3 31 + ip -n $ns2 address add 2001:db8:6::2/64 dev tunnel6 32 + ip -n $ns2 link set tunnel6 up 33 + } 34 + 35 + cleanup() { 36 + cleanup_all_ns 37 + # in case the namespaces haven't been set up yet 38 + ip link delete transport1 &>/dev/null || true 39 + } 40 + 41 + trap cleanup EXIT 42 + setup_prepare 43 + ip netns exec $ns1 ping -q -W1 -c1 172.0.0.2 >/dev/null 44 + ip netns exec $ns1 ping -q -W1 -c1 2001:db8:6::2 >/dev/null