summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2011-11-10 11:02:22 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2011-11-14 16:43:44 +0100
commit178c2055e7ab6be3f7fd5fd89c2698e1f8b038da (patch)
treec5a798e22a8f76cb194a503f4aaee10598c4e793
parent0a1ddb3fa4309a7c49b52cdbbfd1388856b4847f (diff)
downloadconnman-178c2055e7ab6be3f7fd5fd89c2698e1f8b038da.tar.gz
connman-178c2055e7ab6be3f7fd5fd89c2698e1f8b038da.tar.bz2
connman-178c2055e7ab6be3f7fd5fd89c2698e1f8b038da.zip
tools: Initiate defined table before working on it in iptables-test
-rw-r--r--tools/iptables-test.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/iptables-test.c b/tools/iptables-test.c
index 3bbe43b3..b3f1ce16 100644
--- a/tools/iptables-test.c
+++ b/tools/iptables-test.c
@@ -1561,6 +1561,11 @@ int main(int argc, char *argv[])
case 't':
table_name = optarg;
+
+ table = connman_iptables_init(table_name);
+ if (table == NULL)
+ return -1;
+
break;
case 1:
@@ -1653,12 +1658,13 @@ int main(int argc, char *argv[])
xt_t->final_check(xt_t->tflags);
#endif
- if (table_name == NULL)
+ if (table == NULL) {
table_name = "filter";
- table = connman_iptables_init(table_name);
- if (table == NULL)
- return -1;
+ table = connman_iptables_init(table_name);
+ if (table == NULL)
+ return -1;
+ }
if (delete) {
if (delete_chain == NULL)