]> git.baikalelectronics.ru Git - kernel.git/commit
vrf: add mac header for tunneled packets when sniffer is attached
authorAndrea Mayer <andrea.mayer@uniroma2.it>
Wed, 2 Dec 2020 13:05:10 +0000 (14:05 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 4 Dec 2020 21:30:50 +0000 (13:30 -0800)
commite8ad1a30028d3c3a9fdf7db7e3519f4e6de843f3
treef3c15ab5a6f961ef9b575e10856771ce26b27c23
parent3ddd220ee5591040f5ca463bcb2e10a692217b4b
vrf: add mac header for tunneled packets when sniffer is attached

Before this patch, a sniffer attached to a VRF used as the receiving
interface of L3 tunneled packets detects them as malformed packets and
it complains about that (i.e.: tcpdump shows bogus packets).

The reason is that a tunneled L3 packet does not carry any L2
information and when the VRF is set as the receiving interface of a
decapsulated L3 packet, no mac header is currently set or valid.
Therefore, the purpose of this patch consists of adding a MAC header to
any packet which is directly received on the VRF interface ONLY IF:

 i) a sniffer is attached on the VRF and ii) the mac header is not set.

In this case, the mac address of the VRF is copied in both the
destination and the source address of the ethernet header. The protocol
type is set either to IPv4 or IPv6, depending on which L3 packet is
received.

Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/vrf.c