Skip to content

iptables: introduce cache evaluation phase

Phil Sutter netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest18 patches 11 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18ebtables-restore: Drop custom table flush routineiptables/nft.c iptables/nft.h iptables/xtables-restore.c+1 -301 reply
2/18nft: cache: Eliminate init_chain_cache()iptables/nft-cache.c+4 -121 reply
3/18nft: cache: Init per table set list along with chain listiptables/nft-cache.c+4 -151 reply
4/18nft: cache: Fetch sets per tableiptables/nft-cache.c+15 -111 reply
5/18ebtables-restore: Table line to trigger implicit commitiptables/xtables-restore.c+4 -00 replies
6/18nft: split parsing from netlink commandsiptables/Makefile.am iptables/nft-arp.c iptables/nft-bridge.c +12 more+715 -1430 replies
7/18nft: calculate cache requirements from list of commandsiptables/nft-cache.c iptables/nft-cache.h iptables/nft-cmd.c +5 more+119 -1270 replies
8/18nft: restore among supportiptables/nft-bridge.c iptables/nft.c iptables/nft.h+32 -20 replies
9/18nft: remove cache build callsiptables/nft-cache.c iptables/nft-cache.h iptables/nft.c+0 -420 replies
10/18nft: missing nft_fini() call in bridge familyiptables/xtables-eb-standalone.c+2 -00 replies
11/18nft: cache: Simplify rule and set fetchersiptables/nft-cache.c+5 -150 replies
12/18nft: cache: Improve fake cache integrationiptables/nft-cache.c iptables/nft-cache.h iptables/xtables-restore.c+4 -150 replies
13/18nft: cache: Introduce struct nft_cache_reqiptables/nft-cache.c iptables/nft.h+22 -160 replies
14/18nft-cache: Fetch cache per tableiptables/nft-cache.c iptables/nft-cache.h iptables/nft-cmd.c +3 more+56 -430 replies
15/18nft-cache: Introduce __fetch_chain_cache()iptables/nft-cache.c+30 -200 replies
16/18nft: cache: Fetch cache for specific chainsiptables/nft-cache.c iptables/nft.c iptables/nft.h+82 -80 replies
17/18nft: cache: Optimize caching for flush commandiptables/nft-cmd.c iptables/nft.c iptables/tests/shell/testcases/nft-only/0006-policy-override_0+39 -10 replies
18/18nft: Fix for '-F' in iptables dumpsiptables/nft.c+34 -00 replies

Reviews trailers per patch

4 of 18 patches have a Reviewed-by or Acked-by.

PatchFlorian Westphal
1/18A-b
2/18A-b
3/18A-b
4/18A-b
5/18
6/18
7/18
8/18
9/18
10/18
11/18
12/18
13/18
14/18
15/18
16/18
17/18
18/18

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [iptables PATCH v2 00/18] iptables: introduce cache evaluation phase

Hi Pablo,

As promised, here's a revised version of your cache rework series from January. It restores performance according to my tests (which are yet to be published somewhere) and passes the testsuites.

Patches 1-3 are code simplifications which are not directly related to the actual caching changes.

Patch 4 enhances set fetching by adding support for passing a table name to kernel but no set name. Not a big deal for iptables but it aligns the code with chain fetching.

Patch 5 is a respin of a patch submitted a few weeks ago, namely adding implicit commits to arptables- and ebtables-restore tools which don't support explicit COMMIT lines in input. Big benefit here is that we won't see consecutive commands for different tables anymore, so selective cache fetching doesn't have to deal with too many odd cases.

Patches 6-10 are yours, I rebased and revisited them. Any changes are recorded in per-patch changelogs.

Patch 11 simplifies fetch_set_cache() and fetch_rule_cache() functions as they no longer have to be aware of previous invocations.

Patch 12 improves NFT_CL_FAKE integration considerably, easily possible now that there is nft_cache_level_set() function.

Patch 13 introduces an embedded struct into struct nft_handle which holds cache requirements collected from parsed commands. At first there is just the desired cache level, further patches extend it.

Patches 14-16 re-establish per table/chain cache.

Patch 17 reduces cache requirements for flush command by making nft_xt_builtin_init() cache-aware.

Patch 18 fixes the segfault reported in nfbz#1407.

Pablo Neira Ayuso (5):
nft: split parsing from netlink commands
nft: calculate cache requirements from list of commands
nft: restore among support
nft: remove cache build calls
nft: missing nft_fini() call in bridge family

Phil Sutter (13):
ebtables-restore: Drop custom table flush routine
nft: cache: Eliminate init_chain_cache()
nft: cache: Init per table set list along with chain list
nft: cache: Fetch sets per table
ebtables-restore: Table line to trigger implicit commit
nft: cache: Simplify rule and set fetchers
nft: cache: Improve fake cache integration
nft: cache: Introduce struct nft_cache_req
nft-cache: Fetch cache per table
nft-cache: Introduce __fetch_chain_cache()
nft: cache: Fetch cache for specific chains
nft: cache: Optimize caching for flush command
nft: Fix for '-F' in iptables dumps

 iptables/Makefile.am                          |   2 +-
 iptables/nft-arp.c                            |   5 +-
 iptables/nft-bridge.c                         |  18 +-
 iptables/nft-cache.c                          | 318 +++++++-------
 iptables/nft-cache.h                          |   6 +-
 iptables/nft-cmd.c                            | 387 ++++++++++++++++++
 iptables/nft-cmd.h                            |  79 ++++
 iptables/nft-shared.c                         |   6 +-
 iptables/nft-shared.h                         |   4 +-
 iptables/nft.c                                | 369 ++++++++++++-----
 iptables/nft.h                                |  62 ++-
 .../testcases/ip6tables/0004-return-codes_0   |   1 +
 .../testcases/iptables/0004-return-codes_0    |   6 +
 .../testcases/nft-only/0006-policy-override_0 |  29 ++
 iptables/xtables-arp.c                        |  26 +-
 iptables/xtables-eb-standalone.c              |   2 +
 iptables/xtables-eb.c                         |  26 +-
 iptables/xtables-restore.c                    | 126 +-----
 iptables/xtables-save.c                       |   3 +
 iptables/xtables.c                            |  57 ++-
 20 files changed, 1100 insertions(+), 432 deletions(-)
 create mode 100644 iptables/nft-cmd.c
 create mode 100644 iptables/nft-cmd.h
 create mode 100755 iptables/tests/shell/testcases/nft-only/0006-policy-override_0
Signature · 1 line
2.25.1