xfrm: interface: fix ipv4 pmtu check to honor ip header df
Subsystems (3)
PATCH 1/1 xfrm: interface: fix ipv4 pmtu check to honor ip header df
Frag needed should only be sent if the header enables DF.
This fix allows packets larger than MTU to pass the xfrm interface and be fragmented after encapsulation, aligning behavior with non-interface xfrm.
--- net/xfrm/xfrm_interface.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/xfrm/xfrm_interface.c +7 -4
@@ -304,13 +304,16 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) mtu =IPV6_MIN_MTU ;icmpv6_ndo_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); - }else { + err = -EMSGSIZE ; + goto tx_err_dst_release; + } + +if (ip_hdr (skb)->frag_off &htons (IP_DF )) {icmp_ndo_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED ,htonl (mtu)); + err = -EMSGSIZE ; + goto tx_err_dst_release; } - -dst_release (dst); -return -EMSGSIZE ; }xfrmi_scrub_packet (skb, !net_eq (xi->net,dev_net (dev)));
Signature · 1 line
2.25.1
PATCH v2 1/1 xfrm: interface: fix ipv4 pmtu check to honor ip header df
Frag needed should only be sent if the header enables DF.
This fix allows packets larger than MTU to pass the xfrm interface and be fragmented after encapsulation, aligning behavior with non-interface xfrm.
-----
v2: better align coding with ip_vti
--- net/xfrm/xfrm_interface.c | 3 +++ 1 file changed, 3 insertions(+)
net/xfrm/xfrm_interface.c +3 -0
@@ -305,6 +305,8 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)icmpv6_ndo_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); }else { +if (!(ip_hdr (skb)->frag_off &htons (IP_DF ))) + goto xmit;icmp_ndo_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED ,htonl (mtu)); }
@@ -313,6 +315,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)return -EMSGSIZE ; } +xmit:xfrmi_scrub_packet (skb, !net_eq (xi->net,dev_net (dev)));skb_dst_set (skb, dst); skb->dev = tdev;
Signature · 1 line
2.25.1
Quoted 6 lines · Eyal Birger
Frag needed should only be sent if the header enables DF.
This fix allows packets larger than MTU to pass the xfrm interface and be fragmented after encapsulation, aligning behavior with non-interface xfrm.
Quoted 6 lines
Fixes f203b76d7809 ("xfrm: Add virtual xfrm interfaces")Signed-off-by Eyal Birger <[email protected]>-----
v2: better align coding with
ip_vti
LGTM. We also need to do the same thing in ip_vti and ip6_vti. Do you want to take care of it, or should I?
Either way, for this patch:
Signature · 1 line
Sabrina
Quoted 3 lines · Sabrina Dubroca
LGTM. We also need to do the same thing in
ip_vtiandip6_vti. Do you want to take care of it, or should I?
See the thread
https://lore.kernel.org/netdev/[email protected]/
(I'm assuming the patches no longer applies cleanly but given that I was ignored last time I will not be resubmitting them.)
--
Bram
Hi,
Quoted 11 lines · Sabrina Dubroca
Quoted 9 lines · Eyal Birger
Frag needed should only be sent if the header enables DF.
This fix allows packets larger than MTU to pass the xfrm interface and be fragmented after encapsulation, aligning behavior with non-interface xfrm.
Fixes f203b76d7809 ("xfrm: Add virtual xfrm interfaces")Signed-off-by Eyal Birger <[email protected]>
Quoted 6 lines
Quoted 3 lines
-----
v2: better align coding with
ip_vtiLGTM. We also need to do the same thing in
ip_vtiandip6_vti. Do you want to take care of it, or should I?
I can submit the same fix for vti{,6}.
Quoted 3 lines
Either way, for this patch:
Reviewed-by Sabrina Dubroca <[email protected]>
Thanks!
Eyal.
Quoted 12 lines · Sabrina Dubroca
Quoted 11 lines · Eyal Birger
Frag needed should only be sent if the header enables DF.
This fix allows packets larger than MTU to pass the xfrm interface and be fragmented after encapsulation, aligning behavior with non-interface xfrm.
Fixes f203b76d7809 ("xfrm: Add virtual xfrm interfaces")Signed-off-by Eyal Birger <[email protected]>-----
Quoted 7 lines
Quoted 1 line
v2: better align coding with
ip_vtiLGTM. We also need to do the same thing in
ip_vtiandip6_vti. Do you want to take care of it, or should I?Either way, for this patch:
Reviewed-by Sabrina Dubroca <[email protected]>
Applied, thanks everyone!