summaryrefslogtreecommitdiffstats
path: root/iptables
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2016-07-24 12:45:53 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2016-07-25 17:24:55 +0200
commit7a0992da44cfb6cab0ccd1beadcf326df8773552 (patch)
tree121e927b4171f4aacfafc268fb4104ab90b4ea2a /iptables
parentd89e5c0c84778a4effa40f69dbd3a68d0ec284fc (diff)
src: introduce struct xt_xlate_{mt,tg}_params
This structure is an extensible containers of parameters, so we don't need to propagate interface updates in every extension file in case we need to add new parameters in the future. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables')
-rw-r--r--iptables/xtables-translate.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c
index 71f13562..678228b2 100644
--- a/iptables/xtables-translate.c
+++ b/iptables/xtables-translate.c
@@ -48,9 +48,14 @@ int xlate_action(const struct iptables_command_state *cs, bool goto_set,
xt_xlate_add(xl, "drop");
else if (strcmp(cs->jumpto, XTC_LABEL_RETURN) == 0)
xt_xlate_add(xl, "return");
- else if (cs->target->xlate)
- ret = cs->target->xlate((const void *)&cs->fw,
- cs->target->t, xl, numeric);
+ else if (cs->target->xlate) {
+ struct xt_xlate_tg_params params = {
+ .ip = (const void *)&cs->fw,
+ .target = cs->target->t,
+ .numeric = numeric,
+ };
+ ret = cs->target->xlate(xl, &params);
+ }
else
return 0;
} else if (strlen(cs->jumpto) > 0) {
@@ -70,11 +75,16 @@ int xlate_matches(const struct iptables_command_state *cs, struct xt_xlate *xl)
int ret = 1, numeric = cs->options & OPT_NUMERIC;
for (matchp = cs->matches; matchp; matchp = matchp->next) {
+ struct xt_xlate_mt_params params = {
+ .ip = (const void *)&cs->fw,
+ .match = matchp->match->m,
+ .numeric = numeric,
+ };
+
if (!matchp->match->xlate)
return 0;
- ret = matchp->match->xlate((const void *)&cs->fw,
- matchp->match->m, xl, numeric);
+ ret = matchp->match->xlate(xl, &params);
if (strcmp(matchp->match->name, "comment") != 0)
xt_xlate_add(xl, " ");