]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netfilter: nft_payload: skbuff vlan metadata mangle support
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 8 May 2024 20:50:34 +0000 (22:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:39:51 +0000 (13:39 +0200)
commit47ef50eb0443590d1c14b6cae0ccd0ff3d8f3a41
tree0a423eed2dcfb83300b66db7fc21d71ae2d61fcd
parent83129237392128be45575e71de7aa3c4f951d30e
netfilter: nft_payload: skbuff vlan metadata mangle support

[ Upstream commit 33c563ebf8d3deed7d8addd20d77398ac737ef9a ]

Userspace assumes vlan header is present at a given offset, but vlan
offload allows to store this in metadata fields of the skbuff. Hence
mangling vlan results in a garbled packet. Handle this transparently by
adding a parser to the kernel.

If vlan metadata is present and payload offset is over 12 bytes (source
and destination mac address fields), then subtract vlan header present
in vlan metadata, otherwise mangle vlan metadata based on offset and
length, extracting data from the source register.

This is similar to:

  8cfd23e67401 ("netfilter: nft_payload: work around vlan header stripping")

to deal with vlan payload mangling.

Fixes: 7ec3f7b47b8d ("netfilter: nft_payload: add packet mangling support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/nft_payload.c