Skip to content

Commit e271c7b

Browse files
Jiri Bencdavem330
authored andcommitted
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: a64b04d ("gre: do not assign header_ops in collect metadata mode") Fixes: 2e15ea3 ("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>
1 parent 16ec3d4 commit e271c7b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

net/ipv4/ip_gre.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,10 @@ static int ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi)
398398
iph->saddr, iph->daddr, tpi->key);
399399

400400
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);
402405
if (tunnel->collect_md) {
403406
__be16 flags;
404407
__be64 tun_id;
@@ -1031,6 +1034,8 @@ static void ipgre_netlink_parms(struct net_device *dev,
10311034
struct ip_tunnel *t = netdev_priv(dev);
10321035

10331036
t->collect_md = true;
1037+
if (dev->type == ARPHRD_IPGRE)
1038+
dev->type = ARPHRD_NONE;
10341039
}
10351040
}
10361041

0 commit comments

Comments
 (0)