Skip to content

Speed up iptables-test.py

Phil Sutter netfilter-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest12 patches 1 replyIn review
  2. v112 patches 5 repliesSuperseded

Changes in v2 from the cover letter

- Add fallout NFQUEUE patch 1
- Adjust iptables-test.py enhancement as suggested by Jan, details in patch 2
- Avoid changing what extensions print, this is a separate discussion - instead update expected output accordingly

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12extensions: NFQUEUE: Document queue-balance limitationextensions/libxt_NFQUEUE.c extensions/libxt_NFQUEUE.man extensions/libxt_NFQUEUE.t+5 -40 replies
2/12tests: iptables-test: Implement fast test modeiptables-test.py+159 -10 replies
3/12tests: iptables-test: Cover for obligatory -j CONTINUE in ebtablesiptables-test.py+3 -00 replies
4/12tests: *.t: Fix expected output for simple callsextensions/libebt_log.t extensions/libebt_nflog.t extensions/libip6t_REJECT.t +2 more+5 -50 replies
5/12tests: *.t: Fix for hexadecimal outputextensions/libxt_DSCP.t extensions/libxt_MARK.t extensions/libxt_connmark.t +2 more+6 -60 replies
6/12tests: libebt_redirect.t: Plain redirect prints with trailing whitespaceextensions/libebt_redirect.t+1 -10 replies
7/12tests: libxt_length.t: Fix odd use-case outputextensions/libxt_length.t+1 -10 replies
8/12tests: libxt_recent.t: Add missing default valuesextensions/libxt_recent.t+2 -20 replies
9/12tests: libxt_tos.t, libxt_TOS.t: Add missing masks in outputextensions/libxt_TOS.t extensions/libxt_tos.t+10 -100 replies
10/12tests: libebt_vlan.t: Drop trailing whitespace from rulesextensions/libebt_vlan.t+2 -20 replies
11/12tests: libxt_connlimit.t: Add missing default valuesextensions/libxt_connlimit.t+6 -60 replies
12/12tests: *.t: Add missing all-one's netmasks to expected outputextensions/libip6t_NETMAP.t extensions/libipt_NETMAP.t extensions/libxt_CONNMARK.t +1 more+8 -80 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [iptables PATCH v2 00/12] Speed up iptables-test.py

Changes since v1:
- Add fallout NFQUEUE patch 1
- Adjust iptables-test.py enhancement as suggested by Jan, details in patch 2
- Avoid changing what extensions print, this is a separate discussion - instead update expected output accordingly

Original cover letter text:

I had this in mind for a while now and finally got around to do it: When testing an extensions/*.t file with iptables-tests.py, act in a "batch" mode applying all rules at once and checking the expected output in one go, thereby reducing the overhead per test file to a single iptables-restore and iptables-save call each. This was a bit optimistic, but the result is still significant - on my rather slow testing VM, a full iptables-tests.py run completes in ~7min instead of ~30min (yes, it's slow).

See patch 1 for the implementation details. As a side-effect, rule existence checking became much stricter, so the remaining patches in this series deal with eliminating those differences:

* Patch 2 avoids having to add '-j CONTINUE' to almost all ebtables rules.
* Patches 3-10 adjust expected output to reality, mostly adding content the script didn't care about since the old 'output.find(<rule>)' worked fine as long as the output *started* like '<rule>'.
* Patch 11 Changes output by omitting an obvious default value, so a real functional change.
* Patch 12 drops another default value (from NFQUEUE target) I'm not sure we should keep.

So patches are roughly sorted by my confidence in correctness. Please have (at least) a close look at the last two, I don't want to break iptables for anyone just to keep test files small.

Phil Sutter (12):
extensions: NFQUEUE: Document queue-balance limitation
tests: iptables-test: Implement fast test mode
tests: iptables-test: Cover for obligatory -j CONTINUE in ebtables
tests: *.t: Fix expected output for simple calls
tests: *.t: Fix for hexadecimal output
tests: libebt_redirect.t: Plain redirect prints with trailing
whitespace
tests: libxt_length.t: Fix odd use-case output
tests: libxt_recent.t: Add missing default values
tests: libxt_tos.t, libxt_TOS.t: Add missing masks in output
tests: libebt_vlan.t: Drop trailing whitespace from rules
tests: libxt_connlimit.t: Add missing default values
tests: *.t: Add missing all-one's netmasks to expected output

 extensions/libebt_log.t      |   2 +-
 extensions/libebt_nflog.t    |   2 +-
 extensions/libebt_redirect.t |   2 +-
 extensions/libebt_vlan.t     |   4 +-
 extensions/libip6t_NETMAP.t  |   2 +-
 extensions/libip6t_REJECT.t  |   2 +-
 extensions/libipt_NETMAP.t   |   2 +-
 extensions/libipt_REJECT.t   |   2 +-
 extensions/libxt_CONNMARK.t  |   8 +-
 extensions/libxt_DSCP.t      |   2 +-
 extensions/libxt_MARK.t      |   4 +-
 extensions/libxt_NFQUEUE.c   |   2 +-
 extensions/libxt_NFQUEUE.man |   2 +
 extensions/libxt_NFQUEUE.t   |   7 +-
 extensions/libxt_TOS.t       |  12 +--
 extensions/libxt_connlimit.t |  12 +--
 extensions/libxt_connmark.t  |   4 +-
 extensions/libxt_dscp.t      |   2 +-
 extensions/libxt_length.t    |   2 +-
 extensions/libxt_mark.t      |   2 +-
 extensions/libxt_recent.t    |   4 +-
 extensions/libxt_tos.t       |   8 +-
 iptables-test.py             | 163 ++++++++++++++++++++++++++++++++++-
 23 files changed, 207 insertions(+), 45 deletions(-)
Signature · 1 line
2.34.1