diff mbox series

[net] ip_tunnel: don't force DF when MTU is locked

Message ID 218932a71a1f19b07dc6f92daaf9baed9e532cfe.1542382139.git.sd@queasysnail.net
State Accepted, archived
Delegated to: David Miller
Headers show
Series [net] ip_tunnel: don't force DF when MTU is locked | expand

Commit Message

Sabrina Dubroca Nov. 16, 2018, 3:58 p.m. UTC
The various types of tunnels running over IPv4 can ask to set the DF
bit to do PMTU discovery. However, PMTU discovery is subject to the
threshold set by the net.ipv4.route.min_pmtu sysctl, and is also
disabled on routes with "mtu lock". In those cases, we shouldn't set
the DF bit.

This patch makes setting the DF bit conditional on the route's MTU
locking state.

This issue seems to be older than git history.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
---
 net/ipv4/ip_tunnel_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Nov. 18, 2018, 5:51 a.m. UTC | #1
From: Sabrina Dubroca <sd@queasysnail.net>
Date: Fri, 16 Nov 2018 16:58:19 +0100

> The various types of tunnels running over IPv4 can ask to set the DF
> bit to do PMTU discovery. However, PMTU discovery is subject to the
> threshold set by the net.ipv4.route.min_pmtu sysctl, and is also
> disabled on routes with "mtu lock". In those cases, we shouldn't set
> the DF bit.
> 
> This patch makes setting the DF bit conditional on the route's MTU
> locking state.
> 
> This issue seems to be older than git history.
> 
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> Reviewed-by: Stefano Brivio <sbrivio@redhat.com>

Applied and queued up for -stable.
diff mbox series

Patch

diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index f45b96d715f0..c857ec6b9784 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -80,7 +80,7 @@  void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
 
 	iph->version	=	4;
 	iph->ihl	=	sizeof(struct iphdr) >> 2;
-	iph->frag_off	=	df;
+	iph->frag_off	=	ip_mtu_locked(&rt->dst) ? 0 : df;
 	iph->protocol	=	proto;
 	iph->tos	=	tos;
 	iph->daddr	=	dst;