netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nf-next PATCH 0/5] nf_tables: nft_rule_dump_ctx fits into netlink_callback
@ 2023-09-29 19:19 Phil Sutter
  2023-09-29 19:19 ` [nf-next PATCH 1/5] netfilter: nf_tables: Always allocate nft_rule_dump_ctx Phil Sutter
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Phil Sutter @ 2023-09-29 19:19 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Florian Westphal, netfilter-devel

Struct netlink_callback has a 48byte scratch area for use by dump
callbacks to keep personal stuff.

In rule dumps set up by nf_tables_getrule(), this is used only to store
a cursor into the list of rules being dumped. Other data is allocated
and the pointer value assigned to struct netlink_callback::data.

Since the allocated data structure is small and fits into the scratch
area even after adding some more fields, move it there.

Patch 1 "simplifies" nf_tables_dump_rules_start() a bit, but actually
exists only to reduce patch 5's size.

Patch 2 is more or less fallout: The memset would mess things up after
this series, but it was pointless in the first place.

Patches 3 and 4 extend struct nft_rule_dump_ctx and make
struct netlink_callback's scratch area unused.

Patch 5 then finally eliminates the allocation.

All this is early preparation for reset command locking but unrelated
enough to go alone.

Phil Sutter (5):
  netfilter: nf_tables: Always allocate nft_rule_dump_ctx
  netfilter: nf_tables: Drop pointless memset when dumping rules
  netfilter: nf_tables: Carry reset flag in nft_rule_dump_ctx
  netfilter: nf_tables: Carry s_idx in nft_rule_dump_ctx
  netfilter: nf_tables: Don't allocate nft_rule_dump_ctx

 net/netfilter/nf_tables_api.c | 80 ++++++++++++++---------------------
 1 file changed, 31 insertions(+), 49 deletions(-)

-- 
2.41.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-05 16:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-29 19:19 [nf-next PATCH 0/5] nf_tables: nft_rule_dump_ctx fits into netlink_callback Phil Sutter
2023-09-29 19:19 ` [nf-next PATCH 1/5] netfilter: nf_tables: Always allocate nft_rule_dump_ctx Phil Sutter
2023-09-29 19:19 ` [nf-next PATCH 2/5] netfilter: nf_tables: Drop pointless memset when dumping rules Phil Sutter
2023-09-29 19:19 ` [nf-next PATCH 3/5] netfilter: nf_tables: Carry reset flag in nft_rule_dump_ctx Phil Sutter
2023-09-29 19:19 ` [nf-next PATCH 4/5] netfilter: nf_tables: Carry s_idx " Phil Sutter
2023-09-29 19:19 ` [nf-next PATCH 5/5] netfilter: nf_tables: Don't allocate nft_rule_dump_ctx Phil Sutter
2023-10-05  8:02 ` [nf-next PATCH 0/5] nf_tables: nft_rule_dump_ctx fits into netlink_callback Florian Westphal

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).