The ip_gre_calc_hlen() already counts gre's base header len (4-byte)
plus optional header's len, so tunnel->hlen has the entire gre
headeri + options len. Thus, remove the -4 and +4 when calculating
the needed_headroom and mtu.

Fixes: 4565e9919cda ("gre: Setup and TX path for gre/UDP foo-over-udp 
encapsulation")
Signed-off-by: William Tu <u9012...@gmail.com>
Cc: Tom Herbert <t...@quantonium.net>
---
 net/ipv4/ip_gre.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index c105a315b1a3..286065c35959 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -947,8 +947,8 @@ static void __gre_tunnel_init(struct net_device *dev)
 
        t_hlen = tunnel->hlen + sizeof(struct iphdr);
 
-       dev->needed_headroom    = LL_MAX_HEADER + t_hlen + 4;
-       dev->mtu                = ETH_DATA_LEN - t_hlen - 4;
+       dev->needed_headroom    = LL_MAX_HEADER + t_hlen;
+       dev->mtu                = ETH_DATA_LEN - t_hlen;
 
        dev->features           |= GRE_FEATURES;
        dev->hw_features        |= GRE_FEATURES;
-- 
2.7.4

Reply via email to