selftests: net: more pmtu.sh fixes
authorPaolo Abeni <pabeni@redhat.com>
Mon, 12 Feb 2024 10:19:24 +0000 (11:19 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 13 Feb 2024 18:19:05 +0000 (10:19 -0800)
The netdev CI is reporting failures for the pmtu test:

  [  115.929264] br0: port 2(vxlan_a) entered forwarding state
  # 2024/02/08 17:33:22 socat[7871] E bind(7, {AF=10 [0000:0000:0000:0000:0000:0000:0000:0000]:50000}, 28): Address already in use
  # 2024/02/08 17:33:22 socat[7877] E write(7, 0x5598fb6ff000, 8192): Connection refused
  # TEST: IPv6, bridged vxlan4: PMTU exceptions                         [FAIL]
  # File size 0 mismatches exepcted value in locally bridged vxlan test

The root cause is apparently a socket created by a previous iteration
of the relevant loop still lasting in LAST_ACK state.

Note that even the file size check is racy, the receiver process dumping
the file could still be running in background

Allow the listener to bound on the same local port via SO_REUSEADDR and
collect file output file size only after the listener completion.

Fixes: 136a1b434bbb ("selftests: net: test vxlan pmtu exceptions with tcp")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Link: https://lore.kernel.org/r/4f51c11a1ce7ca7a4dabd926cffff63dadac9ba1.1707731086.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/pmtu.sh

index d65fdd407d73f99bc0cbcdf17cfcca9ad6efea87..cfc84958025a61e7ee24a3675a0969e0e3c7cd52 100755 (executable)
@@ -1336,16 +1336,16 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() {
                else
                        TCPDST="TCP:[${dst}]:50000"
                fi
-               ${ns_b} socat -T 3 -u -6 TCP-LISTEN:50000 STDOUT > $tmpoutfile &
+               ${ns_b} socat -T 3 -u -6 TCP-LISTEN:50000,reuseaddr STDOUT > $tmpoutfile &
                local socat_pid=$!
 
                wait_local_port_listen ${NS_B} 50000 tcp
 
                dd if=/dev/zero status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3
 
+               wait ${socat_pid}
                size=$(du -sb $tmpoutfile)
                size=${size%%/tmp/*}
-               wait ${socat_pid}
 
                [ $size -ne 1048576 ] && err "File size $size mismatches exepcted value in locally bridged vxlan test" && return 1
        done