diff mbox series

[ipsec] xfrm: interface: fix ipv4 pmtu check to honor ip header df

Message ID 20210219172127.2223831-1-eyal.birger@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [ipsec] xfrm: interface: fix ipv4 pmtu check to honor ip header df | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers fail 3 blamed authors not CCed: lorenzo@google.com shannon.nelson@oracle.com benedictwong@google.com; 3 maintainers not CCed: lorenzo@google.com shannon.nelson@oracle.com benedictwong@google.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Eyal Birger Feb. 19, 2021, 5:21 p.m. UTC
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 <eyal.birger@gmail.com>
---
 net/xfrm/xfrm_interface.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
index 697cdcfbb5e1..257b3c8b3995 100644
--- a/net/xfrm/xfrm_interface.c
+++ b/net/xfrm/xfrm_interface.c
@@ -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)));