On 9/1/26 8:09 AM, Ricardo B. Marlière (SUSE) wrote:
> @@ -53,11 +54,21 @@ ip -netns $NS2 route add $RT2 via inet6 $H1_IP6
>  # Make sure ns2 will respond with ICMP unreachable
>  ip netns exec $NS2 sysctl -qw net.ipv4.icmp_ratelimit=0 net.ipv4.ip_forward=1
>  
> -# Run the test - a ping runs in the background, and we capture ICMP responses
> -# with tcpdump; -c 1 means it should exit on the first ping, but add a 
> timeout
> -# in case something goes wrong
> +# Run the test - start tcpdump and wait for it to be capturing before
> +# sending any traffic. -c 1 means it should exit on the first ping, but add
> +# a timeout in case something goes wrong
> +ip netns exec $NS1 timeout 10 tcpdump -tpni veth0 -c 1 \
> +    'icmp and icmp[icmptype] != icmp-echo' > $TMPFILE 2>$TCPDUMP_ERR &

Why keep the 'timeout 10'?

> +TCPDUMP_PID=$!

You have the pid. You can always kill it after the ping command if it
does not terminate on its own after the 1 packet is received.

> +if ! slowwait 3 grep -qs "listening" "$TCPDUMP_ERR"; then
> +    echo "FAIL - tcpdump did not start listening"
> +    cat "$TCPDUMP_ERR"
> +    exit 1
> +fi
> +
>  ip netns exec $NS1 ping -w 3 -i 0.5 $PINGADDR >/dev/null &
> -ip netns exec $NS1 timeout 10 tcpdump -tpni veth0 -c 1 'icmp and 
> icmp[icmptype] != icmp-echo' > $TMPFILE 2>/dev/null
> +
> +wait $TCPDUMP_PID
>  



Reply via email to