Skip to contentSkip to conversation

nft_payload: rebuild vlan header when needed

PATCH New Pablo Neira Ayuso 1 participant 1 message Jun 6, 2023

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 nft_payload: rebuild vlan header when needed

Skip rebuilding the vlan header when accessing destination and source mac address.

---
 net/netfilter/nft_payload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nft_payload.c +2 -1
index 14974dc820ea..0107d8e19313 100644
@@ -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;
Signature · 1 line
2.30.2