Commit 5a25cf1e310888eb333f9e034be84a8117111d30
Committed by
Steffen Klassert
1 parent
844d48746e
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
xfrm: revert ipv4 mtu determination to dst_mtu
In commit 0ea9d5e3e0e03a63b11392f5613378977dae7eca ("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 0ea9d5e3e0e03a63b11392f5613378977dae7eca ("xfrm: introduce helper for safe determination of mtu"). Cc: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Showing 3 changed files with 6 additions and 16 deletions Side-by-side Diff
include/net/xfrm.h
... | ... | @@ -20,7 +20,6 @@ |
20 | 20 | #include <net/route.h> |
21 | 21 | #include <net/ipv6.h> |
22 | 22 | #include <net/ip6_fib.h> |
23 | -#include <net/ip6_route.h> | |
24 | 23 | #include <net/flow.h> |
25 | 24 | |
26 | 25 | #include <linux/interrupt.h> |
... | ... | @@ -1722,17 +1721,6 @@ |
1722 | 1721 | if (m->m | m->v) |
1723 | 1722 | ret = nla_put(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m); |
1724 | 1723 | return ret; |
1725 | -} | |
1726 | - | |
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 | 1724 | } |
1737 | 1725 | |
1738 | 1726 | #endif /* _NET_XFRM_H */ |
net/ipv4/xfrm4_output.c
net/ipv6/xfrm6_output.c
... | ... | @@ -140,10 +140,12 @@ |
140 | 140 | { |
141 | 141 | struct dst_entry *dst = skb_dst(skb); |
142 | 142 | struct xfrm_state *x = dst->xfrm; |
143 | - int mtu = xfrm_skb_dst_mtu(skb); | |
143 | + int mtu; | |
144 | 144 | |
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)); | |
147 | 149 | |
148 | 150 | if (skb->len > mtu && xfrm6_local_dontfrag(skb)) { |
149 | 151 | xfrm6_local_rxpmtu(skb, mtu); |