From 1e55b7082ddad54711949af3a5ae35fb900bb138 Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Thu, 10 Nov 2011 11:02:23 +0200 Subject: [PATCH] iptables: Initiate defined table before working on it --- src/iptables.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/iptables.c b/src/iptables.c index f562f32..9d6a9e7 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -1572,6 +1572,13 @@ static int iptables_command(int argc, char *argv[]) case 't': table_name = optarg; + + table = iptables_init(table_name); + if (table == NULL) { + ret = -EINVAL; + goto out; + } + break; case 1: @@ -1662,13 +1669,14 @@ static int iptables_command(int argc, char *argv[]) xt_t->final_check(xt_t->tflags); #endif - if (table_name == NULL) + if (table == NULL) { table_name = "filter"; - table = iptables_init(table_name); - if (table == NULL) { - ret = -EINVAL; - goto out; + table = iptables_init(table_name); + if (table == NULL) { + ret = -EINVAL; + goto out; + } } if (delete_chain != NULL) { -- 2.7.4