]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
gre: let mac_header point to outer header only when necessary
authorGuillaume Nault <gnault@redhat.com>
Fri, 25 Jun 2021 13:33:13 +0000 (15:33 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jun 2021 19:44:17 +0000 (12:44 -0700)
commitaab1e898c26c3e4289c62b6d6482948672fab939
tree85943a4efc11e6f1216ac9662e5cafd089dae608
parent730eed2772e740c30229d03e3d578cc00a5ae304
gre: let mac_header point to outer header only when necessary

Commit e271c7b4420d ("gre: do not keep the GRE header around in collect
medata mode") did reset the mac_header for the collect_md case. Let's
extend this behaviour to classical gre devices as well.

ipgre_header_parse() seems to be the only case that requires mac_header
to point to the outer header. We can detect this case accurately by
checking ->header_ops. For all other cases, we can reset mac_header.

This allows to push an Ethernet header to ipgre packets and redirect
them to an Ethernet device:

  $ tc filter add dev gre0 ingress matchall          \
      action vlan push_eth dst_mac 00:00:5e:00:53:01 \
                           src_mac 00:00:5e:00:53:00 \
      action mirred egress redirect dev eth0

Before this patch, this worked only for collect_md gre devices.
Now this works for regular gre devices as well. Only the special case
of gre devices that use ipgre_header_ops isn't supported.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_gre.c