selftests/net: use tc rule to filter the na packet
authorHangbin Liu <liuhangbin@gmail.com>
Fri, 17 May 2024 01:03:27 +0000 (09:03 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 21 May 2024 11:25:11 +0000 (13:25 +0200)
commitea63ac14292564eefc7dffe868ed354ff9ed6f4b
tree50ec54682d904aeec0febfa88aae0742aac826f2
parentefb9f4f19f8e37fde43dfecebc80292d179f56c6
selftests/net: use tc rule to filter the na packet

Test arp_ndisc_untracked_subnets use tcpdump to filter the unsolicited
and untracked na messages. It set -e before calling tcpdump. But if
tcpdump filters 0 packet, it will return none zero, and cause the script
to exit.

Instead of using slow tcpdump to capture packets, let's using tc rule
to filter out the na message.

At the same time, fix function setup_v6 which only needs one parameter.
Move all the related helpers from forwarding lib.sh to net lib.sh.

Fixes: 0ea7b0a454ca ("selftests: net: arp_ndisc_untracked_subnets: test for arp_accept and accept_untracked_na")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240517010327.2631319-1-liuhangbin@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/net/arp_ndisc_untracked_subnets.sh
tools/testing/selftests/net/forwarding/lib.sh
tools/testing/selftests/net/lib.sh