]> git.baikalelectronics.ru Git - kernel.git/commit
ip_gre: set tunnel hlen properly in erspan_tunnel_init
authorXin Long <lucien.xin@gmail.com>
Sun, 1 Oct 2017 14:00:55 +0000 (22:00 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 2 Oct 2017 05:30:32 +0000 (22:30 -0700)
commitaf39023a333413805864a9f0e560d89429442ec1
tree3cb94ac33a0d66a34ddeaf8ba7aba32a43788518
parent78f95724688403f56d7b30aab8efdcff7abd742c
ip_gre: set tunnel hlen properly in erspan_tunnel_init

According to __gre_tunnel_init, tunnel->hlen should be set as the
headers' length between inner packet and outer iphdr.

It would be used especially to calculate a proper mtu when updating
mtu in tnl_update_pmtu. Now without setting it, a bigger mtu value
than expected would be updated, which hurts performance a lot.

This patch is to fix it by setting tunnel->hlen with:
   tunnel->tun_hlen + tunnel->encap_hlen + sizeof(struct erspanhdr)

Fixes: 468dae257e70 ("gre: introduce native tunnel support for ERSPAN")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_gre.c