summaryrefslogtreecommitdiffstats
path: root/iptables/tests/shell/testcases/ipt-restore/0007-flush-noflush_0
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2019-09-17 20:27:27 +0200
committerPhil Sutter <phil@nwl.cc>2019-11-06 13:42:02 +0100
commit09cb517949e69c6ebfc4e755057b270f0dc99291 (patch)
tree7ec80e884adf9dd853da634757d618a2b4777058 /iptables/tests/shell/testcases/ipt-restore/0007-flush-noflush_0
parent92991bbe12d77c6129b3a71b25c36fad6a27d75a (diff)
xtables-restore: Improve performance of --noflush operation
The reason for that full cache fetching when called with --noflush even before looking at any input data was that there might be a command requiring a rule cache following some rule add/insert ones which don't. At that point one needs to fetch rules from kernel and try to insert the local ones at the right spot which is non-trivial. At the same time there is a performance-critical use-case for --noflush, namely fast insertion of a bunch of rules in one go, avoiding the process spawn overhead. Optimize for this use-case by preloading input into a 64KB buffer to see if it fits. If so, search for commands requiring a rule cache. If there are none, skip initial full cache fetching. The above algorithm may abort at any point, so actual input parsing must happen in three stages: 1) parse all preloaded lines from 64KB buffer 2) parse any leftover line in line buffer (happens if input exceeds the preload buffer size) 3) parse remaining input from input file pointer Signed-off-by: Phil Sutter <phil@nwl.cc> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/tests/shell/testcases/ipt-restore/0007-flush-noflush_0')
0 files changed, 0 insertions, 0 deletions