summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2023-10-08 19:36:53 +0200
committerFlorian Westphal <fw@strlen.de>2023-10-12 10:28:45 +0200
commitd351c1ea2de3e36e608fc355d8ae7d0cc80e6cd6 (patch)
treef404d1a5d8f782c0cc555ffe1e25532f4fc0bcb3 /net
parent505ce0630ad5d31185695f8a29dde8d29f28faa7 (diff)
downloadlinux-stable-d351c1ea2de3e36e608fc355d8ae7d0cc80e6cd6.tar.gz
linux-stable-d351c1ea2de3e36e608fc355d8ae7d0cc80e6cd6.tar.bz2
linux-stable-d351c1ea2de3e36e608fc355d8ae7d0cc80e6cd6.zip
netfilter: nft_payload: fix wrong mac header matching
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: 96518518cc41 ("netfilter: add nftables") Reported-by: Blažej Krajňák <krajnak@levonet.sk> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nft_payload.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
index 120f6d395b98..0a689c8e0295 100644
--- a/net/netfilter/nft_payload.c
+++ b/net/netfilter/nft_payload.c
@@ -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) &&