summaryrefslogtreecommitdiffstats
path: root/iptables/xshared.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2022-03-16 17:14:07 +0100
committerPhil Sutter <phil@nwl.cc>2022-03-17 09:55:48 +0100
commitb1aee6b2238794446feba41778f88703784560f7 (patch)
tree13be8d334a7e9a2212e7a468124003fc485d23b1 /iptables/xshared.c
parentb555bfed542635259c489596630a75fce50aab1b (diff)
nft: Reject standard targets as chain names when restoring
Reuse parse_chain() called from do_parse() for '-N' and rename it for a better description of what it does. Note that by itself, this patch will likely kill iptables-restore performance for big rulesets due to the extra extension lookup for chain lines. A following patch announcing those chains to libxtables will alleviate that. Signed-off-by: Phil Sutter <phil@nwl.cc> Reviewed-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/xshared.c')
-rw-r--r--iptables/xshared.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/iptables/xshared.c b/iptables/xshared.c
index 43321d3b..00828c8a 100644
--- a/iptables/xshared.c
+++ b/iptables/xshared.c
@@ -1031,7 +1031,7 @@ set_option(unsigned int *options, unsigned int option, u_int16_t *invflg,
}
}
-void parse_chain(const char *chainname)
+void assert_valid_chain_name(const char *chainname)
{
const char *ptr;
@@ -1412,7 +1412,7 @@ void do_parse(int argc, char *argv[],
break;
case 'N':
- parse_chain(optarg);
+ assert_valid_chain_name(optarg);
add_command(&p->command, CMD_NEW_CHAIN, CMD_NONE,
invert);
p->chain = optarg;