From: Pablo Neira Ayuso <pablo@netfilter.org>
To: wenxu@ucloud.cn
Cc: fw@strlen.de, netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next] netfilter: bridge: add nft_bridge_pvid to tag the default pvid for non-tagged packet
Date: Tue, 18 Jun 2019 18:40:07 +0200 [thread overview]
Message-ID: <20190618164007.suuaa5zx2b242ey7@salvia> (raw)
In-Reply-To: <1560600861-8848-1-git-send-email-wenxu@ucloud.cn>
On Sat, Jun 15, 2019 at 08:14:21PM +0800, wenxu@ucloud.cn wrote:
[...]
> +static void nft_bridge_pvid_eval(const struct nft_expr *expr,
> + struct nft_regs *regs,
> + const struct nft_pktinfo *pkt)
> +{
> + struct sk_buff *skb = pkt->skb;
> + struct net_bridge_port *p;
> +
> + p = br_port_get_rtnl_rcu(skb->dev);
> +
> + if (p && br_opt_get(p->br, BROPT_VLAN_ENABLED) &&
> + !skb_vlan_tag_present(skb)) {
> + u16 pvid = br_get_pvid(nbp_vlan_group_rcu(p));
> +
> + if (pvid)
> + __vlan_hwaccel_put_tag(skb, p->br->vlan_proto, pvid);
I see two things here:
#1 Extend new NFT_META_BRIDGE_PVID nft_meta to fetch of 'pvid',
probably add net/bridge/netfilter/nft_meta_bridge.c for this.
#2 Extend nft_meta to allow to set the vlan tag via
__vlan_hwaccel_put_tag().
If these two changes are in place, then it should be possible to set
skbuff vlan id based on the pvid, if this is what you need.
This would allow for:
vlan id set bridge pvid
next prev parent reply other threads:[~2019-06-18 16:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-15 12:14 [PATCH net-next] netfilter: bridge: add nft_bridge_pvid to tag the default pvid for non-tagged packet wenxu
2019-06-18 16:40 ` Pablo Neira Ayuso [this message]
2019-06-19 3:47 ` wenxu
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=20190618164007.suuaa5zx2b242ey7@salvia \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=wenxu@ucloud.cn \
/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