summaryrefslogtreecommitdiffstats
path: root/iptables.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2011-04-12 16:05:39 +0200
committerPatrick McHardy <kaber@trash.net>2011-04-12 16:05:39 +0200
commitcd50f26ad6016ae57af1f822f8aa3ceb2ef9727a (patch)
treeecd79b89cc099c7ca1726df0417328cc822a9e69 /iptables.c
parent884d2675f1a880ffcc072da69ab8c9aaea2a3bce (diff)
parentb18ffe3636b07cd817628de81643136e4755a944 (diff)
Merge branch 'opts' of git://dev.medozas.de/iptables
Diffstat (limited to 'iptables.c')
-rw-r--r--iptables.c58
1 files changed, 36 insertions, 22 deletions
diff --git a/iptables.c b/iptables.c
index cf272278..0441dce3 100644
--- a/iptables.c
+++ b/iptables.c
@@ -1297,25 +1297,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->fw,
- &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 < m->option_offset ||
cs->c >= m->option_offset + XT_OPTION_OFFSET_SCALE)
continue;
- m->parse(cs->c - m->option_offset, cs->argv, cs->invert,
- &m->mflags, &cs->fw, &m->m);
+ xtables_option_mpcall(cs->c, cs->argv, cs->invert, m, &cs->fw);
return;
}
@@ -1335,8 +1335,15 @@ static void command_default(struct iptables_command_state *cs)
if (m->init != NULL)
m->init(m->m);
- opts = xtables_merge_options(iptables_globals.orig_opts, opts,
- m->extra_opts, &m->option_offset);
+ if (m->x6_options != NULL)
+ opts = xtables_options_xfrm(iptables_globals.orig_opts,
+ opts, m->x6_options,
+ &m->option_offset);
+ else
+ opts = xtables_merge_options(iptables_globals.orig_opts,
+ opts,
+ m->extra_opts,
+ &m->option_offset);
if (opts == NULL)
xtables_error(OTHER_PROBLEM, "can't alloc memory!");
@@ -1374,9 +1381,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(iptables_globals.orig_opts, opts,
- cs->target->extra_opts,
- &cs->target->option_offset);
+ if (cs->target->x6_options != NULL)
+ opts = xtables_options_xfrm(iptables_globals.orig_opts, opts,
+ cs->target->x6_options,
+ &cs->target->option_offset);
+ else
+ opts = xtables_merge_options(iptables_globals.orig_opts, opts,
+ cs->target->extra_opts,
+ &cs->target->option_offset);
if (opts == NULL)
xtables_error(OTHER_PROBLEM, "can't alloc memory!");
}
@@ -1398,13 +1410,17 @@ 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(iptables_globals.orig_opts, opts,
+ m->x6_options, &m->option_offset);
+ else if (m->extra_opts != NULL)
opts = xtables_merge_options(iptables_globals.orig_opts, opts,
m->extra_opts, &m->option_offset);
- if (opts == NULL)
- xtables_error(OTHER_PROBLEM, "can't alloc memory!");
- }
+ if (opts == NULL)
+ xtables_error(OTHER_PROBLEM, "can't alloc memory!");
}
int do_command4(int argc, char *argv[], char **table, struct iptc_handle **handle)
@@ -1795,11 +1811,9 @@ int do_command4(int argc, char *argv[], char **table, struct iptc_handle **handl
"the use of DROP is therefore inhibited.\n\n");
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 */