diff options
author | Patrick McHardy <kaber@trash.net> | 2011-04-12 16:05:39 +0200 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-04-12 16:05:39 +0200 |
commit | cd50f26ad6016ae57af1f822f8aa3ceb2ef9727a (patch) | |
tree | ecd79b89cc099c7ca1726df0417328cc822a9e69 /ip6tables.c | |
parent | 884d2675f1a880ffcc072da69ab8c9aaea2a3bce (diff) | |
parent | b18ffe3636b07cd817628de81643136e4755a944 (diff) |
Merge branch 'opts' of git://dev.medozas.de/iptables
Diffstat (limited to 'ip6tables.c')
-rw-r--r-- | ip6tables.c | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/ip6tables.c b/ip6tables.c index ea9a7abf..f9909f13 100644 --- a/ip6tables.c +++ b/ip6tables.c @@ -1273,25 +1273,25 @@ static void command_default(struct iptables_command_state *cs) struct xtables_rule_match *matchp; struct xtables_match *m; - if (cs->target != NULL && cs->target->parse != NULL && + if (cs->target != NULL && + (cs->target->parse != NULL || cs->target->x6_parse != NULL) && cs->c >= cs->target->option_offset && cs->c < cs->target->option_offset + XT_OPTION_OFFSET_SCALE) { - cs->target->parse(cs->c - cs->target->option_offset, cs->argv, - cs->invert, &cs->target->tflags, &cs->fw6, - &cs->target->t); + xtables_option_tpcall(cs->c, cs->argv, cs->invert, + cs->target, &cs->fw); return; } for (matchp = cs->matches; matchp; matchp = matchp->next) { m = matchp->match; - if (matchp->completed || m->parse == NULL) + if (matchp->completed || + (m->x6_parse == NULL && m->parse == NULL)) continue; if (cs->c < matchp->match->option_offset || cs->c >= matchp->match->option_offset + XT_OPTION_OFFSET_SCALE) continue; - m->parse(cs->c - m->option_offset, cs->argv, cs->invert, - &m->mflags, &cs->fw6, &m->m); + xtables_option_mpcall(cs->c, cs->argv, cs->invert, m, &cs->fw); return; } @@ -1311,9 +1311,17 @@ static void command_default(struct iptables_command_state *cs) if (m->init != NULL) m->init(m->m); - opts = xtables_merge_options(ip6tables_globals.orig_opts, opts, - m->extra_opts, &m->option_offset); - + if (m->x6_options != NULL) + opts = xtables_options_xfrm(ip6tables_globals.orig_opts, + opts, m->x6_options, + &m->option_offset); + else + opts = xtables_merge_options(ip6tables_globals.orig_opts, + opts, + m->extra_opts, + &m->option_offset); + if (opts == NULL) + xtables_error(OTHER_PROBLEM, "can't alloc memory!"); optind--; return; } @@ -1347,9 +1355,14 @@ static void command_jump(struct iptables_command_state *cs) cs->target->t->u.user.revision = cs->target->revision; if (cs->target->init != NULL) cs->target->init(cs->target->t); - opts = xtables_merge_options(ip6tables_globals.orig_opts, opts, - cs->target->extra_opts, - &cs->target->option_offset); + if (cs->target->x6_options != NULL) + opts = xtables_options_xfrm(ip6tables_globals.orig_opts, opts, + cs->target->x6_options, + &cs->target->option_offset); + else + opts = xtables_merge_options(ip6tables_globals.orig_opts, opts, + cs->target->extra_opts, + &cs->target->option_offset); if (opts == NULL) xtables_error(OTHER_PROBLEM, "can't alloc memory!"); } @@ -1371,8 +1384,13 @@ static void command_match(struct iptables_command_state *cs) m->m->u.user.revision = m->revision; if (m->init != NULL) m->init(m->m); - if (m != m->next) - /* Merge options for non-cloned matches */ + if (m == m->next) + return; + /* Merge options for non-cloned matches */ + if (m->x6_options != NULL) + opts = xtables_options_xfrm(ip6tables_globals.orig_opts, opts, + m->x6_options, &m->option_offset); + else if (m->extra_opts != NULL) opts = xtables_merge_options(ip6tables_globals.orig_opts, opts, m->extra_opts, &m->option_offset); } @@ -1759,11 +1777,9 @@ int do_command6(int argc, char *argv[], char **table, struct ip6tc_handle **hand } for (matchp = cs.matches; matchp; matchp = matchp->next) - if (matchp->match->final_check != NULL) - matchp->match->final_check(matchp->match->mflags); - - if (cs.target != NULL && cs.target->final_check != NULL) - cs.target->final_check(cs.target->tflags); + xtables_option_mfcall(matchp->match); + if (cs.target != NULL) + xtables_option_tfcall(cs.target); /* Fix me: must put inverse options checking here --MN */ |