Skip to content

Commit 5a25cf1

Browse files
strssndktnklassert
authored andcommitted
xfrm: revert ipv4 mtu determination to dst_mtu
In commit 0ea9d5e ("xfrm: introduce helper for safe determination of mtu") I switched the determination of ipv4 mtus from dst_mtu to ip_skb_dst_mtu. This was an error because in case of IP_PMTUDISC_PROBE we fall back to the interface mtu, which is never correct for ipv4 ipsec. This patch partly reverts 0ea9d5e ("xfrm: introduce helper for safe determination of mtu"). Cc: Steffen Klassert <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 844d487 commit 5a25cf1

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

include/net/xfrm.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <net/route.h>
2121
#include <net/ipv6.h>
2222
#include <net/ip6_fib.h>
23-
#include <net/ip6_route.h>
2423
#include <net/flow.h>
2524

2625
#include <linux/interrupt.h>
@@ -1724,15 +1723,4 @@ static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
17241723
return ret;
17251724
}
17261725

1727-
static inline int xfrm_skb_dst_mtu(struct sk_buff *skb)
1728-
{
1729-
struct sock *sk = skb->sk;
1730-
1731-
if (sk && skb->protocol == htons(ETH_P_IPV6))
1732-
return ip6_skb_dst_mtu(skb);
1733-
else if (sk && skb->protocol == htons(ETH_P_IP))
1734-
return ip_skb_dst_mtu(skb);
1735-
return dst_mtu(skb_dst(skb));
1736-
}
1737-
17381726
#endif /* _NET_XFRM_H */

net/ipv4/xfrm4_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static int xfrm4_tunnel_check_size(struct sk_buff *skb)
2828
if (!(ip_hdr(skb)->frag_off & htons(IP_DF)) || skb->local_df)
2929
goto out;
3030

31-
mtu = xfrm_skb_dst_mtu(skb);
31+
mtu = dst_mtu(skb_dst(skb));
3232
if (skb->len > mtu) {
3333
if (skb->sk)
3434
xfrm_local_error(skb, mtu);

net/ipv6/xfrm6_output.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,12 @@ static int __xfrm6_output(struct sk_buff *skb)
140140
{
141141
struct dst_entry *dst = skb_dst(skb);
142142
struct xfrm_state *x = dst->xfrm;
143-
int mtu = xfrm_skb_dst_mtu(skb);
143+
int mtu;
144144

145-
if (mtu < IPV6_MIN_MTU)
146-
mtu = IPV6_MIN_MTU;
145+
if (skb->protocol == htons(ETH_P_IPV6))
146+
mtu = ip6_skb_dst_mtu(skb);
147+
else
148+
mtu = dst_mtu(skb_dst(skb));
147149

148150
if (skb->len > mtu && xfrm6_local_dontfrag(skb)) {
149151
xfrm6_local_rxpmtu(skb, mtu);

0 commit comments

Comments
 (0)