]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
src: introduce struct xt_xlate_{mt,tg}_params
authorPablo Neira Ayuso <pablo@netfilter.org>
Sun, 24 Jul 2016 10:45:53 +0000 (12:45 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 25 Jul 2016 15:24:55 +0000 (17:24 +0200)
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>
56 files changed:
configure.ac
extensions/libip6t_DNAT.c
extensions/libip6t_LOG.c
extensions/libip6t_MASQUERADE.c
extensions/libip6t_REDIRECT.c
extensions/libip6t_REJECT.c
extensions/libip6t_SNAT.c
extensions/libip6t_ah.c
extensions/libip6t_frag.c
extensions/libip6t_hbh.c
extensions/libip6t_hl.c
extensions/libip6t_icmp6.c
extensions/libip6t_mh.c
extensions/libip6t_rt.c
extensions/libipt_DNAT.c
extensions/libipt_LOG.c
extensions/libipt_MASQUERADE.c
extensions/libipt_REDIRECT.c
extensions/libipt_REJECT.c
extensions/libipt_SNAT.c
extensions/libipt_ah.c
extensions/libipt_icmp.c
extensions/libipt_realm.c
extensions/libipt_ttl.c
extensions/libxt_CONNMARK.c
extensions/libxt_MARK.c
extensions/libxt_NFLOG.c
extensions/libxt_NFQUEUE.c
extensions/libxt_TEE.c
extensions/libxt_TRACE.c
extensions/libxt_cgroup.c
extensions/libxt_comment.c
extensions/libxt_connlabel.c
extensions/libxt_connmark.c
extensions/libxt_conntrack.c
extensions/libxt_cpu.c
extensions/libxt_dccp.c
extensions/libxt_devgroup.c
extensions/libxt_dscp.c
extensions/libxt_ecn.c
extensions/libxt_esp.c
extensions/libxt_helper.c
extensions/libxt_ipcomp.c
extensions/libxt_iprange.c
extensions/libxt_length.c
extensions/libxt_limit.c
extensions/libxt_mac.c
extensions/libxt_mark.c
extensions/libxt_multiport.c
extensions/libxt_owner.c
extensions/libxt_pkttype.c
extensions/libxt_sctp.c
extensions/libxt_tcp.c
extensions/libxt_udp.c
include/xtables.h
iptables/xtables-translate.c

index b47516bfb343b7097691d4e5aa55891051881654..74bfcd8b909d5ccd77c43e7e50c723ac19313b58 100644 (file)
@@ -2,7 +2,7 @@
 AC_INIT([iptables], [1.6.0])
 
 # See libtool.info "Libtool's versioning system"
-libxtables_vcurrent=11
+libxtables_vcurrent=12
 libxtables_vage=0
 
 AC_CONFIG_AUX_DIR([build-aux])
index 8bd6231b105697316458b6e4e79cb6032c3046bf..3925c3bbb31dedf1b7c500c858507af4d6445a1c 100644 (file)
@@ -252,10 +252,10 @@ static void print_range_xlate(const struct nf_nat_range *range,
        }
 }
 
-static int DNAT_xlate(const void *ip, const struct xt_entry_target *target,
-                     struct xt_xlate *xl, int numeric)
+static int DNAT_xlate(struct xt_xlate *xl,
+                     const struct xt_xlate_tg_params *params)
 {
-       const struct nf_nat_range *range = (const void *)target->data;
+       const struct nf_nat_range *range = (const void *)params->target->data;
        bool sep_need = false;
        const char *sep = " ";
 
index 3c5075e3492cb60898b63de793f3aa40178b1e78..cf5f8df55521f62784cd34bade06dcbacd67b619 100644 (file)
@@ -182,12 +182,12 @@ static const struct ip6t_log_xlate ip6t_log_xlate_names[] = {
        {"warn",        LOG_WARNING }
 };
 
-static int LOG_xlate(const void *ip, const struct xt_entry_target *target,
-                    struct xt_xlate *xl, int numeric)
+static int LOG_xlate(struct xt_xlate *xl,
+                    const struct xt_xlate_tg_params *params)
 {
-       unsigned int i = 0;
        const struct ip6t_log_info *loginfo =
-                       (const struct ip6t_log_info *)target->data;
+               (const struct ip6t_log_info *)params->target->data;
+       unsigned int i = 0;
 
        xt_xlate_add(xl, "log ");
        if (strcmp(loginfo->prefix, "") != 0)
index 15ca14192f442e2c1615cff0abf4c73d85f99eb8..3b59e43ece796b8a5a9205dff43601aeddbc2dc6 100644 (file)
@@ -131,11 +131,10 @@ MASQUERADE_save(const void *ip, const struct xt_entry_target *target)
                printf(" --random");
 }
 
-static int
-MASQUERADE_xlate(const void *ip, const struct xt_entry_target *target,
-                struct xt_xlate *xl, int numeric)
+static int MASQUERADE_xlate(struct xt_xlate *xl,
+                           const struct xt_xlate_tg_params *params)
 {
-       const struct nf_nat_range *r = (const void *)target->data;
+       const struct nf_nat_range *r = (const void *)params->target->data;
 
        xt_xlate_add(xl, "masquerade");
 
index 9c5f14c027aa98af9196017964dc7276efd55c2f..32f85b969a4f4f433654c47cc53b0e9af6266b28 100644 (file)
@@ -132,10 +132,10 @@ static void REDIRECT_save(const void *ip, const struct xt_entry_target *target)
        }
 }
 
-static int REDIRECT_xlate(const void *ip, const struct xt_entry_target *target,
-                         struct xt_xlate *xl, int numeric)
+static int REDIRECT_xlate(struct xt_xlate *xl,
+                         const struct xt_xlate_tg_params *params)
 {
-       const struct nf_nat_range *range = (const void *)target->data;
+       const struct nf_nat_range *range = (const void *)params->target->data;
 
        if (range->flags & NF_NAT_RANGE_PROTO_SPECIFIED) {
                xt_xlate_add(xl, "redirect to %hu",
index 5fa551ecf4bf70f9262b876b70fe594eee0e937f..c5b980d0e5d9e0a92b546f10966df9fcd3ef9410 100644 (file)
@@ -139,11 +139,11 @@ static const struct reject_names_xlate reject_table_xlate[] = {
        {"reject-route",        IP6T_ICMP6_REJECT_ROUTE}
 };
 
-static int REJECT_xlate(const void *ip, const struct xt_entry_target *target,
-                       struct xt_xlate *xl, int numeric)
+static int REJECT_xlate(struct xt_xlate *xl,
+                       const struct xt_xlate_tg_params *params)
 {
        const struct ip6t_reject_info *reject =
-                               (const struct ip6t_reject_info *)target->data;
+               (const struct ip6t_reject_info *)params->target->data;
        unsigned int i;
 
        for (i = 0; i < ARRAY_SIZE(reject_table_xlate); ++i)
index ab7713b5dec043d8d632465e86ead1897ade7fa7..4d742ea8a35034a7f811d525a9373df1efb5c954 100644 (file)
@@ -262,10 +262,10 @@ static void print_range_xlate(const struct nf_nat_range *range,
        }
 }
 
-static int SNAT_xlate(const void *ip, const struct xt_entry_target *target,
-                     struct xt_xlate *xl, int numeric)
+static int SNAT_xlate(struct xt_xlate *xl,
+                     const struct xt_xlate_tg_params *params)
 {
-       const struct nf_nat_range *range = (const void *)target->data;
+       const struct nf_nat_range *range = (const void *)params->target->data;
        bool sep_need = false;
        const char *sep = " ";
 
index 0bac3138c31cca1df3f5cd6ef6938a7c22fd28de..5c2fe558ec4648be501997a82adbfe4050a8ec24 100644 (file)
@@ -128,10 +128,10 @@ static void ah_save(const void *ip, const struct xt_entry_match *match)
                printf(" --ahres");
 }
 
-static int ah_xlate(const void *ip, const struct xt_entry_match *match,
-                   struct xt_xlate *xl, int numeric)
+static int ah_xlate(struct xt_xlate *xl,
+                   const struct xt_xlate_mt_params *params)
 {
-       const struct ip6t_ah *ahinfo = (struct ip6t_ah *)match->data;
+       const struct ip6t_ah *ahinfo = (struct ip6t_ah *)params->match->data;
        char *space = "";
 
        if (!(ahinfo->spis[0] == 0 && ahinfo->spis[1] == 0xFFFFFFFF)) {
index e7a51d377f7591fe84369ad22b5ff8b519c16397..3842496e56a554715523e32fc0327502c6a3b52c 100644 (file)
@@ -173,10 +173,11 @@ static void frag_save(const void *ip, const struct xt_entry_match *match)
                printf(" --fraglast");
 }
 
-static int frag_xlate(const void *ip, const struct xt_entry_match *match,
-                     struct xt_xlate *xl, int numeric)
+static int frag_xlate(struct xt_xlate *xl,
+                     const struct xt_xlate_mt_params *params)
 {
-       const struct ip6t_frag *fraginfo = (struct ip6t_frag *)match->data;
+       const struct ip6t_frag *fraginfo =
+               (struct ip6t_frag *)params->match->data;
        char *space= "";
 
        if (!(fraginfo->ids[0] == 0 && fraginfo->ids[1] == 0xFFFFFFFF)) {
index cb7e4e8a945024e74b3d125ce02e0716ac427100..76b4ff00d4c054f4aabcfbd6db9cbf12a5261207 100644 (file)
@@ -164,10 +164,11 @@ static void hbh_save(const void *ip, const struct xt_entry_match *match)
        print_options(optinfo->optsnr, (uint16_t *)optinfo->opts);
 }
 
-static int hbh_xlate(const void *ip, const struct xt_entry_match *match,
-                    struct xt_xlate *xl, int numeric)
+static int hbh_xlate(struct xt_xlate *xl,
+                    const struct xt_xlate_mt_params *params)
 {
-       const struct ip6t_opts *optinfo = (struct ip6t_opts *)match->data;
+       const struct ip6t_opts *optinfo =
+               (struct ip6t_opts *)params->match->data;
 
        if (!(optinfo->flags & IP6T_OPTS_LEN) ||
            (optinfo->flags & IP6T_OPTS_OPTS))
index 50b47f47deef8fc9f16d6e69adc2aa7cee627e40..37922f6fe0b02f7913d2cc2880153619b122f5cc 100644 (file)
@@ -83,17 +83,18 @@ static void hl_save(const void *ip, const struct xt_entry_match *match)
        printf(" %s %u", op[info->mode], info->hop_limit);
 }
 
-static int hl_xlate(const void *ip, const struct xt_entry_match *match,
-                   struct xt_xlate *xl, int numeric)
-{
-       static const char *const op[] = {
-               [IP6T_HL_EQ] = "",
-               [IP6T_HL_NE] = "!= ",
-               [IP6T_HL_LT] = "lt ",
-               [IP6T_HL_GT] = "gt " };
+static const char *const op[] = {
+       [IP6T_HL_EQ] = "",
+       [IP6T_HL_NE] = "!= ",
+       [IP6T_HL_LT] = "lt ",
+       [IP6T_HL_GT] = "gt "
+};
 
+static int hl_xlate(struct xt_xlate *xl,
+                   const struct xt_xlate_mt_params *params)
+{
        const struct ip6t_hl_info *info =
-               (struct ip6t_hl_info *) match->data;
+               (struct ip6t_hl_info *) params->match->data;
 
        xt_xlate_add(xl, "ip6 hoplimit %s%u", op[info->mode], info->hop_limit);
 
index ddb167373fb062c84e6650efbc9abc55bdf353c3..b49a241d9b84077e75f6f62a9fc9b59441f046fc 100644 (file)
@@ -271,10 +271,10 @@ static unsigned int type_xlate_print(struct xt_xlate *xl, unsigned int icmptype,
        return 1;
 }
 
-static int icmp6_xlate(const void *ip, const struct xt_entry_match *match,
-                      struct xt_xlate *xl, int numeric)
+static int icmp6_xlate(struct xt_xlate *xl,
+                      const struct xt_xlate_mt_params *params)
 {
-       const struct ip6t_icmp *info = (struct ip6t_icmp *)match->data;
+       const struct ip6t_icmp *info = (struct ip6t_icmp *)params->match->data;
 
        xt_xlate_add(xl, "icmpv6 type%s ",
                     (info->invflags & IP6T_ICMP_INV) ? " !=" : "");
index 4cf20c29095d97b4a664b0237fd284968758809d..f4c0fd9fc0bca48d77437970a97c4ddfb4b31586 100644 (file)
@@ -202,10 +202,10 @@ static void mh_save(const void *ip, const struct xt_entry_match *match)
                printf(" --mh-type %u", mhinfo->types[0]);
 }
 
-static int mh_xlate(const void *ip, const struct xt_entry_match *match,
-                   struct xt_xlate *xl, int numeric)
+static int mh_xlate(struct xt_xlate *xl,
+                   const struct xt_xlate_mt_params *params)
 {
-       const struct ip6t_mh *mhinfo = (struct ip6t_mh *)match->data;
+       const struct ip6t_mh *mhinfo = (struct ip6t_mh *)params->match->data;
 
        if (mhinfo->types[0] == 0 && mhinfo->types[1] == 0xff)
                return 1;
index 81e222e664d36c9327ad411f0e338d9e6b967984..3cb3b249d89954fc34a7dc404d1aaeb1d5349b0e 100644 (file)
@@ -245,10 +245,10 @@ static void rt_save(const void *ip, const struct xt_entry_match *match)
 
 }
 
-static int rt_xlate(const void *ip, const struct xt_entry_match *match,
-                   struct xt_xlate *xl, int numeric)
+static int rt_xlate(struct xt_xlate *xl,
+                   const struct xt_xlate_mt_params *params)
 {
-       const struct ip6t_rt *rtinfo = (struct ip6t_rt *)match->data;
+       const struct ip6t_rt *rtinfo = (struct ip6t_rt *)params->match->data;
        char *space = "";
 
        if (rtinfo->flags & IP6T_RT_TYP) {
index 79f50249e1f4187e87e324fffbe04ddf52dc3580..c463f071b3825344ff73fd261f0e966e5eb7212d 100644 (file)
@@ -262,10 +262,10 @@ static void print_range_xlate(const struct nf_nat_ipv4_range *r,
        }
 }
 
-static int DNAT_xlate(const void *ip, const struct xt_entry_target *target,
-                     struct xt_xlate *xl, int numeric)
+static int DNAT_xlate(struct xt_xlate *xl,
+                     const struct xt_xlate_tg_params *params)
 {
-       const struct ipt_natinfo *info = (const void *)target;
+       const struct ipt_natinfo *info = (const void *)params->target->data;
        unsigned int i = 0;
        bool sep_need = false;
        const char *sep = " ";
index f81eb8df3f31034712825ac613967d6cb66b770d..996dfb60dd44c55e035db2ffe8fe3afcefafde09 100644 (file)
@@ -182,12 +182,12 @@ static const struct ipt_log_xlate ipt_log_xlate_names[] = {
        {"warn",        LOG_WARNING }
 };
 
-static int LOG_xlate(const void *ip, const struct xt_entry_target *target,
-                    struct xt_xlate *xl, int numeric)
+static int LOG_xlate(struct xt_xlate *xl,
+                    const struct xt_xlate_tg_params *params)
 {
-       unsigned int i = 0;
        const struct ipt_log_info *loginfo =
-                       (const struct ipt_log_info *)target->data;
+               (const struct ipt_log_info *)params->target->data;
+       unsigned int i = 0;
 
        xt_xlate_add(xl, "log ");
        if (strcmp(loginfo->prefix, "") != 0)
index 2d11fa950081521d23880f02c9de81dd65c93f60..b7b5fc746f9e16c93ffb251424bf34c779dd5b34 100644 (file)
@@ -134,12 +134,11 @@ MASQUERADE_save(const void *ip, const struct xt_entry_target *target)
                printf(" --random");
 }
 
-static int
-MASQUERADE_xlate(const void *ip, const struct xt_entry_target *target,
-                struct xt_xlate *xl, int numeric)
+static int MASQUERADE_xlate(struct xt_xlate *xl,
+                           const struct xt_xlate_tg_params *params)
 {
        const struct nf_nat_ipv4_multi_range_compat *mr =
-                                       (const void *)target->data;
+               (const void *)params->target->data;
        const struct nf_nat_ipv4_range *r = &mr->range[0];
 
        xt_xlate_add(xl, "masquerade");
index 1ffb3ddadd7a74957329abbc643c9d3b93da66c1..31ca88c3ea937deb4652d2c9659a9ad7f65ad276 100644 (file)
@@ -135,11 +135,11 @@ static void REDIRECT_save(const void *ip, const struct xt_entry_target *target)
        }
 }
 
-static int REDIRECT_xlate(const void *ip, const struct xt_entry_target *target,
-                         struct xt_xlate *xl, int numeric)
+static int REDIRECT_xlate(struct xt_xlate *xl,
+                         const struct xt_xlate_tg_params *params)
 {
        const struct nf_nat_ipv4_multi_range_compat *mr =
-                                       (const void *)target->data;
+               (const void *)params->target->data;
        const struct nf_nat_ipv4_range *r = &mr->range[0];
 
        if (r->flags & NF_NAT_RANGE_PROTO_SPECIFIED) {
index c211da91cbe4c0f05dc9d1a8c89c0a3a70b8b544..ba815bae23252f77245be7c3bc95edf0cbdb42d6 100644 (file)
@@ -159,11 +159,11 @@ static const struct reject_names_xlate reject_table_xlate[] = {
        {"admin-prohibited",    IPT_ICMP_ADMIN_PROHIBITED}
 };
 
-static int REJECT_xlate(const void *ip, const struct xt_entry_target *target,
-                       struct xt_xlate *xl, int numeric)
+static int REJECT_xlate(struct xt_xlate *xl,
+                       const struct xt_xlate_tg_params *params)
 {
        const struct ipt_reject_info *reject =
-               (const struct ipt_reject_info *)target->data;
+               (const struct ipt_reject_info *)params->target->data;
        unsigned int i;
 
        for (i = 0; i < ARRAY_SIZE(reject_table_xlate); ++i) {
index 6613316e4b722058fdccf5d0bf37b07459fc0b67..71717fd8e48d4968dea77e392b48c3541dc25302 100644 (file)
@@ -273,10 +273,10 @@ static void print_range_xlate(const struct nf_nat_ipv4_range *r,
        }
 }
 
-static int SNAT_xlate(const void *ip, const struct xt_entry_target *target,
-                     struct xt_xlate *xl, int numeric)
+static int SNAT_xlate(struct xt_xlate *xl,
+                     const struct xt_xlate_tg_params *params)
 {
-       const struct ipt_natinfo *info = (const void *)target;
+       const struct ipt_natinfo *info = (const void *)params->target->data;
        unsigned int i = 0;
        bool sep_need = false;
        const char *sep = " ";
index 7dff93d628c43a57aadd187e31623a9cd6ffe020..fec5705ce6f53e90ac4f0dca091b3da1a12c7e5e 100644 (file)
@@ -92,10 +92,10 @@ static void ah_save(const void *ip, const struct xt_entry_match *match)
 
 }
 
-static int ah_xlate(const void *ip, const struct xt_entry_match *match,
-                   struct xt_xlate *xl, int numeric)
+static int ah_xlate(struct xt_xlate *xl,
+                   const struct xt_xlate_mt_params *params)
 {
-       const struct ipt_ah *ahinfo = (struct ipt_ah *)match->data;
+       const struct ipt_ah *ahinfo = (struct ipt_ah *)params->match->data;
 
        if (!(ahinfo->spis[0] == 0 && ahinfo->spis[1] == 0xFFFFFFFF)) {
                xt_xlate_add(xl, "ah spi%s ",
index 342659e3d9385d516221058e68bdc0839a954451..680a5b0ceb89c6aab8b7f3909a5b8c6f6247df06 100644 (file)
@@ -268,10 +268,10 @@ static unsigned int type_xlate_print(struct xt_xlate *xl, unsigned int icmptype,
        return 0;
 }
 
-static int icmp_xlate(const void *ip, const struct xt_entry_match *match,
-                     struct xt_xlate *xl, int numeric)
+static int icmp_xlate(struct xt_xlate *xl,
+                     const struct xt_xlate_mt_params *params)
 {
-       const struct ipt_icmp *info = (struct ipt_icmp *)match->data;
+       const struct ipt_icmp *info = (struct ipt_icmp *)params->match->data;
 
        if (info->type != 0xFF) {
                xt_xlate_add(xl, "icmp type%s ",
index b5c9032b2df2c7ab4715f1492c90f5dfda336302..fd0622ada9e046d5842426756d8490dff61cccf5 100644 (file)
@@ -129,10 +129,10 @@ print_realm_xlate(unsigned long id, unsigned long mask,
        }
 }
 
-static int realm_xlate(const void *ip, const struct xt_entry_match *match,
-                      struct xt_xlate *xl, int numeric)
+static int realm_xlate(struct xt_xlate *xl,
+                      const struct xt_xlate_mt_params *params)
 {
-       const struct xt_realm_info *ri = (const void *)match->data;
+       const struct xt_realm_info *ri = (const void *)params->match->data;
        enum xt_op op = XT_OP_EQ;
 
        if (ri->invert)
index e1db0df75a75c4bf299f87a2ac40789e2d41c5b6..6bdd2196180913ee632a071a69cd7eb1c0ff9fbc 100644 (file)
@@ -100,11 +100,11 @@ static void ttl_save(const void *ip, const struct xt_entry_match *match)
        printf(" %u", info->ttl);
 }
 
-static int ttl_xlate(const void *ip, const struct xt_entry_match *match,
-                    struct xt_xlate *xl, int numeric)
+static int ttl_xlate(struct xt_xlate *xl,
+                    const struct xt_xlate_mt_params *params)
 {
        const struct ipt_ttl_info *info =
-                       (struct ipt_ttl_info *) match->data;
+               (struct ipt_ttl_info *) params->match->data;
 
                switch (info->mode) {
                case IPT_TTL_EQ:
index 358facf411c42a417b223cbae053ee7d725bca63..f60be58346a5ea44b7feac447a386b411001b377 100644 (file)
@@ -347,11 +347,11 @@ connmark_tg_save(const void *ip, const struct xt_entry_target *target)
        }
 }
 
-static int
-connmark_tg_xlate(const void *ip, const struct xt_entry_target *target,
-                 struct xt_xlate *xl, int numeric)
+static int connmark_tg_xlate(struct xt_xlate *xl,
+                            const struct xt_xlate_tg_params *params)
 {
-       const struct xt_connmark_tginfo1 *info = (const void *)target->data;
+       const struct xt_connmark_tginfo1 *info =
+               (const void *)params->target->data;
 
        switch (info->mode) {
        case XT_CONNMARK_SET:
index c7b179437f46bcacffae7377d8d58bf495527913..c2f15e3bb0c56642c22e238a6457f3ac108b8514 100644 (file)
@@ -245,10 +245,10 @@ static void mark_tg_save(const void *ip, const struct xt_entry_target *target)
        printf(" --set-xmark 0x%x/0x%x", info->mark, info->mask);
 }
 
-static int mark_tg_xlate(const void *ip, const struct xt_entry_target *target,
-                        struct xt_xlate *xl, int numeric)
+static int mark_tg_xlate(struct xt_xlate *xl,
+                        const struct xt_xlate_tg_params *params)
 {
-       const struct xt_mark_tginfo2 *info = (const void *)target->data;
+       const struct xt_mark_tginfo2 *info = (const void *)params->target->data;
 
        xt_xlate_add(xl, "meta mark set ");
 
@@ -267,11 +267,11 @@ static int mark_tg_xlate(const void *ip, const struct xt_entry_target *target,
        return 1;
 }
 
-static int MARK_xlate(const void *ip, const struct xt_entry_target *target,
-                        struct xt_xlate *xl, int numeric)
+static int MARK_xlate(struct xt_xlate *xl,
+                     const struct xt_xlate_tg_params *params)
 {
        const struct xt_mark_target_info_v1 *markinfo =
-               (const struct xt_mark_target_info_v1 *)target->data;
+               (const struct xt_mark_target_info_v1 *)params->target->data;
 
        xt_xlate_add(xl, "meta mark set ");
 
index dad83f6e8e74e4b3c61463815fc668b2979e510e..e6d627af6a2647ad37aa10ffc663f96d5ab8aea7 100644 (file)
@@ -119,10 +119,11 @@ static void nflog_print_xlate(const struct xt_nflog_info *info,
        xt_xlate_add(xl, "group %u ", info->group);
 }
 
-static int NFLOG_xlate(const void *ip, const struct xt_entry_target *target,
-                      struct xt_xlate *xl, int numeric)
+static int NFLOG_xlate(struct xt_xlate *xl,
+                      const struct xt_xlate_tg_params *params)
 {
-       const struct xt_nflog_info *info = (struct xt_nflog_info *)target->data;
+       const struct xt_nflog_info *info =
+               (struct xt_nflog_info *)params->target->data;
 
        nflog_print_xlate(info, xl);
 
index e8b81b60a9cbdb0f7a38b84a931ae78655c89983..fe5190789e306e65c0a8b54918fb89c59b8da500 100644 (file)
@@ -270,22 +270,21 @@ static void NFQUEUE_init_v1(struct xt_entry_target *t)
        tinfo->queues_total = 1;
 }
 
-static int NFQUEUE_xlate(const void *ip, const struct xt_entry_target *target,
-                        struct xt_xlate *xl, int numeric)
+static int NFQUEUE_xlate(struct xt_xlate *xl,
+                        const struct xt_xlate_tg_params *params)
 {
        const struct xt_NFQ_info *tinfo =
-               (const struct xt_NFQ_info *)target->data;
+               (const struct xt_NFQ_info *)params->target->data;
 
        xt_xlate_add(xl, "queue num %u ", tinfo->queuenum);
 
        return 1;
 }
 
-static int NFQUEUE_xlate_v1(const void *ip,
-                           const struct xt_entry_target *target,
-                           struct xt_xlate *xl, int numeric)
+static int NFQUEUE_xlate_v1(struct xt_xlate *xl,
+                           const struct xt_xlate_tg_params *params)
 {
-       const struct xt_NFQ_info_v1 *tinfo = (const void *)target->data;
+       const struct xt_NFQ_info_v1 *tinfo = (const void *)params->target->data;
        unsigned int last = tinfo->queues_total;
 
        if (last > 1) {
@@ -298,11 +297,10 @@ static int NFQUEUE_xlate_v1(const void *ip,
        return 1;
 }
 
-static int NFQUEUE_xlate_v2(const void *ip,
-                           const struct xt_entry_target *target,
-                           struct xt_xlate *xl, int numeric)
+static int NFQUEUE_xlate_v2(struct xt_xlate *xl,
+                           const struct xt_xlate_tg_params *params)
 {
-       const struct xt_NFQ_info_v2 *info = (void *) target->data;
+       const struct xt_NFQ_info_v2 *info = (void *)params->target->data;
        unsigned int last = info->queues_total;
 
        if (last > 1) {
@@ -317,11 +315,10 @@ static int NFQUEUE_xlate_v2(const void *ip,
        return 1;
 }
 
-static int NFQUEUE_xlate_v3(const void *ip,
-                           const struct xt_entry_target *target,
-                           struct xt_xlate *xl, int numeric)
+static int NFQUEUE_xlate_v3(struct xt_xlate *xl,
+                           const struct xt_xlate_tg_params *params)
 {
-       const struct xt_NFQ_info_v3 *info = (void *)target->data;
+       const struct xt_NFQ_info_v3 *info = (void *)params->target->data;
        unsigned int last = info->queues_total;
 
        if (last > 1) {
index 5044a34cd20206b3d7957f4fae8e334ae622bdba..4676e33b885962713ce9cbc33431674903600a78 100644 (file)
@@ -92,13 +92,12 @@ static void tee_tg6_save(const void *ip, const struct xt_entry_target *target)
                printf(" --oif %s", info->oif);
 }
 
-static int tee_tg_xlate(const void *ip, const struct xt_entry_target *target,
-                       struct xt_xlate *xl, int numeric)
+static int tee_tg_xlate(struct xt_xlate *xl,
+                       const struct xt_xlate_tg_params *params)
 {
-       const struct xt_tee_tginfo *info =
-               (const void *)target->data;
+       const struct xt_tee_tginfo *info = (const void *)params->target->data;
 
-       if (numeric)
+       if (params->numeric)
                xt_xlate_add(xl, "dup to %s",
                             xtables_ipaddr_to_numeric(&info->gw.in));
        else
@@ -110,12 +109,12 @@ static int tee_tg_xlate(const void *ip, const struct xt_entry_target *target,
        return 1;
 }
 
-static int tee_tg6_xlate(const void *ip, const struct xt_entry_target *target,
-                        struct xt_xlate *xl, int numeric)
+static int tee_tg6_xlate(struct xt_xlate *xl,
+                        const struct xt_xlate_tg_params *params)
 {
-       const struct xt_tee_tginfo *info = (const void *)target->data;
+       const struct xt_tee_tginfo *info = (const void *)params->target->data;
 
-       if (numeric)
+       if (params->numeric)
                xt_xlate_add(xl, "dup to %s",
                             xtables_ip6addr_to_numeric(&info->gw.in6));
        else
index 7cb3585b37c14df68280408bfc2a4058986e670e..ac4f6fab0a6a7c23dfacb9abd3daea7b0b2cb2d7 100644 (file)
@@ -7,8 +7,8 @@
 #include <xtables.h>
 #include <linux/netfilter/x_tables.h>
 
-static int trace_xlate(const void *ip, const struct xt_entry_target *target,
-                      struct xt_xlate *xl, int numeric)
+static int trace_xlate(struct xt_xlate *xl,
+                      const struct xt_xlate_tg_params *params)
 {
        xt_xlate_add(xl, "nftrace set 1");
        return 1;
index fcd77c3f5aa939aeb75b347851151f20b2b9ee07..480d64c9cab425045e46232e616d574ca5a6aba9 100644 (file)
@@ -121,20 +121,20 @@ static void cgroup_save_v1(const void *ip, const struct xt_entry_match *match)
                       info->classid);
 }
 
-static int cgroup_xlate_v0(const void *ip, const struct xt_entry_match *match,
-                          struct xt_xlate *xl, int numeric)
+static int cgroup_xlate_v0(struct xt_xlate *xl,
+                          const struct xt_xlate_mt_params *params)
 {
-       const struct xt_cgroup_info_v0 *info = (void *)match->data;
+       const struct xt_cgroup_info_v0 *info = (void *)params->match->data;
 
        xt_xlate_add(xl, "meta cgroup %s%u", info->invert ? "!= " : "",
                     info->id);
        return 1;
 }
 
-static int cgroup_xlate_v1(const void *ip, const struct xt_entry_match *match,
-                          struct xt_xlate *xl, int numeric)
+static int cgroup_xlate_v1(struct xt_xlate *xl,
+                          const struct xt_xlate_mt_params *params)
 {
-       const struct xt_cgroup_info_v1 *info = (void *)match->data;
+       const struct xt_cgroup_info_v1 *info = (void *)params->match->data;
 
        if (info->has_path)
                return 0;
index ab229e0b6f9c53f861cdc6e9b416140ef4e7056c..0e31eddf612b5146c9e321188719865f227dff81 100644 (file)
@@ -48,11 +48,10 @@ comment_save(const void *ip, const struct xt_entry_match *match)
        xtables_save_string(commentinfo->comment);
 }
 
-static int
-comment_xlate(const void *ip, const struct xt_entry_match *match,
-             struct xt_xlate *xl, int numeric)
+static int comment_xlate(struct xt_xlate *xl,
+                        const struct xt_xlate_mt_params *params)
 {
-       struct xt_comment_info *commentinfo = (void *)match->data;
+       struct xt_comment_info *commentinfo = (void *)params->match->data;
 
        commentinfo->comment[XT_MAX_COMMENT_LEN - 1] = '\0';
        xt_xlate_add_comment(xl, commentinfo->comment);
index 7e4ff262f276d02b311ef8b9a034f57b40a01baf..f6856453e4e33994ac7eddb1146b75813b464994 100644 (file)
@@ -125,11 +125,11 @@ connlabel_mt_save(const void *ip, const struct xt_entry_match *match)
        connlabel_mt_print_op(info, "--");
 }
 
-static int
-connlabel_mt_xlate(const void *ip, const struct xt_entry_match *match,
-                  struct xt_xlate *xl, int numeric)
+static int connlabel_mt_xlate(struct xt_xlate *xl,
+                             const struct xt_xlate_mt_params *params)
 {
-       const struct xt_connlabel_mtinfo *info = (const void *)match->data;
+       const struct xt_connlabel_mtinfo *info =
+               (const void *)params->match->data;
        const char *name = connlabel_get_name(info->bit);
 
        if (name == NULL)
index 1630858337521b3e486abd97d98e70b20b08e7b9..be3499b6ae01fb7ccc0a80b9e55d87f74caab36b 100644 (file)
@@ -134,10 +134,10 @@ static void print_mark_xlate(unsigned int mark, unsigned int mask,
                           op == XT_OP_EQ ? "" : "!= ", mark);
 }
 
-static int connmark_xlate(const void *ip, const struct xt_entry_match *match,
-                         struct xt_xlate *xl, int numeric)
+static int connmark_xlate(struct xt_xlate *xl,
+                         const struct xt_xlate_mt_params *params)
 {
-       const struct xt_connmark_info *info = (const void *)match->data;
+       const struct xt_connmark_info *info = (const void *)params->match->data;
        enum xt_op op = XT_OP_EQ;
 
        if (info->invert)
@@ -150,10 +150,11 @@ static int connmark_xlate(const void *ip, const struct xt_entry_match *match,
 }
 
 static int
-connmark_mt_xlate(const void *ip, const struct xt_entry_match *match,
-                 struct xt_xlate *xl, int numeric)
+connmark_mt_xlate(struct xt_xlate *xl,
+                 const struct xt_xlate_mt_params *params)
 {
-       const struct xt_connmark_mtinfo1 *info = (const void *)match->data;
+       const struct xt_connmark_mtinfo1 *info =
+               (const void *)params->match->data;
        enum xt_op op = XT_OP_EQ;
 
        if (info->invert)
index 4f3853c0319f5f8a01e0a5435ccedc837b113f3c..72c522004a7ea405a711567b6d643fe865b9581e 100644 (file)
@@ -1182,10 +1182,11 @@ static void state_xlate_print(struct xt_xlate *xl, unsigned int statemask)
        }
 }
 
-static int state_xlate(const void *ip, const struct xt_entry_match *match,
-                      struct xt_xlate *xl, int numeric)
+static int state_xlate(struct xt_xlate *xl,
+                      const struct xt_xlate_mt_params *params)
 {
-       const struct xt_conntrack_mtinfo3 *sinfo = (const void *)match->data;
+       const struct xt_conntrack_mtinfo3 *sinfo =
+               (const void *)params->match->data;
 
        xt_xlate_add(xl, "ct state %s", sinfo->invert_flags & XT_CONNTRACK_STATE ?
                                        "!= " : "");
@@ -1230,12 +1231,12 @@ static void addr_xlate_print(struct xt_xlate *xl,
        }
 }
 
-static int _conntrack3_mt_xlate(const void *ip,
-                               const struct xt_entry_match *match,
-                               struct xt_xlate *xl, int numeric,
+static int _conntrack3_mt_xlate(struct xt_xlate *xl,
+                               const struct xt_xlate_mt_params *params,
                                int family)
 {
-       const struct xt_conntrack_mtinfo3 *sinfo = (const void *)match->data;
+       const struct xt_conntrack_mtinfo3 *sinfo =
+               (const void *)params->match->data;
        char *space = "";
 
        if (sinfo->match_flags & XT_CONNTRACK_DIRECTION) {
@@ -1383,18 +1384,16 @@ static int _conntrack3_mt_xlate(const void *ip,
        return 1;
 }
 
-static int conntrack3_mt4_xlate(const void *ip,
-                               const struct xt_entry_match *match,
-                               struct xt_xlate *xl, int numeric)
+static int conntrack3_mt4_xlate(struct xt_xlate *xl,
+                               const struct xt_xlate_mt_params *params)
 {
-       return _conntrack3_mt_xlate(ip, match, xl, numeric, NFPROTO_IPV4);
+       return _conntrack3_mt_xlate(xl, params, NFPROTO_IPV4);
 }
 
-static int conntrack3_mt6_xlate(const void *ip,
-                               const struct xt_entry_match *match,
-                               struct xt_xlate *xl, int numeric)
+static int conntrack3_mt6_xlate(struct xt_xlate *xl,
+                               const struct xt_xlate_mt_params *params)
 {
-       return _conntrack3_mt_xlate(ip, match, xl, numeric, NFPROTO_IPV6);
+       return _conntrack3_mt_xlate(xl, params, NFPROTO_IPV6);
 }
 
 static struct xtables_match conntrack_mt_reg[] = {
index 97927fae6e8fb460676bfa51b4f0f8138c5b7311..41c13c3c989b5c942dd66d08bdfa0184314a3af7 100644 (file)
@@ -44,10 +44,10 @@ static void cpu_save(const void *ip, const struct xt_entry_match *match)
        printf("%s --cpu %u", info->invert ? " !" : "", info->cpu);
 }
 
-static int cpu_xlate(const void *ip, const struct xt_entry_match *match,
-                    struct xt_xlate *xl, int numeric)
+static int cpu_xlate(struct xt_xlate *xl,
+                    const struct xt_xlate_mt_params *params)
 {
-       const struct xt_cpu_info *info = (void *)match->data;
+       const struct xt_cpu_info *info = (void *)params->match->data;
 
        xt_xlate_add(xl, "cpu%s %u", info->invert ? " !=" : "", info->cpu);
 
index 179261f91f298fa617b8392901c184b295f052ff..5e67c264db2a965e26b6c490ef7cfb5f1b092dcd 100644 (file)
@@ -327,13 +327,13 @@ static int dccp_type_xlate(const struct xt_dccp_info *einfo,
        return 1;
 }
 
-static int dccp_xlate(const void *ip, const struct xt_entry_match *match,
-                     struct xt_xlate *xl, int numeric)
+static int dccp_xlate(struct xt_xlate *xl,
+                     const struct xt_xlate_mt_params *params)
 {
        const struct xt_dccp_info *einfo =
-                       (const struct xt_dccp_info *)match->data;
-       int ret = 1;
+               (const struct xt_dccp_info *)params->match->data;
        char *space = "";
+       int ret = 1;
 
        xt_xlate_add(xl, "dccp ");
 
index 41dae2f870dad856973960051515197e56357758..d1556802de7b0592c8d18ac5b2d68d75d8f41c3c 100644 (file)
@@ -195,10 +195,10 @@ static void devgroup_show_xlate(const struct xt_devgroup_info *info,
        }
 }
 
-static int devgroup_xlate(const void *ip, const struct xt_entry_match *match,
-                         struct xt_xlate *xl, int numeric)
+static int devgroup_xlate(struct xt_xlate *xl,
+                         const struct xt_xlate_mt_params *params)
 {
-       const struct xt_devgroup_info *info = (const void *)match->data;
+       const struct xt_devgroup_info *info = (const void *)params->match->data;
 
        devgroup_show_xlate(info, xl, 0);
 
index 17433ef8e703a0dc130b0d72e0650a4a6ebc3dba..d5c732363bd223c19c38618ae13b56734bb6afea 100644 (file)
@@ -91,11 +91,11 @@ static void dscp_save(const void *ip, const struct xt_entry_match *match)
        printf("%s --dscp 0x%02x", dinfo->invert ? " !" : "", dinfo->dscp);
 }
 
-static int __dscp_xlate(const void *ip, const struct xt_entry_match *match,
-                     struct xt_xlate *xl, int numeric)
+static int __dscp_xlate(struct xt_xlate *xl,
+                       const struct xt_xlate_mt_params *params)
 {
        const struct xt_dscp_info *dinfo =
-               (const struct xt_dscp_info *)match->data;
+               (const struct xt_dscp_info *)params->match->data;
 
        xt_xlate_add(xl, "dscp %s0x%02x", dinfo->invert ? "!= " : "",
                     dinfo->dscp);
@@ -103,20 +103,20 @@ static int __dscp_xlate(const void *ip, const struct xt_entry_match *match,
        return 1;
 }
 
-static int dscp_xlate(const void *ip, const struct xt_entry_match *match,
-                     struct xt_xlate *xl, int numeric)
+static int dscp_xlate(struct xt_xlate *xl,
+                     const struct xt_xlate_mt_params *params)
 {
        xt_xlate_add(xl, "ip ");
 
-       return __dscp_xlate(ip, match, xl, numeric);
+       return __dscp_xlate(xl, params);
 }
 
-static int dscp_xlate6(const void *ip, const struct xt_entry_match *match,
-                     struct xt_xlate *xl, int numeric)
+static int dscp_xlate6(struct xt_xlate *xl,
+                      const struct xt_xlate_mt_params *params)
 {
        xt_xlate_add(xl, "ip6 ");
 
-       return __dscp_xlate(ip, match, xl, numeric);
+       return __dscp_xlate(xl, params);
 }
 
 static struct xtables_match dscp_mt_reg[] = {
index 969920dd425250ac4920ccf33898535690720ab7..aeba01b348a1f04631684ae6fde8feaf7900f45b 100644 (file)
@@ -118,11 +118,11 @@ static void ecn_save(const void *ip, const struct xt_entry_match *match)
        }
 }
 
-static int ecn_xlate(const void *ip, const struct xt_entry_match *match,
-                    struct xt_xlate *xl, int numeric)
+static int ecn_xlate(struct xt_xlate *xl,
+                    const struct xt_xlate_mt_params *params)
 {
        const struct xt_ecn_info *einfo =
-               (const struct xt_ecn_info *)match->data;
+               (const struct xt_ecn_info *)params->match->data;
 
        if (!(einfo->operation & XT_ECN_OP_MATCH_IP))
                return 0;
index 5e8c58d3d01bacaeaf807eb8b67cc57ad6be2de4..2c7ff942cb9e0f649a6090280859437dbb94a3d6 100644 (file)
@@ -86,10 +86,10 @@ static void esp_save(const void *ip, const struct xt_entry_match *match)
 
 }
 
-static int esp_xlate(const void *ip, const struct xt_entry_match *match,
-                    struct xt_xlate *xl, int numeric)
+static int esp_xlate(struct xt_xlate *xl,
+                    const struct xt_xlate_mt_params *params)
 {
-       const struct xt_esp *espinfo = (struct xt_esp *)match->data;
+       const struct xt_esp *espinfo = (struct xt_esp *)params->match->data;
 
        if (!(espinfo->spis[0] == 0 && espinfo->spis[1] == 0xFFFFFFFF)) {
                xt_xlate_add(xl, "esp spi%s",
index 26e956953d85d476341e0f030051300d0fe051e1..6860127b83ed9cb0fb2bbad6ee044e767379f990 100644 (file)
@@ -45,10 +45,10 @@ static void helper_save(const void *ip, const struct xt_entry_match *match)
        xtables_save_string(info->name);
 }
 
-static int helper_xlate(const void *ip, const struct xt_entry_match *match,
-                       struct xt_xlate *xl, int numeric)
+static int helper_xlate(struct xt_xlate *xl,
+                       const struct xt_xlate_mt_params *params)
 {
-       const struct xt_helper_info *info = (const void *)match->data;
+       const struct xt_helper_info *info = (const void *)params->match->data;
 
        xt_xlate_add(xl, "ct helper%s \\\"%s\\\"",
                   info->invert ? " !=" : "", info->name);
index 5e72154486f151b33e5c4097f560e1cf2aeb0195..9f7c0ef55ab0345990bfb323987b2f592b2390aa 100644 (file)
@@ -95,10 +95,11 @@ static void comp_save(const void *ip, const struct xt_entry_match *match)
                printf(" --compres");
 }
 
-static int comp_xlate(const void *ip, const struct xt_entry_match *match,
-                       struct xt_xlate *xl, int numeric)
+static int comp_xlate(struct xt_xlate *xl,
+                     const struct xt_xlate_mt_params *params)
 {
-       const struct xt_ipcomp *compinfo = (struct xt_ipcomp *)match->data;
+       const struct xt_ipcomp *compinfo =
+               (struct xt_ipcomp *)params->match->data;
 
        xt_xlate_add(xl, "comp cpi %s%u",
                     (compinfo->invflags & XT_IPCOMP_INV_SPI) ? "!= " : "",
index d68df480062d843525d62d8853fed19f7206f213..9e6f5555a5c8a53b86466bd9d12a66bb3067a40f 100644 (file)
@@ -315,10 +315,10 @@ print_iprange_xlate(const struct ipt_iprange *range,
                   byte_max[0], byte_max[1], byte_max[2], byte_max[3]);
 }
 
-static int iprange_xlate(const void *ip, const struct xt_entry_match *match,
-                        struct xt_xlate *xl, int numeric)
+static int iprange_xlate(struct xt_xlate *xl,
+                        const struct xt_xlate_mt_params *params)
 {
-       const struct ipt_iprange_info *info = (const void *)match->data;
+       const struct ipt_iprange_info *info = (const void *)params->match->data;
        char *space = "";
 
        if (info->flags & IPRANGE_SRC) {
@@ -340,10 +340,11 @@ static int iprange_xlate(const void *ip, const struct xt_entry_match *match,
        return 1;
 }
 
-static int iprange_mt4_xlate(const void *ip, const struct xt_entry_match *match,
-                            struct xt_xlate *xl, int numeric)
+static int iprange_mt4_xlate(struct xt_xlate *xl,
+                            const struct xt_xlate_mt_params *params)
 {
-       const struct xt_iprange_mtinfo *info = (const void *)match->data;
+       const struct xt_iprange_mtinfo *info =
+               (const void *)params->match->data;
        char *space = "";
 
        if (info->flags & IPRANGE_SRC) {
@@ -369,10 +370,11 @@ static int iprange_mt4_xlate(const void *ip, const struct xt_entry_match *match,
        return 1;
 }
 
-static int iprange_mt6_xlate(const void *ip, const struct xt_entry_match *match,
-                            struct xt_xlate *xl, int numeric)
+static int iprange_mt6_xlate(struct xt_xlate *xl,
+                            const struct xt_xlate_mt_params *params)
 {
-       const struct xt_iprange_mtinfo *info = (const void *)match->data;
+       const struct xt_iprange_mtinfo *info =
+               (const void *)params->match->data;
        char *space = "";
 
        if (info->flags & IPRANGE_SRC) {
index feb1d2b0cc1ab2e8558a4cbd3125d1b5a62c9ee2..04eac4a517f7bf3a12c51ed1ac9353514aefed6a 100644 (file)
@@ -56,10 +56,10 @@ static void length_save(const void *ip, const struct xt_entry_match *match)
                printf("%u:%u", info->min, info->max);
 }
 
-static int length_xlate(const void *ip, const struct xt_entry_match *match,
-                       struct xt_xlate *xl, int numeric)
+static int length_xlate(struct xt_xlate *xl,
+                       const struct xt_xlate_mt_params *params)
 {
-       const struct xt_length_info *info = (void *)match->data;
+       const struct xt_length_info *info = (void *)params->match->data;
 
        xt_xlate_add(xl, "meta length %s", info->invert ? "!= " : "");
        if (info->min == info->max)
index c82d4df48f0fd91fa6cba988677778cc3857a3f2..5cc95c2ebcaf8cc895e8896d9a79cdc89ea5e9a1 100644 (file)
@@ -177,10 +177,10 @@ static void print_rate_xlate(uint32_t period, struct xt_xlate *xl)
                   rates_xlate[i - 1].name);
 }
 
-static int limit_xlate(const void *ip, const struct xt_entry_match *match,
-                      struct xt_xlate *xl, int numeric)
+static int limit_xlate(struct xt_xlate *xl,
+                      const struct xt_xlate_mt_params *params)
 {
-       const struct xt_rateinfo *r = (const void *)match->data;
+       const struct xt_rateinfo *r = (const void *)params->match->data;
 
        xt_xlate_add(xl, "limit rate");
        print_rate_xlate(r->avg, xl);
index 251134ad469788a5ef4d6d546b305c1fd41c6354..b6d717bcf86f093880457768bd10d8aabf38fff2 100644 (file)
@@ -80,10 +80,10 @@ static void print_mac_xlate(const unsigned char *macaddress,
                xt_xlate_add(xl, ":%02x", macaddress[i]);
 }
 
-static int mac_xlate(const void *ip, const struct xt_entry_match *match,
-                    struct xt_xlate *xl, int numeric)
+static int mac_xlate(struct xt_xlate *xl,
+                    const struct xt_xlate_mt_params *params)
 {
-       const struct xt_mac_info *info = (void *)match->data;
+       const struct xt_mac_info *info = (void *)params->match->data;
 
        xt_xlate_add(xl, "ether saddr%s ", info->invert ? " !=" : "");
        print_mac_xlate(info->srcaddr, xl);
index 3711ec3bc46e52c2568804c7ce608e1ac2e3724b..e1d00de9378a4ee9e6fb849c5cb0e50cbc6502b0 100644 (file)
@@ -114,11 +114,10 @@ print_mark_xlate(struct xt_xlate *xl, unsigned int mark,
                           op == XT_OP_EQ ? "" : "!= ", mark);
 }
 
-static int
-mark_mt_xlate(const void *ip, const struct xt_entry_match *match,
-             struct xt_xlate *xl, int numeric)
+static int mark_mt_xlate(struct xt_xlate *xl,
+                        const struct xt_xlate_mt_params *params)
 {
-       const struct xt_mark_mtinfo1 *info = (const void *)match->data;
+       const struct xt_mark_mtinfo1 *info = (const void *)params->match->data;
        enum xt_op op = XT_OP_EQ;
 
        if (info->invert)
@@ -130,11 +129,10 @@ mark_mt_xlate(const void *ip, const struct xt_entry_match *match,
        return 1;
 }
 
-static int
-mark_xlate(const void *ip, const struct xt_entry_match *match,
-          struct xt_xlate *xl, int numeric)
+static int mark_xlate(struct xt_xlate *xl,
+                     const struct xt_xlate_mt_params *params)
 {
-       const struct xt_mark_info *info = (const void *)match->data;
+       const struct xt_mark_info *info = (const void *)params->match->data;
        enum xt_op op = XT_OP_EQ;
 
        if (info->invert)
index 94b3f54da354d6c73f22664f4e9dedcfc34902f7..5c5cbe0fa95f681360739575706473cb6784cd68 100644 (file)
@@ -468,11 +468,11 @@ static void multiport_save6_v1(const void *ip_void,
        __multiport_save_v1(match, ip->proto);
 }
 
-static int __multiport_xlate(const void *ip, const struct xt_entry_match *match,
-                            struct xt_xlate *xl, int numeric)
+static int __multiport_xlate(struct xt_xlate *xl,
+                            const struct xt_xlate_mt_params *params)
 {
        const struct xt_multiport *multiinfo
-               = (const struct xt_multiport *)match->data;
+               = (const struct xt_multiport *)params->match->data;
        unsigned int i;
 
        switch (multiinfo->flags) {
@@ -498,30 +498,29 @@ static int __multiport_xlate(const void *ip, const struct xt_entry_match *match,
        return 1;
 }
 
-static int multiport_xlate(const void *ip, const struct xt_entry_match *match,
-                          struct xt_xlate *xl, int numeric)
+static int multiport_xlate(struct xt_xlate *xl,
+                          const struct xt_xlate_mt_params *params)
 {
-       uint8_t proto = ((const struct ipt_ip *)ip)->proto;
+       uint8_t proto = ((const struct ipt_ip *)params->ip)->proto;
 
        xt_xlate_add(xl, "%s", proto_to_name(proto));
-       return __multiport_xlate(ip, match, xl, numeric);
+       return __multiport_xlate(xl, params);
 }
 
-static int multiport_xlate6(const void *ip, const struct xt_entry_match *match,
-                           struct xt_xlate *xl, int numeric)
+static int multiport_xlate6(struct xt_xlate *xl,
+                           const struct xt_xlate_mt_params *params)
 {
-       uint8_t proto = ((const struct ip6t_ip6 *)ip)->proto;
+       uint8_t proto = ((const struct ip6t_ip6 *)params->ip)->proto;
 
        xt_xlate_add(xl, "%s", proto_to_name(proto));
-       return __multiport_xlate(ip, match, xl, numeric);
+       return __multiport_xlate(xl, params);
 }
 
-static int __multiport_xlate_v1(const void *ip,
-                               const struct xt_entry_match *match,
-                               struct xt_xlate *xl, int numeric)
+static int __multiport_xlate_v1(struct xt_xlate *xl,
+                               const struct xt_xlate_mt_params *params)
 {
-       const struct xt_multiport_v1 *multiinfo
-               = (const struct xt_multiport_v1 *)match->data;
+       const struct xt_multiport_v1 *multiinfo =
+               (const struct xt_multiport_v1 *)params->match->data;
        unsigned int i;
 
        switch (multiinfo->flags) {
@@ -555,24 +554,22 @@ static int __multiport_xlate_v1(const void *ip,
        return 1;
 }
 
-static int multiport_xlate_v1(const void *ip,
-                             const struct xt_entry_match *match,
-                             struct xt_xlate *xl, int numeric)
+static int multiport_xlate_v1(struct xt_xlate *xl,
+                             const struct xt_xlate_mt_params *params)
 {
-       uint8_t proto = ((const struct ipt_ip *)ip)->proto;
+       uint8_t proto = ((const struct ipt_ip *)params->ip)->proto;
 
        xt_xlate_add(xl, "%s", proto_to_name(proto));
-       return __multiport_xlate_v1(ip, match, xl, numeric);
+       return __multiport_xlate_v1(xl, params);
 }
 
-static int multiport_xlate6_v1(const void *ip,
-                              const struct xt_entry_match *match,
-                              struct xt_xlate *xl, int numeric)
+static int multiport_xlate6_v1(struct xt_xlate *xl,
+                              const struct xt_xlate_mt_params *params)
 {
-       uint8_t proto = ((const struct ip6t_ip6 *)ip)->proto;
+       uint8_t proto = ((const struct ip6t_ip6 *)params->ip)->proto;
 
        xt_xlate_add(xl, "%s", proto_to_name(proto));
-       return __multiport_xlate_v1(ip, match, xl, numeric);
+       return __multiport_xlate_v1(xl, params);
 }
 
 static struct xtables_match multiport_mt_reg[] = {
index 249ba5a046b5aca322f2ec0cc04fd2c5c01b617e..87e4df31256668c2f73688be2d4cc451ee038586 100644 (file)
@@ -522,10 +522,10 @@ owner_mt_print_gid_xlate(const struct xt_owner_match_info *info,
        return 1;
 }
 
-static int owner_mt_xlate(const void *ip, const struct xt_entry_match *match,
-                         struct xt_xlate *xl, int numeric)
+static int owner_mt_xlate(struct xt_xlate *xl,
+                         const struct xt_xlate_mt_params *params)
 {
-       const struct xt_owner_match_info *info = (void *)match->data;
+       const struct xt_owner_match_info *info = (void *)params->match->data;
        int ret;
 
        switch (info->match) {
index a14409d5054478f955df501dea2cec9896383be2..bf6f5b96066207c97b9632c764dad049cbd1a3c0 100644 (file)
@@ -140,10 +140,10 @@ static void print_pkttype_xlate(const struct xt_pkttype_info *info,
        xt_xlate_add(xl, "%d", info->pkttype);
 }
 
-static int pkttype_xlate(const void *ip, const struct xt_entry_match *match,
-                        struct xt_xlate *xl, int numeric)
+static int pkttype_xlate(struct xt_xlate *xl,
+                        const struct xt_xlate_mt_params *params)
 {
-       const struct xt_pkttype_info *info = (const void *)match->data;
+       const struct xt_pkttype_info *info = (const void *)params->match->data;
 
        xt_xlate_add(xl, "pkttype%s ", info->invert ? " !=" : "");
        print_pkttype_xlate(info, xl);
index a04b4fc0b6941231e5e05f16002824eb029e4b40..df1936be8b83a1c9789a33f38af37cd553d2bec4 100644 (file)
@@ -485,11 +485,11 @@ static void sctp_save(const void *ip, const struct xt_entry_match *match)
        }
 }
 
-static int sctp_xlate(const void *ip, const struct xt_entry_match *match,
-                     struct xt_xlate *xl, int numeric)
+static int sctp_xlate(struct xt_xlate *xl,
+                     const struct xt_xlate_mt_params *params)
 {
        const struct xt_sctp_info *einfo =
-               (const struct xt_sctp_info *)match->data;
+               (const struct xt_sctp_info *)params->match->data;
        char *space = "";
 
        if (!einfo->flags)
index bc1d0af6dc25d10905b2213bc3f4a51638985432..7f68b81288725365cc5e35309752ae9cb55801be 100644 (file)
@@ -393,10 +393,11 @@ static void print_tcp_xlate(struct xt_xlate *xl, uint8_t flags)
                xt_xlate_add(xl, "0x0");
 }
 
-static int tcp_xlate(const void *ip, const struct xt_entry_match *match,
-                    struct xt_xlate *xl, int numeric)
+static int tcp_xlate(struct xt_xlate *xl,
+                    const struct xt_xlate_mt_params *params)
 {
-       const struct xt_tcp *tcpinfo = (const struct xt_tcp *)match->data;
+       const struct xt_tcp *tcpinfo =
+               (const struct xt_tcp *)params->match->data;
        char *space= "";
 
        if (tcpinfo->spts[0] != 0 || tcpinfo->spts[1] != 0xffff) {
index d8e286acf5ca089b7516bd3f5843cb30eec96e3d..0c7a4bc221993140bb1fe7d7258727d4ab433881 100644 (file)
@@ -152,10 +152,10 @@ static void udp_save(const void *ip, const struct xt_entry_match *match)
        }
 }
 
-static int udp_xlate(const void *ip, const struct xt_entry_match *match,
-                    struct xt_xlate *xl, int numeric)
+static int udp_xlate(struct xt_xlate *xl,
+                    const struct xt_xlate_mt_params *params)
 {
-       const struct xt_udp *udpinfo = (struct xt_udp *)match->data;
+       const struct xt_udp *udpinfo = (struct xt_udp *)params->match->data;
        char *space= "";
 
        if (udpinfo->spts[0] != 0 || udpinfo->spts[1] != 0xFFFF) {
index 48be51401bd78abf16483e9f9eedca93f835d829..9701612aacfd2ad39dd02bda01edfc0c7e9037c7 100644 (file)
@@ -207,6 +207,18 @@ enum xtables_ext_flags {
 
 struct xt_xlate;
 
+struct xt_xlate_mt_params {
+       const void                      *ip;
+       const struct xt_entry_match     *match;
+       int                             numeric;
+};
+
+struct xt_xlate_tg_params {
+       const void                      *ip;
+       const struct xt_entry_target    *target;
+       int                             numeric;
+};
+
 /* Include file for additions: new matches and targets. */
 struct xtables_match
 {
@@ -272,8 +284,8 @@ struct xtables_match
        const struct xt_option_entry *x6_options;
 
        /* Translate iptables to nft */
-       int (*xlate)(const void *ip, const struct xt_entry_match *match,
-                    struct xt_xlate *xl, int numeric);
+       int (*xlate)(struct xt_xlate *xl,
+                    const struct xt_xlate_mt_params *params);
 
        /* Size of per-extension instance extra "global" scratch space */
        size_t udata_size;
@@ -353,8 +365,8 @@ struct xtables_target
        const struct xt_option_entry *x6_options;
 
        /* Translate iptables to nft */
-       int (*xlate)(const void *ip, const struct xt_entry_target *target,
-                    struct xt_xlate *xl, int numeric);
+       int (*xlate)(struct xt_xlate *xl,
+                    const struct xt_xlate_tg_params *params);
 
        size_t udata_size;
 
index 71f1356248111ebcb6e5342a501ab87cbc9e57b1..678228b2f8b48a0bd9ebc0efab107b9689c9b36b 100644 (file)
@@ -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, " ");