All of lore.kernel.org
 help / color / mirror / Atom feed
* [iptables PATCH 0/4] Speed up iptables-nft-save
@ 2022-03-02 15:18 Phil Sutter
  2022-03-02 15:18 ` [iptables PATCH 1/4] nft: Simplify immediate parsing Phil Sutter
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Phil Sutter @ 2022-03-02 15:18 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

OpenShift tends to create huge rulesets[*] and consequently wonders why
iptables is slow. Anyway, iptables-nft-save really does odd things:

* For each jump target, it checks if such extension exists, despite
  already knowing whether the target is a chain or not. This is solved
  in patch 2, with patch 1 preparing nft_parse_immediate() to make the
  change simpler.

* Every l4proto match causes a call to getprotobynumber() which in turn
  opens /etc/protocols. One could cache the lookups, but preferring the
  builtin fallback list of protocol names and numbers is much simpler.
  Do that in patch 3, aligning said list with /etc/protocols to not
  change output unexpectedly.

[*] I have a "real-life" dump adding 50k chains and 130k rules. Dumping
    it to /dev/null took 45s on my testing VM, with these patches
    applied I'm down to 2.7s.

The last patch is fallout from the above, simplifying family ops
callbacks a bit given that there is only a single *tables_command_state
struct left.

Phil Sutter (4):
  nft: Simplify immediate parsing
  nft: Speed up immediate parsing
  xshared: Prefer xtables_chain_protos lookup over getprotoent
  nft: Don't pass command state opaque to family ops callbacks

 iptables/nft-arp.c    | 32 ++++++------------
 iptables/nft-bridge.c | 55 +++++++++++++------------------
 iptables/nft-ipv4.c   | 40 ++++++++---------------
 iptables/nft-ipv6.c   | 40 ++++++++---------------
 iptables/nft-shared.c | 75 ++++++++++++++++++++-----------------------
 iptables/nft-shared.h | 35 ++++++++++----------
 iptables/nft.c        |  4 +--
 iptables/nft.h        |  2 +-
 iptables/xshared.c    |  8 ++---
 libxtables/xtables.c  | 19 ++++-------
 10 files changed, 126 insertions(+), 184 deletions(-)

-- 
2.34.1


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

end of thread, other threads:[~2022-03-10 12:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 15:18 [iptables PATCH 0/4] Speed up iptables-nft-save Phil Sutter
2022-03-02 15:18 ` [iptables PATCH 1/4] nft: Simplify immediate parsing Phil Sutter
2022-03-10 12:09   ` Florian Westphal
2022-03-02 15:18 ` [iptables PATCH 2/4] nft: Speed up " Phil Sutter
2022-03-02 15:18 ` [iptables PATCH 3/4] xshared: Prefer xtables_chain_protos lookup over getprotoent Phil Sutter
2022-03-10 12:11   ` Florian Westphal
2022-03-10 12:20     ` Phil Sutter
     [not found]       ` <20220310122303.GC13772@breakpoint.cc>
2022-03-10 12:54         ` Phil Sutter
2022-03-02 15:18 ` [iptables PATCH 4/4] nft: Don't pass command state opaque to family ops callbacks Phil Sutter
2022-03-10 12:14   ` Florian Westphal

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.