vti(6): fix ipv4 pmtu check to honor ip header df
Subsystems (4)
cover vti(6): fix ipv4 pmtu check to honor ip header df
This series aligns vti(6) handling of non-df IPv4 packets exceeding the size of the tunnel MTU to avoid sending "Frag needed" and instead fragment the packets after encapsulation.
Eyal Birger (2):
vti: fix ipv4 pmtu check to honor ip header df
vti6: fix ipv4 pmtu check to honor ip header df
net/ipv4/ip_vti.c | 6 ++++-- net/ipv6/ip6_vti.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/2 vti: 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 vti interface and be fragmented after encapsulation, aligning behavior with non-vti xfrm.
--- net/ipv4/ip_vti.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ipv4/ip_vti.c +4 -2
@@ -218,7 +218,7 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev, }if (dst->flags &DST_XFRM_QUEUE ) - goto queued; + goto xmit;if (!vti_state_check (dst->xfrm, parms->iph.daddr, parms->iph.saddr)) { dev->stats.tx_carrier_errors++;
@@ -238,6 +238,8 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev,if (skb->len > mtu) {skb_dst_update_pmtu_no_confirm (skb, mtu);if (skb->protocol ==htons (ETH_P_IP )) { +if (!(ip_hdr (skb)->frag_off &htons (IP_DF ))) + goto xmit;icmp_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED ,htonl (mtu)); }else {
@@ -251,7 +253,7 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev, goto tx_error; } -queued: +xmit:skb_scrub_packet (skb, !net_eq (tunnel->net,dev_net (dev)));skb_dst_set (skb, dst); skb->dev =skb_dst (skb)->dev;
Signature · 1 line
2.25.1
PATCH 2/2 vti6: fix ipv4 pmtu check to honor ip header df
In reply to Eyal BirgerFrag needed should only be sent if the header enables DF.
This fix allows IPv4 packets larger than MTU to pass the vti6 interface and be fragmented after encapsulation, aligning behavior with non-vti6 xfrm.
--- net/ipv6/ip6_vti.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ipv6/ip6_vti.c +4 -2
@@ -494,7 +494,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) }if (dst->flags &DST_XFRM_QUEUE ) - goto queued; + goto xmit; x = dst->xfrm;if (!vti6_state_check (x, &t->parms.raddr, &t->parms.laddr))
@@ -523,6 +523,8 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)icmpv6_send (skb,ICMPV6_PKT_TOOBIG ,0 , mtu); }else { +if (!(ip_hdr (skb)->frag_off &htons (IP_DF ))) + goto xmit;icmp_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED ,htonl (mtu)); }
@@ -531,7 +533,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) goto tx_err_dst_release; } -queued: +xmit:skb_scrub_packet (skb, !net_eq (t->net,dev_net (dev)));skb_dst_set (skb, dst); skb->dev =skb_dst (skb)->dev;
Signature · 1 line
2.25.1
Quoted 7 lines · Eyal Birger
This series aligns vti(6) handling of non-df IPv4 packets exceeding the size of the tunnel MTU to avoid sending "Frag needed" and instead fragment the packets after encapsulation.
Eyal Birger (2):
vti: fix ipv4 pmtu check to honor ip header df
vti6: fix ipv4 pmtu check to honor ip header df
Thanks Eyal.
Steffen, that's going to conflict with commit 4372339efc06 ("net:
always use icmp{,v6}_ndo_send from ndo_start_xmit") from net.
Signature · 1 line
Sabrina
Quoted 9 lines · Sabrina Dubroca
Quoted 7 lines · Eyal Birger
This series aligns vti(6) handling of non-df IPv4 packets exceeding the size of the tunnel MTU to avoid sending "Frag needed" and instead fragment the packets after encapsulation.
Eyal Birger (2):
vti: fix ipv4 pmtu check to honor ip header df
vti6: fix ipv4 pmtu check to honor ip header df
Quoted 5 lines
Thanks Eyal.
Reviewed-by Sabrina Dubroca <[email protected]>Steffen, that's going to conflict with commit
4372339efc06("net:
always use icmp{,v6}_ndo_send fromndo_start_xmit") from net.
Applied, thanks everyone!