diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2013-02-12 10:19:39 +0100 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2013-02-12 12:27:45 +0200 |
commit | 29d4d4815bc64d543b1fde6e24a960747deca8ef (patch) | |
tree | 57fd4faabf55271ee54d4c3b121bead490513222 /src | |
parent | 3fc54a0a218a11b35595dc8b886ac69ae5f777f0 (diff) | |
download | connman-29d4d4815bc64d543b1fde6e24a960747deca8ef.tar.gz connman-29d4d4815bc64d543b1fde6e24a960747deca8ef.tar.bz2 connman-29d4d4815bc64d543b1fde6e24a960747deca8ef.zip |
iptables: Clear global parser flags
That allows the parser to be reentrantable.
Diffstat (limited to 'src')
-rw-r--r-- | src/iptables.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/iptables.c b/src/iptables.c index 2f9844f8..3e4513fd 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -1617,6 +1617,24 @@ static struct connman_iptables *pre_load_table(const char *table_name, return iptables_init(table_name); } +static void clear_tables_flags(void) +{ + struct xtables_match *xt_m; + struct xtables_target *xt_t; + + /* + * Clear all flags because the flags are only valid + * for one rule. + */ + for (xt_m = xtables_matches; xt_m != NULL; xt_m = xt_m->next) + xt_m->mflags = 0; + + for (xt_t = xtables_targets; xt_t != NULL; xt_t = xt_t->next) { + xt_t->tflags = 0; + xt_t->used = 0; + } +} + static int iptables_command(int argc, char *argv[]) { struct connman_iptables *table; @@ -1647,6 +1665,8 @@ static int iptables_command(int argc, char *argv[]) /* Default code for options parsing */ ret = -EINVAL; + clear_tables_flags(); + /* extension's options will generate false-positives errors */ opterr = 0; |