Skip to content

Commit 136a1b4

Browse files
Florian Westphalkuba-moo
authored andcommitted
selftests: net: test vxlan pmtu exceptions with tcp
TCP might get stuck if a nonlinear skb exceeds the path MTU, icmp error contains an incorrect icmp checksum in that case. Extend the existing test for vxlan to also send at least 1MB worth of data via TCP in addition to the existing 'large icmp packet adds route exception'. On my test VM this fails due to 0-size output file without "tunnels: fix kasan splat when generating ipv4 pmtu error". Signed-off-by: Florian Westphal <fw@strlen.de> Link: https://lore.kernel.org/r/20230803152653.29535-3-fw@strlen.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 6a7ac3d commit 136a1b4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tools/testing/selftests/net/pmtu.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ err_buf=
361361
tcpdump_pids=
362362
nettest_pids=
363363
socat_pids=
364+
tmpoutfile=
364365

365366
err() {
366367
err_buf="${err_buf}${1}
@@ -951,6 +952,7 @@ cleanup() {
951952
ip link del veth_A-R1 2>/dev/null
952953
ovs-vsctl --if-exists del-port vxlan_a 2>/dev/null
953954
ovs-vsctl --if-exists del-br ovs_br0 2>/dev/null
955+
rm -f "$tmpoutfile"
954956
}
955957

956958
mtu() {
@@ -1328,6 +1330,39 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() {
13281330
check_pmtu_value ${exp_mtu} "${pmtu}" "exceeding link layer MTU on bridged ${type} interface"
13291331
pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})"
13301332
check_pmtu_value ${exp_mtu} "${pmtu}" "exceeding link layer MTU on locally bridged ${type} interface"
1333+
1334+
tmpoutfile=$(mktemp)
1335+
1336+
# Flush Exceptions, retry with TCP
1337+
run_cmd ${ns_a} ip route flush cached ${dst}
1338+
run_cmd ${ns_b} ip route flush cached ${dst}
1339+
run_cmd ${ns_c} ip route flush cached ${dst}
1340+
1341+
for target in "${ns_a}" "${ns_c}" ; do
1342+
if [ ${family} -eq 4 ]; then
1343+
TCPDST=TCP:${dst}:50000
1344+
else
1345+
TCPDST="TCP:[${dst}]:50000"
1346+
fi
1347+
${ns_b} socat -T 3 -u -6 TCP-LISTEN:50000 STDOUT > $tmpoutfile &
1348+
1349+
sleep 1
1350+
1351+
dd if=/dev/zero of=/dev/stdout status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3
1352+
1353+
size=$(du -sb $tmpoutfile)
1354+
size=${size%%/tmp/*}
1355+
1356+
[ $size -ne 1048576 ] && err "File size $size mismatches exepcted value in locally bridged vxlan test" && return 1
1357+
done
1358+
1359+
rm -f "$tmpoutfile"
1360+
1361+
# Check that exceptions were created
1362+
pmtu="$(route_get_dst_pmtu_from_exception "${ns_c}" ${dst})"
1363+
check_pmtu_value ${exp_mtu} "${pmtu}" "tcp: exceeding link layer MTU on bridged ${type} interface"
1364+
pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})"
1365+
check_pmtu_value ${exp_mtu} "${pmtu}" "tcp exceeding link layer MTU on locally bridged ${type} interface"
13311366
}
13321367

13331368
test_pmtu_ipv4_br_vxlan4_exception() {

0 commit comments

Comments
 (0)