Skip to content

nf_tables: nft_rule_dump_ctx fits into netlink_callback

Phil Sutter netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5netfilter: nf_tables: Always allocate nft_rule_dump_ctxnet/netfilter/nf_tables_api.c+21 -270 replies
2/5netfilter: nf_tables: Drop pointless memset when dumping rulesnet/netfilter/nf_tables_api.c+0 -40 replies
3/5netfilter: nf_tables: Carry reset flag in nft_rule_dump_ctxnet/netfilter/nf_tables_api.c+9 -100 replies
4/5netfilter: nf_tables: Carry s_idx in nft_rule_dump_ctxnet/netfilter/nf_tables_api.c+4 -40 replies
5/5netfilter: nf_tables: Don't allocate nft_rule_dump_ctxnet/netfilter/nf_tables_api.c+6 -130 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [nf-next PATCH 0/5] nf_tables: nft_rule_dump_ctx fits into netlink_callback

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(-)
Signature · 1 line
2.41.0