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

Configure Feed

Select the types of activity you want to include in your feed.

selftests: netfilter: conntrack_tcp_unreplied.sh: wait for initial connection attempt

Netdev CI reports occasional failures with this test
("ERROR: ns2-dX6bUE did not pick up tcp connection from peer").

Add explicit busywait call until the initial connection attempt shows
up in conntrack rather than a one-shot 'must exist' check.

Signed-off-by: Florian Westphal <fw@strlen.de>
Link: https://lore.kernel.org/r/20240506114320.12178-1-fw@strlen.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Florian Westphal and committed by
Jakub Kicinski
76508154 1eb2cded

+18 -7
+18 -7
tools/testing/selftests/net/netfilter/conntrack_tcp_unreplied.sh
··· 106 106 sleep 0.1 107 107 done' & 108 108 109 + wait_for_attempt() 110 + { 111 + count=$(ip netns exec "$ns2" conntrack -L -p tcp --dport 80 2>/dev/null | wc -l) 112 + if [ "$count" -gt 0 ]; then 113 + return 0 114 + fi 115 + 116 + return 1 117 + } 118 + 119 + # wait for conntrack to pick the new connection request up before loading 120 + # the nat redirect rule. 121 + if ! busywait "$BUSYWAIT_TIMEOUT" wait_for_attempt; then 122 + echo "ERROR: $ns2 did not pick up tcp connection from peer" 123 + exit 1 124 + fi 125 + 109 126 ip netns exec "$ns2" nft -f - <<EOF 110 127 table inet nat { 111 128 chain prerouting { ··· 133 116 EOF 134 117 if [ $? -ne 0 ]; then 135 118 echo "ERROR: Could not load nat redirect" 136 - exit 1 137 - fi 138 - 139 - count=$(ip netns exec "$ns2" conntrack -L -p tcp --dport 80 2>/dev/null | wc -l) 140 - if [ "$count" -eq 0 ]; then 141 - echo "ERROR: $ns2 did not pick up tcp connection from peer" 142 119 exit 1 143 120 fi 144 121 ··· 147 136 } 148 137 echo "INFO: NAT redirect added in ns $ns2, waiting for $BUSYWAIT_TIMEOUT ms for nat to take effect" 149 138 150 - busywait $BUSYWAIT_TIMEOUT wait_for_redirect 139 + busywait "$BUSYWAIT_TIMEOUT" wait_for_redirect 151 140 ret=$? 152 141 153 142 expect="packets 1 bytes 60"