From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: Quan Tian <tianquan23@gmail.com>,
netfilter-devel@vger.kernel.org, kadlec@netfilter.org
Subject: Re: [PATCH v3 nf-next 2/2] netfilter: nf_tables: support updating userdata for nft_table
Date: Tue, 12 Mar 2024 13:49:27 +0100 [thread overview]
Message-ID: <ZfBO8JSzsdeDpLrR@calendula> (raw)
In-Reply-To: <20240312122758.GB2899@breakpoint.cc>
On Tue, Mar 12, 2024 at 01:27:58PM +0100, Florian Westphal wrote:
> Quan Tian <tianquan23@gmail.com> wrote:
> > The NFTA_TABLE_USERDATA attribute was ignored on updates. The patch adds
> > handling for it to support table comment updates.
>
> One generic API question below. Pablo, please look at this too.
>
> > case NFT_MSG_NEWTABLE:
> > if (nft_trans_table_update(trans)) {
> > - if (!(trans->ctx.table->flags & __NFT_TABLE_F_UPDATE)) {
> > - nft_trans_destroy(trans);
> > - break;
> > + if (trans->ctx.table->flags & __NFT_TABLE_F_UPDATE) {
> > + if (trans->ctx.table->flags & NFT_TABLE_F_DORMANT)
> > + nf_tables_table_disable(net, trans->ctx.table);
> > + trans->ctx.table->flags &= ~__NFT_TABLE_F_UPDATE;
> > }
> > - if (trans->ctx.table->flags & NFT_TABLE_F_DORMANT)
> > - nf_tables_table_disable(net, trans->ctx.table);
> > -
> > - trans->ctx.table->flags &= ~__NFT_TABLE_F_UPDATE;
> > + swap(trans->ctx.table->udata, nft_trans_table_udata(trans));
> > + nf_tables_table_notify(&trans->ctx, NFT_MSG_NEWTABLE
>
> AFAICS this means that if the table as udata attached, and userspace
> makes an update request without a UDATA netlink attribute, we will
> delete the existing udata.
>
> Is that right?
>
> My question is, should we instead leave the existing udata as-is and not
> support removal, only replace?
I would leave it in place too if no _USERDATA is specified.
One more question is if the memcmp() with old and new udata makes
sense considering two consecutive requests for _USERDATA update in one
batch.
next prev parent reply other threads:[~2024-03-12 12:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-11 14:14 [PATCH v3 nf-next 1/2] netfilter: nf_tables: use struct nlattr * to store userdata for nft_table Quan Tian
2024-03-11 14:14 ` [PATCH v3 nf-next 2/2] netfilter: nf_tables: support updating " Quan Tian
2024-03-12 12:27 ` Florian Westphal
2024-03-12 12:49 ` Pablo Neira Ayuso [this message]
2024-03-12 13:01 ` Florian Westphal
2024-03-12 14:26 ` Quan Tian
2024-03-12 14:33 ` Florian Westphal
2024-03-12 22:23 ` Pablo Neira Ayuso
2024-03-13 1:35 ` Quan Tian
2024-03-13 9:40 ` Pablo Neira Ayuso
2024-03-13 17:08 ` Quan Tian
2024-03-12 14:36 ` Pablo Neira Ayuso
2024-03-12 13:49 ` Pablo Neira Ayuso
2024-03-12 14:02 ` Florian Westphal
2024-03-12 14:10 ` Florian Westphal
2024-03-12 14:30 ` Quan Tian
2024-03-12 14:05 ` [PATCH v3 nf-next 1/2] netfilter: nf_tables: use struct nlattr * to store " Florian Westphal
2024-03-12 14:17 ` Pablo Neira Ayuso
2024-03-12 14:34 ` Florian Westphal
2024-03-12 15:03 ` Quan Tian
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=ZfBO8JSzsdeDpLrR@calendula \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=tianquan23@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.