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: nft_tproxy.sh: adjust to socat changes

Like e65d8b6f3092 ("selftests: drv-net: adjust to socat changes") we
need to add shut-none for this test too.

The extra 0-packet can trigger a second (unexpected) reply from the server.

Fixes: 7e37e0eacd22 ("selftests: netfilter: nft_tproxy.sh: add tcp tests")
Reported-by: Jakub Kicinski <kuba@kernel.org>
Closes: https://lore.kernel.org/netdev/20260408152432.24b8ad0d@kernel.org/
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Link: https://patch.msgid.link/20260409224506.27072-1-fw@strlen.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Florian Westphal and committed by
Jakub Kicinski
61119542 03a1569c

+7 -7
+7 -7
tools/testing/selftests/net/netfilter/nft_tproxy_udp.sh
··· 190 190 } 191 191 EOF 192 192 193 - timeout "$timeout" ip netns exec "$nsrouter" socat -u "$socat_ipproto" udp-listen:12345,fork,ip-transparent,reuseport udp:"$ns1_ip_port",ip-transparent,reuseport,bind="$ns2_ip_port" 2>/dev/null & 193 + timeout "$timeout" ip netns exec "$nsrouter" socat -u "$socat_ipproto" udp-listen:12345,fork,ip-transparent,reuseport,shut-none udp:"$ns1_ip_port",ip-transparent,reuseport,bind="$ns2_ip_port",shut-none 2>/dev/null & 194 194 local tproxy_pid=$! 195 195 196 - timeout "$timeout" ip netns exec "$ns2" socat "$socat_ipproto" udp-listen:8080,fork SYSTEM:"echo PONG_NS2" 2>/dev/null & 196 + timeout "$timeout" ip netns exec "$ns2" socat "$socat_ipproto" udp-listen:8080,fork,shut-none SYSTEM:"echo PONG_NS2" 2>/dev/null & 197 197 local server2_pid=$! 198 198 199 - timeout "$timeout" ip netns exec "$ns3" socat "$socat_ipproto" udp-listen:8080,fork SYSTEM:"echo PONG_NS3" 2>/dev/null & 199 + timeout "$timeout" ip netns exec "$ns3" socat "$socat_ipproto" udp-listen:8080,fork,shut-none SYSTEM:"echo PONG_NS3" 2>/dev/null & 200 200 local server3_pid=$! 201 201 202 202 busywait "$BUSYWAIT_TIMEOUT" listener_ready "$nsrouter" 12345 "-u" ··· 205 205 206 206 local result 207 207 # request from ns1 to ns2 (forwarded traffic) 208 - result=$(echo I_M_PROXIED | ip netns exec "$ns1" socat -t 2 -T 2 STDIO udp:"$ns2_ip_port",sourceport=18888) 208 + result=$(echo I_M_PROXIED | ip netns exec "$ns1" socat -t 2 -T 2 STDIO udp:"$ns2_ip_port",sourceport=18888,shut-none) 209 209 if [ "$result" == "$expect_ns1_ns2" ] ;then 210 210 echo "PASS: tproxy test $testname: ns1 got reply \"$result\" connecting to ns2" 211 211 else ··· 214 214 fi 215 215 216 216 # request from ns1 to ns3 (forwarded traffic) 217 - result=$(echo I_M_PROXIED | ip netns exec "$ns1" socat -t 2 -T 2 STDIO udp:"$ns3_ip_port") 217 + result=$(echo I_M_PROXIED | ip netns exec "$ns1" socat -t 2 -T 2 STDIO udp:"$ns3_ip_port",shut-none) 218 218 if [ "$result" = "$expect_ns1_ns3" ] ;then 219 219 echo "PASS: tproxy test $testname: ns1 got reply \"$result\" connecting to ns3" 220 220 else ··· 223 223 fi 224 224 225 225 # request from nsrouter to ns2 (localy originated traffic) 226 - result=$(echo I_M_PROXIED | ip netns exec "$nsrouter" socat -t 2 -T 2 STDIO udp:"$ns2_ip_port") 226 + result=$(echo I_M_PROXIED | ip netns exec "$nsrouter" socat -t 2 -T 2 STDIO udp:"$ns2_ip_port",shut-none) 227 227 if [ "$result" == "$expect_nsrouter_ns2" ] ;then 228 228 echo "PASS: tproxy test $testname: nsrouter got reply \"$result\" connecting to ns2" 229 229 else ··· 232 232 fi 233 233 234 234 # request from nsrouter to ns3 (localy originated traffic) 235 - result=$(echo I_M_PROXIED | ip netns exec "$nsrouter" socat -t 2 -T 2 STDIO udp:"$ns3_ip_port") 235 + result=$(echo I_M_PROXIED | ip netns exec "$nsrouter" socat -t 2 -T 2 STDIO udp:"$ns3_ip_port",shut-none) 236 236 if [ "$result" = "$expect_nsrouter_ns3" ] ;then 237 237 echo "PASS: tproxy test $testname: nsrouter got reply \"$result\" connecting to ns3" 238 238 else