Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

gre: do not keep the GRE header around in collect medata mode

For ipgre interface in collect metadata mode, it doesn't make sense for the
interface to be of ARPHRD_IPGRE type. The outer header of received packets
is not needed, as all the information from it is present in metadata_dst. We
already don't set ipgre_header_ops for collect metadata interfaces, which is
the only consumer of mac_header pointing to the outer IP header.

Just set the interface type to ARPHRD_NONE in collect metadata mode for
ipgre (not gretap, that still correctly stays ARPHRD_ETHER) and reset
mac_header.

Fixes: a64b04d86d14 ("gre: do not assign header_ops in collect metadata mode")
Fixes: 2e15ea390e6f4 ("ip_gre: Add support to collect tunnel metadata.")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jiri Benc and committed by
David S. Miller
e271c7b4 16ec3d4f

+6 -1
+6 -1
net/ipv4/ip_gre.c
··· 398 398 iph->saddr, iph->daddr, tpi->key); 399 399 400 400 if (tunnel) { 401 - skb_pop_mac_header(skb); 401 + if (tunnel->dev->type != ARPHRD_NONE) 402 + skb_pop_mac_header(skb); 403 + else 404 + skb_reset_mac_header(skb); 402 405 if (tunnel->collect_md) { 403 406 __be16 flags; 404 407 __be64 tun_id; ··· 1034 1031 struct ip_tunnel *t = netdev_priv(dev); 1035 1032 1036 1033 t->collect_md = true; 1034 + if (dev->type == ARPHRD_IPGRE) 1035 + dev->type = ARPHRD_NONE; 1037 1036 } 1038 1037 } 1039 1038