Skip to content

Commit

Permalink
netfilter: nft_payload: fix wrong mac header matching
Browse files Browse the repository at this point in the history
mcast packets get looped back to the local machine.
Such packets have a 0-length mac header, we should treat
this like "mac header not set" and abort rule evaluation.

As-is, we just copy data from the network header instead.

Fixes: 9651851 ("netfilter: add nftables")
Reported-by: Blažej Krajňák <krajnak@levonet.sk>
Signed-off-by: Florian Westphal <fw@strlen.de>
  • Loading branch information
Florian Westphal committed Oct 12, 2023
1 parent 505ce06 commit d351c1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netfilter/nft_payload.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void nft_payload_eval(const struct nft_expr *expr,

switch (priv->base) {
case NFT_PAYLOAD_LL_HEADER:
if (!skb_mac_header_was_set(skb))
if (!skb_mac_header_was_set(skb) || skb_mac_header_len(skb) == 0)
goto err;

if (skb_vlan_tag_present(skb) &&
Expand Down

0 comments on commit d351c1e

Please sign in to comment.