From 7a0992da44cfb6cab0ccd1beadcf326df8773552 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 24 Jul 2016 12:45:53 +0200 Subject: 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 --- iptables/xtables-translate.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'iptables') 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, ¶ms); + } 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, ¶ms); if (strcmp(matchp->match->name, "comment") != 0) xt_xlate_add(xl, " "); -- cgit v1.2.3