Set DF bit for IPv4 GRE tunnels with fixed TTL
Subsystems (3)
PATCH 1/1 Set DF bit for IPv4 GRE tunnels with fixed TTL
The DF bit on IPv4 GRE tunnels with fixed TTL is enforced in order to prevent networking loops. This was the original behavior of GRE tunnels, lost in the refactoring.
--- net/ipv4/ip_gre.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv4/ip_gre.c +4 -0
@@ -679,6 +679,10 @@ static int ipgre_tunnel_ioctl(struct net_device *dev, ((p.i_flags|p.o_flags)&(GRE_VERSION|GRE_ROUTING))) return -EINVAL; } + +if (p.iph.ttl) + p.iph.frag_off |=htons (IP_DF ); + p.i_flags =gre_flags_to_tnl_flags (p.i_flags); p.o_flags =gre_flags_to_tnl_flags (p.o_flags);
Signature · 1 line
1.9.1
Quoted 14 lines · Konstantin Shemyak
The DF bit on IPv4 GRE tunnels with fixed TTL is enforced in order to prevent networking loops. This was the original behavior of GRE tunnels, lost in the refactoring.
Signed-off-by Konstantin Shemyak <[email protected]>--- net/ipv4/ip_gre.c | 4 ++++ 1 file changed, 4 insertions(+)net/ipv4/ip_gre.c +0
-0
net/ipv4/ip_gre.c static int ipgre_tunnel_ioctl(struct net_device *dev, · line 685
Quoted 7 lines
net/ipv4/ip_gre.c +4
-0@@ -679,6 +679,10 @@ static int ipgre_tunnel_ioctl(struct net_device *dev, ((p.i_flags|p.o_flags)&(GRE_VERSION|GRE_ROUTING)))return -EINVAL ; } + +if (p.iph.ttl) + p.iph.frag_off |=htons (IP_DF ); +
Same code already exist in ip_tunnel_ioctl() which is common function for IP based tunnel modules. Why does that not work?
Quoted 6 lines
net/ipv4/ip_gre.c +0
-1p.i_flags =gre_flags_to_tnl_flags (p.i_flags); p.o_flags =gre_flags_to_tnl_flags (p.o_flags); --1.9.1
David Miller
maintainerFrom: Konstantin Shemyak <[email protected]>
Date: Sat, 5 Dec 2015 22:55:13 +0200
Quoted 5 lines
The DF bit on IPv4 GRE tunnels with fixed TTL is enforced in order to prevent networking loops. This was the original behavior of GRE tunnels, lost in the refactoring.
Signed-off-by Konstantin Shemyak <[email protected]>
Like Pravin said, ip_tunnel_ioctl() does this already, the code you are adding is superfluous.