mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 12:14:06 +00:00
Merge branch 'tunnels-fix-ipv4-pmtu-icmp-checksum'
Florian Westphal says: ==================== tunnels: fix ipv4 pmtu icmp checksum The checksum of the generated ipv4 icmp pmtud message is only correct if the skb that causes the icmp error generation is linear. Fix this and add a selftest for this. ==================== Link: https://lore.kernel.org/r/20230803152653.29535-1-fw@strlen.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
ec93518839
2 changed files with 36 additions and 1 deletions
|
@ -224,7 +224,7 @@ static int iptunnel_pmtud_build_icmp(struct sk_buff *skb, int mtu)
|
|||
.un.frag.__unused = 0,
|
||||
.un.frag.mtu = htons(mtu),
|
||||
};
|
||||
icmph->checksum = ip_compute_csum(icmph, len);
|
||||
icmph->checksum = csum_fold(skb_checksum(skb, 0, len, 0));
|
||||
skb_reset_transport_header(skb);
|
||||
|
||||
niph = skb_push(skb, sizeof(*niph));
|
||||
|
|
|
@ -361,6 +361,7 @@ err_buf=
|
|||
tcpdump_pids=
|
||||
nettest_pids=
|
||||
socat_pids=
|
||||
tmpoutfile=
|
||||
|
||||
err() {
|
||||
err_buf="${err_buf}${1}
|
||||
|
@ -951,6 +952,7 @@ cleanup() {
|
|||
ip link del veth_A-R1 2>/dev/null
|
||||
ovs-vsctl --if-exists del-port vxlan_a 2>/dev/null
|
||||
ovs-vsctl --if-exists del-br ovs_br0 2>/dev/null
|
||||
rm -f "$tmpoutfile"
|
||||
}
|
||||
|
||||
mtu() {
|
||||
|
@ -1328,6 +1330,39 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() {
|
|||
check_pmtu_value ${exp_mtu} "${pmtu}" "exceeding link layer MTU on bridged ${type} interface"
|
||||
pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})"
|
||||
check_pmtu_value ${exp_mtu} "${pmtu}" "exceeding link layer MTU on locally bridged ${type} interface"
|
||||
|
||||
tmpoutfile=$(mktemp)
|
||||
|
||||
# Flush Exceptions, retry with TCP
|
||||
run_cmd ${ns_a} ip route flush cached ${dst}
|
||||
run_cmd ${ns_b} ip route flush cached ${dst}
|
||||
run_cmd ${ns_c} ip route flush cached ${dst}
|
||||
|
||||
for target in "${ns_a}" "${ns_c}" ; do
|
||||
if [ ${family} -eq 4 ]; then
|
||||
TCPDST=TCP:${dst}:50000
|
||||
else
|
||||
TCPDST="TCP:[${dst}]:50000"
|
||||
fi
|
||||
${ns_b} socat -T 3 -u -6 TCP-LISTEN:50000 STDOUT > $tmpoutfile &
|
||||
|
||||
sleep 1
|
||||
|
||||
dd if=/dev/zero of=/dev/stdout status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3
|
||||
|
||||
size=$(du -sb $tmpoutfile)
|
||||
size=${size%%/tmp/*}
|
||||
|
||||
[ $size -ne 1048576 ] && err "File size $size mismatches exepcted value in locally bridged vxlan test" && return 1
|
||||
done
|
||||
|
||||
rm -f "$tmpoutfile"
|
||||
|
||||
# Check that exceptions were created
|
||||
pmtu="$(route_get_dst_pmtu_from_exception "${ns_c}" ${dst})"
|
||||
check_pmtu_value ${exp_mtu} "${pmtu}" "tcp: exceeding link layer MTU on bridged ${type} interface"
|
||||
pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})"
|
||||
check_pmtu_value ${exp_mtu} "${pmtu}" "tcp exceeding link layer MTU on locally bridged ${type} interface"
|
||||
}
|
||||
|
||||
test_pmtu_ipv4_br_vxlan4_exception() {
|
||||
|
|
Loading…
Add table
Reference in a new issue