summaryrefslogtreecommitdiff
path: root/src/iptables.c
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2011-10-27 10:26:31 +0300
committerSamuel Ortiz <sameo@linux.intel.com>2011-10-28 21:34:27 +0200
commit4ad0e5a7d43d4be028a4237dceef06bd4403ea2d (patch)
tree998bb10cb0c5cea40aec3c5ad19788708091c8bd /src/iptables.c
parentcde720fb5b3d98e3a9bb10e9ba234e5cb7025e4a (diff)
downloadconnman-4ad0e5a7d43d4be028a4237dceef06bd4403ea2d.tar.gz
connman-4ad0e5a7d43d4be028a4237dceef06bd4403ea2d.tar.bz2
connman-4ad0e5a7d43d4be028a4237dceef06bd4403ea2d.zip
iptables: Move target options merge to prepare_target
Diffstat (limited to 'src/iptables.c')
-rw-r--r--src/iptables.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/iptables.c b/src/iptables.c
index eef91c18..14da18e2 100644
--- a/src/iptables.c
+++ b/src/iptables.c
@@ -1299,6 +1299,20 @@ static struct xtables_target *prepare_target(struct connman_iptables *table,
xt_t->init(xt_t->t);
}
+ iptables_globals.opts =
+ xtables_merge_options(
+#if XTABLES_VERSION_CODE > 5
+ iptables_globals.orig_opts,
+#endif
+ iptables_globals.opts,
+ xt_t->extra_opts,
+ &xt_t->option_offset);
+
+ if (iptables_globals.opts == NULL) {
+ g_free(xt_t->t);
+ xt_t = NULL;
+ }
+
return xt_t;
}
@@ -1544,17 +1558,6 @@ static int iptables_command(int argc, char *argv[])
if (xt_t == NULL)
goto out;
- iptables_globals.opts =
- xtables_merge_options(
-#if XTABLES_VERSION_CODE > 5
- iptables_globals.orig_opts,
-#endif
- iptables_globals.opts,
- xt_t->extra_opts,
- &xt_t->option_offset);
- if (iptables_globals.opts == NULL)
- goto out;
-
if (delete == TRUE) {
DBG("Deleting %s to %s (match %s)\n",
target_name, chain, match_name);