diff options
author | Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> | 2011-11-10 11:02:23 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-11-14 16:44:09 +0100 |
commit | 1e55b7082ddad54711949af3a5ae35fb900bb138 (patch) | |
tree | 0f8ba3eb3eda4e1ce57ba67beab4f7d277ac83c8 /src/iptables.c | |
parent | 178c2055e7ab6be3f7fd5fd89c2698e1f8b038da (diff) | |
download | connman-1e55b7082ddad54711949af3a5ae35fb900bb138.tar.gz connman-1e55b7082ddad54711949af3a5ae35fb900bb138.tar.bz2 connman-1e55b7082ddad54711949af3a5ae35fb900bb138.zip |
iptables: Initiate defined table before working on it
Diffstat (limited to 'src/iptables.c')
-rw-r--r-- | src/iptables.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/iptables.c b/src/iptables.c index f562f325..9d6a9e70 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) { |