diff options
author | Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> | 2011-10-31 11:33:47 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-10-31 10:50:24 +0100 |
commit | 7559d1e90f9a607cb83525af1c95b581adae0c0f (patch) | |
tree | 2b287102d13fdf6c208977bbed47f6483aea9ac4 /tools/iptables-test.c | |
parent | adf8327243aba249cd3b50690c2ca369fafaee8d (diff) | |
download | connman-7559d1e90f9a607cb83525af1c95b581adae0c0f.tar.gz connman-7559d1e90f9a607cb83525af1c95b581adae0c0f.tar.bz2 connman-7559d1e90f9a607cb83525af1c95b581adae0c0f.zip |
tools: Fix xtables API version issues with iptables-test
Diffstat (limited to 'tools/iptables-test.c')
-rw-r--r-- | tools/iptables-test.c | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/tools/iptables-test.c b/tools/iptables-test.c index fe90e0e7..3bbe43b3 100644 --- a/tools/iptables-test.c +++ b/tools/iptables-test.c @@ -1323,16 +1323,17 @@ static struct xtables_target *prepare_target(struct connman_iptables *table, xt_t->init(xt_t->t); } +#if XTABLES_VERSION_CODE > 5 if (xt_t->x6_options != NULL) connman_iptables_globals.opts = xtables_options_xfrm( -#if XTABLES_VERSION_CODE > 5 connman_iptables_globals.orig_opts, -#endif + connman_iptables_globals.opts, xt_t->x6_options, &xt_t->option_offset); else +#endif connman_iptables_globals.opts = xtables_merge_options( #if XTABLES_VERSION_CODE > 5 @@ -1376,16 +1377,16 @@ static struct xtables_match *prepare_matches(struct connman_iptables *table, if (xt_m == xt_m->next) goto done; +#if XTABLES_VERSION_CODE > 5 if (xt_m->x6_options != NULL) connman_iptables_globals.opts = xtables_options_xfrm( -#if XTABLES_VERSION_CODE > 5 connman_iptables_globals.orig_opts, -#endif connman_iptables_globals.opts, xt_m->x6_options, &xt_m->option_offset); else +#endif connman_iptables_globals.opts = xtables_merge_options( #if XTABLES_VERSION_CODE > 5 @@ -1577,6 +1578,7 @@ int main(int argc, char *argv[]) return -1; default: +#if XTABLES_VERSION_CODE > 5 if (xt_t != NULL && (xt_t->x6_parse != NULL || xt_t->parse != NULL) && (c >= (int) xt_t->option_offset && @@ -1607,19 +1609,49 @@ int main(int argc, char *argv[]) break; } +#else + if (xt_t == NULL || xt_t->parse == NULL || + !xt_t->parse(c - xt_t->option_offset, + argv, invert, &xt_t->tflags, NULL, &xt_t->t)) { + for (tmp_xt_rm = xt_rm; tmp_xt_rm != NULL; + tmp_xt_rm = tmp_xt_rm->next) { + xt_m_t = tmp_xt_rm->match; + + if (tmp_xt_rm->completed || + xt_m_t->parse == NULL) + continue; + + if (xt_m->parse(c - xt_m->option_offset, + argv, invert, &xt_m->mflags, + NULL, &xt_m->m)) + break; + } + } +#endif break; } invert = FALSE; } +#if XTABLES_VERSION_CODE > 5 for (tmp_xt_rm = xt_rm; tmp_xt_rm != NULL; tmp_xt_rm = tmp_xt_rm->next) xtables_option_mfcall(tmp_xt_rm->match); if (xt_t != NULL) xtables_option_tfcall(xt_t); +#else + for (tmp_xt_rm = xt_rm; tmp_xt_rm != NULL; + tmp_xt_rm = tmp_xt_rm->next) + if (tmp_xt_rm->match->final_check != NULL) + tmp_xt_rm->match->final_check( + tmp_xt_rm->match->mflags); + + if (xt_t != NULL && xt_t->final_check != NULL) + xt_t->final_check(xt_t->tflags); +#endif if (table_name == NULL) table_name = "filter"; |