Skip to content

Commit

Permalink
selftests: net: add test case for NAT46 looping back dst
Browse files Browse the repository at this point in the history
Simple test for crash involving multicast loopback and stale dst.
Reuse exising NAT46 program.

Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250610001245.1981782-2-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Jun 12, 2025
1 parent ba9db6f commit 5677669
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/testing/selftests/net/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ TEST_PROGS += amt.sh
TEST_PROGS += unicast_extensions.sh
TEST_PROGS += udpgro_fwd.sh
TEST_PROGS += udpgro_frglist.sh
TEST_PROGS += nat6to4.sh
TEST_PROGS += veth.sh
TEST_PROGS += ioam6.sh
TEST_PROGS += gro.sh
Expand Down
15 changes: 15 additions & 0 deletions tools/testing/selftests/net/nat6to4.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

NS="ns-peer-$(mktemp -u XXXXXX)"

ip netns add "${NS}"
ip -netns "${NS}" link set lo up
ip -netns "${NS}" route add default via 127.0.0.2 dev lo

tc -n "${NS}" qdisc add dev lo ingress
tc -n "${NS}" filter add dev lo ingress prio 4 protocol ip \
bpf object-file nat6to4.bpf.o section schedcls/egress4/snat4 direct-action

ip netns exec "${NS}" \
bash -c 'echo 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789abc | socat - UDP4-DATAGRAM:224.1.0.1:6666,ip-multicast-loop=1'

0 comments on commit 5677669

Please sign in to comment.