selftests/net: add test for IPv4-in-IPv6 tunneling
Subsystems (3)
PATCH 1/1 selftests/net: add test for IPv4-in-IPv6 tunneling
81c734dae203757fb3c9eee6f9896386940776bd 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 functionality.
[1]: https://lore.kernel.org/all/CAA2RiuSnH_2xc+-W6EnFEG00XjS-dszMq61JEvRjcGS31CBw=g@mail.gmail.com/
--- tools/testing/selftests/net/Makefile | 1 + tools/testing/selftests/net/ip6_tunnel.sh | 41 +++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 tools/testing/selftests/net/ip6_tunnel.sh
tools/testing/selftests/net/Makefile +1 -0
@@ -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 \
tools/testing/selftests/net/ip6_tunnel.sh new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.52.0
Hi Linus
Quoted 1 line · Linus Heckemann
81c734dae203757fb3c9eee6f9896386940776bdwas fine in and of itself, but
Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")'
Quoted 28 lines
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 functionality.
[1]: https://lore.kernel.org/all/CAA2RiuSnH_2xc+-W6EnFEG00XjS-dszMq61JEvRjcGS31CBw=g@mail.gmail.com/
--- tools/testing/selftests/net/Makefile | 1 + tools/testing/selftests/net/ip6_tunnel.sh | 41 +++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 tools/testing/selftests/net/ip6_tunnel.shtools/testing/selftests/net/Makefile +1
-0@@ -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 \tools/testing/selftests/net/ip6_tunnel.sh new file +0
-0
tools/testing/selftests/net/ip6_tunnel.sh line 2
Quoted 2 lines
tools/testing/selftests/net/ip6_tunnel.sh new file +2
-0@@ -0,0 +1,41 @@ +#!/bin/bash +# Test that IPv4-over-IPv6 tunneling works.
Maybe tests IPv6-over-IPv6 as well?
tools/testing/selftests/net/ip6_tunnel.sh line 9
Quoted 7 lines
tools/testing/selftests/net/ip6_tunnel.sh new file +7
-0+ +set -e + +setup_prepare() { + ip link add transport1 type veth peer name transport2 + + ip netns add ns1
net lib has a helper setup_ns()
tools/testing/selftests/net/ip6_tunnel.sh line 18
Quoted 9 lines
tools/testing/selftests/net/ip6_tunnel.sh new file +9
-0+ ip link set transport1 netns ns1 + ip netns exec ns1 bash <<EOF + set -e + ip address add 2001:db8::1/64 dev transport1 nodad + ip link set transport1 up + ip link add link transport1 name tunnel1 type ip6tnl mode ipip6 local 2001:db8::1 remote 2001:db8::2 + ip address add 172.0.0.1/32 peer 172.0.0.2/32 dev tunnel1 + ip link set tunnel1 up +EOF
You can use ip -n $ns_name address/link other than put all the cmds in a inner bash.
tools/testing/selftests/net/ip6_tunnel.sh line 29
Quoted 11 lines
tools/testing/selftests/net/ip6_tunnel.sh new file +11
-0+ + ip netns add ns2 + ip link set transport2 netns ns2 + ip netns exec ns2 bash <<EOF + set -e + ip address add 2001:db8::2/64 dev transport2 nodad + ip link set transport2 up + ip link add link transport2 name tunnel2 type ip6tnl mode ipip6 local 2001:db8::2 remote 2001:db8::1 + ip address add 172.0.0.2/32 peer 172.0.0.1/32 dev tunnel2 + ip link set tunnel2 up +EOF
Same here
tools/testing/selftests/net/ip6_tunnel.sh line 34
Quoted 5 lines
tools/testing/selftests/net/ip6_tunnel.sh new file +5
-0+} + +cleanup() { + ip netns delete ns1 + ip netns delete ns2
At the same time cleanup_all_ns() help could be used.
Quoted 10 lines
tools/testing/selftests/net/ip6_tunnel.sh new file +7
-0+ # in case the namespaces haven't been set up yet + ip link delete transport1 +} + +trap cleanup EXIT +setup_prepare +ip netns exec ns1 ping -W1 -c1 172.0.0.2Signature · 1 line
2.52.0
Thanks
Hangbin
Quoted 5 lines · Linus Heckemann
81c734dae203757fb3c9eee6f9896386940776bdwas 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 functionality.[1]: https://lore.kernel.org/all/CAA2RiuSnH_2xc+-W6EnFEG00XjS-dszMq61JEvRjcGS31CBw=g@mail.gmail.com/
I used this script to test the regression in a clean v6.12 tree with commit 81c734dae203 ("ip6_tunnel: use skb_vlan_inet_prepare() in __ip6_tnl_rcv()") applied on top:
# ../ip6_tunnel.sh PING 172.0.0.2 (172.0.0.2) 56(84) bytes of data.
--- 172.0.0.2 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
dropwatch shows:
1 drops at __ip6_tnl_rcv+74 (0xffffffffc05c7064) [software]
Now, when also applying commit 4b406f814817 ("net: tunnel: make skb_vlan_inet_prepare() return drop reasons") on top of that, the issue goes away. Is there a way to trigger stable to pick this up?
Quoted 65 lines
--- tools/testing/selftests/net/Makefile | 1 + tools/testing/selftests/net/ip6_tunnel.sh | 41 +++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 tools/testing/selftests/net/ip6_tunnel.shtools/testing/selftests/net/Makefile +1
-0@@ -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 \tools/testing/selftests/net/ip6_tunnel.sh new file +41
-0@@ -0,0 +1,41 @@ +#!/bin/bash +# Test that IPv4-over-IPv6 tunneling works. + +set -e + +setup_prepare() { + ip link add transport1 type veth peer name transport2 + + ip netns add ns1 + ip link set transport1 netns ns1 + ip netns exec ns1 bash <<EOF + set -e + ip address add 2001:db8::1/64 dev transport1 nodad + ip link set transport1 up + ip link add link transport1 name tunnel1 type ip6tnl mode ipip6 local 2001:db8::1 remote 2001:db8::2 + ip address add 172.0.0.1/32 peer 172.0.0.2/32 dev tunnel1 + ip link set tunnel1 up +EOF + + ip netns add ns2 + ip link set transport2 netns ns2 + ip netns exec ns2 bash <<EOF + set -e + ip address add 2001:db8::2/64 dev transport2 nodad + ip link set transport2 up + ip link add link transport2 name tunnel2 type ip6tnl mode ipip6 local 2001:db8::2 remote 2001:db8::1 + ip address add 172.0.0.2/32 peer 172.0.0.1/32 dev tunnel2 + ip link set tunnel2 up +EOF +} + +cleanup() { + ip netns delete ns1 + ip netns delete ns2 + # in case the namespaces haven't been set up yet + ip link delete transport1 +} + +trap cleanup EXIT +setup_prepare +ip netns exec ns1 ping -W1 -c1 172.0.0.2
Quoted 19 lines · Ricardo B. Marlière
Quoted 5 lines · Linus Heckemann
81c734dae203757fb3c9eee6f9896386940776bdwas 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 functionality.[1]: https://lore.kernel.org/all/CAA2RiuSnH_2xc+-W6EnFEG00XjS-dszMq61JEvRjcGS31CBw=g@mail.gmail.com/
I used this script to test the regression in a clean v6.12 tree with commit
81c734dae203("ip6_tunnel: useskb_vlan_inet_prepare()in__ip6_tnl_rcv()") applied on top:# ../ip6_tunnel.sh PING 172.0.0.2 (172.0.0.2) 56(84) bytes of data.--- 172.0.0.2 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
Quoted 7 lines
dropwatch shows:
1 drops at __ip6_tnl_rcv+74 (
0xffffffffc05c7064) [software]Now, when also applying commit
4b406f814817("net: tunnel: makeskb_vlan_inet_prepare()return drop reasons") on top of that, the issue
oops, that would be 9990ddf47d41 ("net: tunnel: make skb_vlan_inet_prepare() return drop reasons")
Quoted 67 lines
goes away. Is there a way to trigger stable to pick this up?
Quoted 65 lines
--- tools/testing/selftests/net/Makefile | 1 + tools/testing/selftests/net/ip6_tunnel.sh | 41 +++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 tools/testing/selftests/net/ip6_tunnel.shtools/testing/selftests/net/Makefile +1
-0@@ -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 \tools/testing/selftests/net/ip6_tunnel.sh new file +41
-0@@ -0,0 +1,41 @@ +#!/bin/bash +# Test that IPv4-over-IPv6 tunneling works. + +set -e + +setup_prepare() { + ip link add transport1 type veth peer name transport2 + + ip netns add ns1 + ip link set transport1 netns ns1 + ip netns exec ns1 bash <<EOF + set -e + ip address add 2001:db8::1/64 dev transport1 nodad + ip link set transport1 up + ip link add link transport1 name tunnel1 type ip6tnl mode ipip6 local 2001:db8::1 remote 2001:db8::2 + ip address add 172.0.0.1/32 peer 172.0.0.2/32 dev tunnel1 + ip link set tunnel1 up +EOF + + ip netns add ns2 + ip link set transport2 netns ns2 + ip netns exec ns2 bash <<EOF + set -e + ip address add 2001:db8::2/64 dev transport2 nodad + ip link set transport2 up + ip link add link transport2 name tunnel2 type ip6tnl mode ipip6 local 2001:db8::2 remote 2001:db8::1 + ip address add 172.0.0.2/32 peer 172.0.0.1/32 dev tunnel2 + ip link set tunnel2 up +EOF +} + +cleanup() { + ip netns delete ns1 + ip netns delete ns2 + # in case the namespaces haven't been set up yet + ip link delete transport1 +} + +trap cleanup EXIT +setup_prepare +ip netns exec ns1 ping -W1 -c1 172.0.0.2
Quoted 10 lines · Linus Heckemann
81c734dae203757fb3c9eee6f9896386940776bdwas 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 functionality.[1]: https://lore.kernel.org/all/CAA2RiuSnH_2xc+-W6EnFEG00XjS-dszMq61JEvRjcGS31CBw=g@mail.gmail.com/
--- tools/testing/selftests/net/Makefile | 1 + tools/testing/selftests/net/ip6_tunnel.sh | 41 +++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 tools/testing/selftests/net/ip6_tunnel.sh
FWIW,
Quoted 60 lines
tools/testing/selftests/net/Makefile +1
-0@@ -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 \tools/testing/selftests/net/ip6_tunnel.sh new file +41
-0@@ -0,0 +1,41 @@ +#!/bin/bash +# Test that IPv4-over-IPv6 tunneling works. + +set -e + +setup_prepare() { + ip link add transport1 type veth peer name transport2 + + ip netns add ns1 + ip link set transport1 netns ns1 + ip netns exec ns1 bash <<EOF + set -e + ip address add 2001:db8::1/64 dev transport1 nodad + ip link set transport1 up + ip link add link transport1 name tunnel1 type ip6tnl mode ipip6 local 2001:db8::1 remote 2001:db8::2 + ip address add 172.0.0.1/32 peer 172.0.0.2/32 dev tunnel1 + ip link set tunnel1 up +EOF + + ip netns add ns2 + ip link set transport2 netns ns2 + ip netns exec ns2 bash <<EOF + set -e + ip address add 2001:db8::2/64 dev transport2 nodad + ip link set transport2 up + ip link add link transport2 name tunnel2 type ip6tnl mode ipip6 local 2001:db8::2 remote 2001:db8::1 + ip address add 172.0.0.2/32 peer 172.0.0.1/32 dev tunnel2 + ip link set tunnel2 up +EOF +} + +cleanup() { + ip netns delete ns1 + ip netns delete ns2 + # in case the namespaces haven't been set up yet + ip link delete transport1 +} + +trap cleanup EXIT +setup_prepare +ip netns exec ns1 ping -W1 -c1 172.0.0.2