diff mbox

Set DF bit for IPv4 GRE tunnels with fixed TTL

Message ID 56634F31.3000609@shemyak.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Konstantin Shemyak Dec. 5, 2015, 8:55 p.m. UTC
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 <konstantin@shemyak.com>
---
  net/ipv4/ip_gre.c | 4 ++++
  1 file changed, 4 insertions(+)

Comments

Pravin B Shelar Dec. 5, 2015, 9:48 p.m. UTC | #1
On Sat, Dec 5, 2015 at 12:55 PM, Konstantin Shemyak
<konstantin@shemyak.com> wrote:
> 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 <konstantin@shemyak.com>
> ---
>  net/ipv4/ip_gre.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> index 6145214..485bf27 100644
> --- a/net/ipv4/ip_gre.c
> +++ b/net/ipv4/ip_gre.c
> @@ -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?


>         p.i_flags = gre_flags_to_tnl_flags(p.i_flags);
>         p.o_flags = gre_flags_to_tnl_flags(p.o_flags);
>
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Dec. 7, 2015, 3:37 a.m. UTC | #2
From: Konstantin Shemyak <konstantin@shemyak.com>
Date: Sat, 5 Dec 2015 22:55:13 +0200

> 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 <konstantin@shemyak.com>

Like Pravin said, ip_tunnel_ioctl() does this already, the code
you are adding is superfluous.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 6145214..485bf27 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -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);