diff options
author | Martin Willi <martin@strongswan.org> | 2021-04-19 16:15:59 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2021-04-22 23:18:02 +0200 |
commit | 22b6034323fd736f260e00b9ea85c634abeb3446 (patch) | |
tree | ffde46e4c1596f6588240f869ec84d2335b6039d /net/xdp | |
parent | d044d9fc1380b66917dcb418ef4ec7e59dd6e597 (diff) |
net, xdp: Update pkt_type if generic XDP changes unicast MAC
If a generic XDP program changes the destination MAC address from/to
multicast/broadcast, the skb->pkt_type is updated to properly handle
the packet when passed up the stack. When changing the MAC from/to
the NICs MAC, PACKET_HOST/OTHERHOST is not updated, though, making
the behavior different from that of native XDP.
Remember the PACKET_HOST/OTHERHOST state before calling the program
in generic XDP, and update pkt_type accordingly if the destination
MAC address has changed. As eth_type_trans() assumes a default
pkt_type of PACKET_HOST, restore that before calling it.
The use case for this is when a XDP program wants to push received
packets up the stack by rewriting the MAC to the NICs MAC, for
example by cluster nodes sharing MAC addresses.
Fixes: 297249569932 ("net: fix generic XDP to handle if eth header was mangled")
Signed-off-by: Martin Willi <martin@strongswan.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/20210419141559.8611-1-martin@strongswan.org
Diffstat (limited to 'net/xdp')
0 files changed, 0 insertions, 0 deletions