Skip to content

Commit

Permalink
netfilter: nft_payload: rebuild vlan header when needed
Browse files Browse the repository at this point in the history
Skip rebuilding the vlan header when accessing destination and source
mac address.

Signed-off-by: Pablo Neira Ayuso <[email protected]>
  • Loading branch information
ummakynes committed Jun 26, 2023
1 parent 4f325e2 commit de6843b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/netfilter/nft_payload.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ void nft_payload_eval(const struct nft_expr *expr,
if (!skb_mac_header_was_set(skb))
goto err;

if (skb_vlan_tag_present(skb)) {
if (skb_vlan_tag_present(skb) &&
priv->offset >= offsetof(struct ethhdr, h_proto)) {
if (!nft_payload_copy_vlan(dest, skb,
priv->offset, priv->len))
goto err;
Expand Down

0 comments on commit de6843b

Please sign in to comment.