Skip to content

Improve xtables-restore performance

Phil Sutter netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest7 patches 4 repliesIn review

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7xtables-restore: Integrate restore callbacks into struct nft_xt_restore_parseiptables/nft-shared.h iptables/xtables-restore.c iptables/xtables-translate.c+21 -160 replies
2/7xtables-restore: Introduce struct nft_xt_restore_stateiptables/xtables-restore.c+35 -310 replies
3/7xtables-restore: Introduce line parsing functioniptables/xtables-restore.c+177 -1700 replies
4/7xtables-restore: Remove some pointless linebreaksiptables/xtables-restore.c+10 -150 replies
5/7xtables-restore: Allow lines without trailing newline characteriptables/xshared.c iptables/xtables-restore.c+7 -10 replies
6/7xtables-restore: Improve performance of --noflush operationiptables/xtables-restore.c+81 -70 replies
7/7tests: shell: Add ipt-restore/0007-flush-noflush_0iptables/tests/shell/testcases/ipt-restore/0007-flush-noflush_0+42 -00 replies

Reviews trailers per patch

None of the 7 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPablo Neira Ayuso
SeriesA-b A-b
1/7
2/7
3/7
4/7
5/7
6/7
7/7

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

Read the v3 thread

Cover letter [iptables PATCH v3 0/7] Improve xtables-restore performance

This series speeds up xtables-restore calls with --noflush (typically used to batch a few commands for faster execution) by preliminary input inspection.

Before, setting --noflush flag would inevitably lead to full cache population. With this series in place, if input can be fully buffered and no commands requiring full cache is contained, no initial cache population happens and each rule parsed will cause fetching of cache bits as required.

The input buffer size is arbitrarily chosen to be 64KB.

Patches one and two prepare code for patch three which moves the loop content parsing each line of input into a separate function. The reduction of code indenting is used by patch four which deals with needless line breaks.

Patch five deals with another requirement of input buffering, namely stripping newline characters from each line. This is not a problem by itself, but add_param_to_argv() replaces them by nul-chars and so strings stop being consistently terminated (some by a single, some by two nul-chars).

Patch six then finally adds the buffering and caching decision code.

Patch seven is pretty unrelated but tests a specific behaviour of *tables-restore I wasn't sure of at first.

Phil Sutter (7):
xtables-restore: Integrate restore callbacks into struct
nft_xt_restore_parse
xtables-restore: Introduce struct nft_xt_restore_state
xtables-restore: Introduce line parsing function
xtables-restore: Remove some pointless linebreaks
xtables-restore: Allow lines without trailing newline character
xtables-restore: Improve performance of --noflush operation
tests: shell: Add ipt-restore/0007-flush-noflush_0

 iptables/nft-shared.h                         |  18 +-
 .../ipt-restore/0007-flush-noflush_0          |  42 ++
 iptables/xshared.c                            |   4 +
 iptables/xtables-restore.c                    | 443 +++++++++++-------
 iptables/xtables-translate.c                  |   6 +-
 5 files changed, 323 insertions(+), 190 deletions(-)
 create mode 100755 iptables/tests/shell/testcases/ipt-restore/0007-flush-noflush_0
Signature · 1 line
2.23.0