summaryrefslogtreecommitdiffstats
path: root/iptables/xtables-eb.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2018-06-29 00:15:25 +0200
committerFlorian Westphal <fw@strlen.de>2018-06-29 14:37:01 +0200
commitb81708fda5436e8bcd2fb2871b5f824f8f536406 (patch)
tree3cde5efdc70b2d4d45ee9f42a6ab427b10d0be6f /iptables/xtables-eb.c
parentde02a753e72a9f84c47eeb296954f653a31b63ec (diff)
ebtables-nft: don't crash on ebtables -X
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/xtables-eb.c')
-rw-r--r--iptables/xtables-eb.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
index e22181ee..9460a91a 100644
--- a/iptables/xtables-eb.c
+++ b/iptables/xtables-eb.c
@@ -208,6 +208,9 @@ delete_entry(struct nft_handle *h,
static int get_current_chain(const char *chain)
{
+ if (!chain)
+ return -1;
+
if (strcmp(chain, "PREROUTING") == 0)
return NF_BR_PRE_ROUTING;
else if (strcmp(chain, "INPUT") == 0)
@@ -823,13 +826,12 @@ int do_commandeb(struct nft_handle *h, int argc, char *argv[], char **table)
"Multiple commands are not allowed");
command = c;
+ if (optarg && (optarg[0] == '-' || !strcmp(optarg, "!")))
+ xtables_error(PARAMETER_PROBLEM, "No chain name specified");
chain = optarg;
selected_chain = get_current_chain(chain);
flags |= OPT_COMMAND;
- /*if (!(replace->flags & OPT_KERNELDATA))
- ebt_get_kernel_table(replace, 0);*/
- /*if (optarg && (optarg[0] == '-' || !strcmp(optarg, "!")))
- ebt_print_error2("No chain name specified");*/
+
if (c == 'N') {
ret = nft_chain_user_add(h, chain, *table);
break;