]> git.baikalelectronics.ru Git - kernel.git/commit
vrf: fix packet sniffing for traffic originating from ip tunnels
authorEyal Birger <eyal.birger@gmail.com>
Thu, 31 Mar 2022 07:26:43 +0000 (10:26 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Apr 2022 10:56:55 +0000 (11:56 +0100)
commit630d8429d2d217580d70154c7541403da5c61ed4
tree46329b113ede4355b1fa5169135e44c2f6146059
parenteb995b3d2422e48b67517282f8f06bf8527fd19c
vrf: fix packet sniffing for traffic originating from ip tunnels

in commit e8ad1a30028d
("vrf: add mac header for tunneled packets when sniffer is attached")
an Ethernet header was cooked for traffic originating from tunnel devices.

However, the header is added based on whether the mac_header is unset
and ignores cases where the device doesn't expose a mac header to upper
layers, such as in ip tunnels like ipip and gre.

Traffic originating from such devices still appears garbled when capturing
on the vrf device.

Fix by observing whether the original device exposes a header to upper
layers, similar to the logic done in af_packet.

In addition, skb->mac_len needs to be adjusted after adding the Ethernet
header for the skb_push/pull() surrounding dev_queue_xmit_nit() to work
on these packets.

Fixes: e8ad1a30028d ("vrf: add mac header for tunneled packets when sniffer is attached")
Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/vrf.c