summaryrefslogtreecommitdiffstats
path: root/iptables/tests/shell/testcases/nft-only/0011-zero-needs-compat_0
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2024-01-10 15:26:59 +0100
committerPhil Sutter <phil@nwl.cc>2024-02-07 00:25:03 +0100
commitff57cd48d2b0c01c1519fd8893fc0432ad211702 (patch)
tree96e5369c10d314f7b8aca0be375bded16affeb04 /iptables/tests/shell/testcases/nft-only/0011-zero-needs-compat_0
parenta369c736a7fa88a176dbdb17fd50cf30074f54ab (diff)
iptables-save: Avoid /etc/protocols lookups
Instrument proto_to_name() to abort if given protocol number is not among the well-known ones in xtables_chain_protos. Along with xtables_parse_protocol() preferring said array for lookups as well, this ensures reliable dump'n'restore regardless of /etc/protocols contents. Another benefit is rule dump performance. A simple test-case dumping 100k rules matching on dccp protocol shows an 8s delta (2s vs. 10s for legacy, 0.5s vs. 8s for nft) with this patch applied. For reference: | for variant in nft legacy; do | ( | echo "*filter" | for ((i = 0; i < 100000; i++)); do | echo "-A FORWARD -p dccp -j ACCEPT" | done | echo "COMMIT" | ) | iptables-${variant}-restore | time iptables-${variant}-save | wc -l | iptables-${variant} -F | done Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/tests/shell/testcases/nft-only/0011-zero-needs-compat_0')
0 files changed, 0 insertions, 0 deletions