Re: [PATCH net v2] selftests/net: Fix icmp.sh race between ping and tcpdump startup

From: Ricardo B. Marlière (SUSE)

Date: Sat Sep 12 2026 - 13:43:32 EST


On Fri Sep 11, 2026 at 9:40 PM -03, Jakub Kicinski wrote:
> On Fri, 11 Sep 2026 15:41:33 -0300 Ricardo B. Marlière (SUSE) wrote:
>> icmp.sh backgrounds ping and then starts tcpdump, with no synchronization
>> between the two. If tcpdump is not capturing yet by the time the ICMP
>> unreachable replies come back, the test fails even though the kernel
>> behaved correctly:
>>
>> FAIL - got ICMP response from , should be 192.0.0.8
>>
>> The empty address is misleading: it means the capture matched nothing
>> before its 10s timeout, not that the reply had a wrong source address.
>> NS1's Icmp InDestUnreachs counter still increments across such a failure,
>> so the replies were generated and did reach NS1. Ping sends several probes
>> over its 3s deadline, so losing every one of them takes a multi-second
>> stall in tcpdump startup, which does happen on loaded CI hosts [1].
>>
>> Fix it by starting tcpdump first and waiting for its "listening" banner
>> via slowwait() before sending traffic. Run ping synchronously, then kill
>> and reap tcpdump if it did not already exit on -c 1.
>
> It used to pass in NIPA CI and now it fails:
> https://netdev-ctrl.bots.linux.dev/logs/vmksft/net-dbg/results/819341/86-icmp-sh/stdout

Thanks for the pointer, I'll prepare v3

>
>> Fixes: 7e9838b7915e ("selftests/net: Add icmp.sh for testing ICMP dummy address responses")
>
> Please don't add Fixes tags to selftest improvements.

Wouldn't this mean that the commit would not be picked up by stable,
creating a gap there?

>
>> Link: https://openqa.opensuse.org/tests/5907626/logfile?filename=icmp_sh.tap.txt#line-2 [1]
>> Signed-off-by: Ricardo B. Marlière (SUSE) <ricardo@xxxxxxxxxxxx>