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

selftests: forwarding: bridge_mdb_max: Fix failing test with old libnet

As explained in commit 8bcfb4ae4d97 ("selftests: forwarding: Fix failing
tests with old libnet"), old versions of libnet (used by mausezahn) do
not use the "SO_BINDTODEVICE" socket option. For IP unicast packets,
this can be solved by prefixing mausezahn invocations with "ip vrf
exec". However, IP multicast packets do not perform routing and simply
egress the bound device, which does not exist in this case.

Fix by specifying the source and destination MAC of the packet which
will cause mausezahn to use a packet socket instead of an IP socket.

Fixes: 3446dcd7df05 ("selftests: forwarding: bridge_mdb_max: Add a new selftest")
Reported-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
Closes: https://lore.kernel.org/netdev/adc5e40d-d040-a65e-eb26-edf47dac5b02@alu.unizg.hr/
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Tested-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://lore.kernel.org/r/20230808141503.4060661-17-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Ido Schimmel and committed by
Jakub Kicinski
cb034948 e98e195d

+10 -4
+10 -4
tools/testing/selftests/net/forwarding/bridge_mdb_max.sh
··· 252 252 local IPs=$(seq -f 192.0.2.%g 1 $((n - 1))) 253 253 local peer=$(locus_dev_peer $locus) 254 254 local GRP=239.1.1.${grp} 255 - $MZ $peer -c 1 -A 192.0.2.1 -B $GRP \ 255 + local dmac=01:00:5e:01:01:$(printf "%02x" $grp) 256 + $MZ $peer -a own -b $dmac -c 1 -A 192.0.2.1 -B $GRP \ 256 257 -t ip proto=2,p=$(igmpv3_is_in_get $GRP $IPs) -q 257 258 sleep 1 258 259 ··· 273 272 274 273 local peer=$(locus_dev_peer $locus) 275 274 local GRP=239.1.1.${grp} 276 - $MZ $peer -c 1 -A 192.0.2.1 -B 224.0.0.2 \ 275 + local dmac=01:00:5e:00:00:02 276 + $MZ $peer -a own -b $dmac -c 1 -A 192.0.2.1 -B 224.0.0.2 \ 277 277 -t ip proto=2,p=$(igmpv2_leave_get $GRP) -q 278 278 sleep 1 279 279 ! bridge mdb show dev br0 | grep -q $GRP ··· 291 289 local peer=$(locus_dev_peer $locus) 292 290 local SIP=fe80::1 293 291 local GRP=ff0e::${grp} 292 + local dmac=33:33:00:00:00:$(printf "%02x" $grp) 294 293 local p=$(mldv2_is_in_get $SIP $GRP $IPs) 295 - $MZ -6 $peer -c 1 -A $SIP -B $GRP -t ip hop=1,next=0,p="$p" -q 294 + $MZ -6 $peer -a own -b $dmac -c 1 -A $SIP -B $GRP \ 295 + -t ip hop=1,next=0,p="$p" -q 296 296 sleep 1 297 297 298 298 local nn=$(bridge mdb show dev br0 | grep $GRP | wc -l) ··· 314 310 local peer=$(locus_dev_peer $locus) 315 311 local SIP=fe80::1 316 312 local GRP=ff0e::${grp} 313 + local dmac=33:33:00:00:00:$(printf "%02x" $grp) 317 314 local p=$(mldv1_done_get $SIP $GRP) 318 - $MZ -6 $peer -c 1 -A $SIP -B $GRP -t ip hop=1,next=0,p="$p" -q 315 + $MZ -6 $peer -a own -b $dmac -c 1 -A $SIP -B $GRP \ 316 + -t ip hop=1,next=0,p="$p" -q 319 317 sleep 1 320 318 ! bridge mdb show dev br0 | grep -q $GRP 321 319 }