From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
pabeni@redhat.com, edumazet@google.com
Subject: [PATCH net-next 3/8] netfilter: nft_payload: rebuild vlan header when needed
Date: Mon, 26 Jun 2023 08:47:44 +0200 [thread overview]
Message-ID: <20230626064749.75525-4-pablo@netfilter.org> (raw)
In-Reply-To: <20230626064749.75525-1-pablo@netfilter.org>
Skip rebuilding the vlan header when accessing destination and source
mac address.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nft_payload.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
index 3a3c7746e88f..8cb800989947 100644
--- a/net/netfilter/nft_payload.c
+++ b/net/netfilter/nft_payload.c
@@ -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;
--
2.30.2
next prev parent reply other threads:[~2023-06-26 6:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-26 6:47 [PATCH net-next 0/8] Netfilter/IPVS updates for net-next Pablo Neira Ayuso
2023-06-26 6:47 ` [PATCH net-next 1/8] ipvs: increase ip_vs_conn_tab_bits range for 64BIT Pablo Neira Ayuso
2023-06-26 20:10 ` patchwork-bot+netdevbpf
2023-06-26 6:47 ` [PATCH net-next 2/8] ipvs: dynamically limit the connection hash table Pablo Neira Ayuso
2023-06-26 6:47 ` Pablo Neira Ayuso [this message]
2023-06-26 6:47 ` [PATCH net-next 4/8] netfilter: ipset: remove rcu_read_lock_bh pair from ip_set_test Pablo Neira Ayuso
2023-06-26 6:47 ` [PATCH net-next 5/8] netfilter: nf_tables: permit update of set size Pablo Neira Ayuso
2023-06-26 6:47 ` [PATCH net-next 6/8] netfilter: snat: evict closing tcp entries on reply tuple collision Pablo Neira Ayuso
2023-06-26 6:47 ` [PATCH net-next 7/8] netfilter: nf_tables: Introduce NFT_MSG_GETSETELEM_RESET Pablo Neira Ayuso
2023-06-26 6:47 ` [PATCH net-next 8/8] netfilter: nf_tables: limit allowed range via nla_policy Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230626064749.75525-4-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).