Skip to content
Commit 13bcc6f8 authored by Eyal Birger's avatar Eyal Birger Committed by Greg Kroah-Hartman
Browse files

vrf: fix packet sniffing for traffic originating from ip tunnels

[ Upstream commit 012d69fb ]

in commit 04893908
("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: 04893908

 ("vrf: add mac header for tunneled packets when sniffer is attached")
Signed-off-by: default avatarEyal Birger <eyal.birger@gmail.com>
Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6e2f1b03
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment