From: Tomasz Bursztyka Date: Thu, 10 Nov 2011 09:02:23 +0000 (+0200) Subject: iptables: Initiate defined table before working on it X-Git-Tag: 2.0_alpha~939 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e55b7082ddad54711949af3a5ae35fb900bb138;p=framework%2Fconnectivity%2Fconnman.git iptables: Initiate defined table before working on it --- 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) {