]> git.ipfire.org Git - thirdparty/iptables.git/commit
xtables-restore: Unbreak *tables-restore
authorPhil Sutter <phil@nwl.cc>
Tue, 22 Oct 2019 10:25:28 +0000 (12:25 +0200)
committerPhil Sutter <phil@nwl.cc>
Wed, 23 Oct 2019 08:58:09 +0000 (10:58 +0200)
commit4e470fa34761085144640fb561a9ad26b2cde382
tree70722e0e5e003fa2a764c8e8a251112bc41f02e4
parent3dc433b55bbfaf9df3ee408aaa6282742f377864
xtables-restore: Unbreak *tables-restore

Commit 3dc433b55bbfa ("xtables-restore: Fix --table parameter check")
installed an error check which evaluated true in all cases as all
callers of do_command callbacks pass a pointer to a table name already.
Attached test case passed as it tested error condition only.

Fix the whole mess by introducing a boolean to indicate whether a table
parameter was seen already. Extend the test case to cover positive as
well as negative behaviour and to test ebtables-restore and
ip6tables-restore as well. Also add the required checking code to the
latter since the original commit missed it.

Fixes: 3dc433b55bbfa ("xtables-restore: Fix --table parameter check")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/ip6tables.c
iptables/iptables.c
iptables/tests/shell/testcases/ipt-restore/0009-table-name-comment_0
iptables/xtables-eb.c
iptables/xtables.c