]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables-translate: pass ipt_entry and ip6t_entry to ->xlate()
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 9 Mar 2016 17:18:11 +0000 (18:18 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 9 Mar 2016 17:21:35 +0000 (18:21 +0100)
The multiport match needs it, this basically leaves ->xlate() indirection
with almost the same interface as ->print().

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
42 files changed:
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_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_realm.c
extensions/libipt_ttl.c
extensions/libxt_NFLOG.c
extensions/libxt_NFQUEUE.c
extensions/libxt_comment.c
extensions/libxt_connmark.c
extensions/libxt_conntrack.c
extensions/libxt_cpu.c
extensions/libxt_dccp.c
extensions/libxt_devgroup.c
extensions/libxt_esp.c
extensions/libxt_helper.c
extensions/libxt_iprange.c
extensions/libxt_length.c
extensions/libxt_limit.c
extensions/libxt_mac.c
extensions/libxt_mark.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 7fc21a38821efe7207bc33651d66076be5f54077..8bd6231b105697316458b6e4e79cb6032c3046bf 100644 (file)
@@ -252,7 +252,7 @@ static void print_range_xlate(const struct nf_nat_range *range,
        }
 }
 
-static int DNAT_xlate(const struct xt_entry_target *target,
+static int DNAT_xlate(const void *ip, const struct xt_entry_target *target,
                      struct xt_xlate *xl, int numeric)
 {
        const struct nf_nat_range *range = (const void *)target->data;
index 17d76a8d8ff5d469229b1e011e576710acfa2e91..7841e5780053b850e228f4500eb4d1294c6bbd60 100644 (file)
@@ -182,7 +182,7 @@ static const struct ip6t_log_xlate ip6t_log_xlate_names[] = {
        {"warn",        LOG_WARNING }
 };
 
-static int LOG_xlate(const struct xt_entry_target *target,
+static int LOG_xlate(const void *ip, const struct xt_entry_target *target,
                     struct xt_xlate *xl, int numeric)
 {
        unsigned int i = 0;
index 5a309ac9c03a612b55482ef39eee0ed5444d35f3..15ca14192f442e2c1615cff0abf4c73d85f99eb8 100644 (file)
@@ -132,7 +132,7 @@ MASQUERADE_save(const void *ip, const struct xt_entry_target *target)
 }
 
 static int
-MASQUERADE_xlate(const struct xt_entry_target *target,
+MASQUERADE_xlate(const void *ip, const struct xt_entry_target *target,
                 struct xt_xlate *xl, int numeric)
 {
        const struct nf_nat_range *r = (const void *)target->data;
index fc4a4d8469c2e54d55adbf8b2038f0353d0f7cd2..9c5f14c027aa98af9196017964dc7276efd55c2f 100644 (file)
@@ -132,7 +132,7 @@ static void REDIRECT_save(const void *ip, const struct xt_entry_target *target)
        }
 }
 
-static int REDIRECT_xlate(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)
 {
        const struct nf_nat_range *range = (const void *)target->data;
index ad2a8ecc23b9bb4c620c40201f2d9efc33b1e30b..c30f292908fac9178226363a7c6a27c1b11ddd51 100644 (file)
@@ -139,7 +139,7 @@ static const struct reject_names_xlate reject_table_xlate[] = {
        {"reject-route",        IP6T_ICMP6_REJECT_ROUTE}
 };
 
-static int REJECT_xlate(const struct xt_entry_target *target,
+static int REJECT_xlate(const void *ip, const struct xt_entry_target *target,
                        struct xt_xlate *xl, int numeric)
 {
        const struct ip6t_reject_info *reject =
index 28e29daec9068fd814f60cedaf4baca274dadbb7..ab7713b5dec043d8d632465e86ead1897ade7fa7 100644 (file)
@@ -262,7 +262,7 @@ static void print_range_xlate(const struct nf_nat_range *range,
        }
 }
 
-static int SNAT_xlate(const struct xt_entry_target *target,
+static int SNAT_xlate(const void *ip, const struct xt_entry_target *target,
                      struct xt_xlate *xl, int numeric)
 {
        const struct nf_nat_range *range = (const void *)target->data;
index 087b3ac320a5900795b50937c513c229a013ee51..9c7bdd7147ee326e3ef2918310706af2ee0bbb79 100644 (file)
@@ -128,7 +128,7 @@ static void ah_save(const void *ip, const struct xt_entry_match *match)
                printf(" --ahres");
 }
 
-static int ah_xlate(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)
 {
        const struct ip6t_ah *ahinfo = (struct ip6t_ah *)match->data;
index 9fe893a3bc177a06d119eb202435a697329ddce4..ee9c36bb5ff8f7249c482b42a114c9333090c661 100644 (file)
@@ -83,7 +83,7 @@ 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 struct xt_entry_match *match,
+static int hl_xlate(const void *ip, const struct xt_entry_match *match,
                    struct xt_xlate *xl, int numeric)
 {
        static const char *const op[] = {
index 2c5aadd0d42f859617d289378b83fbf254f8d26a..ddb167373fb062c84e6650efbc9abc55bdf353c3 100644 (file)
@@ -271,8 +271,8 @@ static unsigned int type_xlate_print(struct xt_xlate *xl, unsigned int icmptype,
        return 1;
 }
 
-static int icmp6_xlate(const struct xt_entry_match *match, struct xt_xlate *xl,
-                      int numeric)
+static int icmp6_xlate(const void *ip, const struct xt_entry_match *match,
+                      struct xt_xlate *xl, int numeric)
 {
        const struct ip6t_icmp *info = (struct ip6t_icmp *)match->data;
 
index c48582c8dcc5971bd6d1b34ba6e07d046cd0fd8b..f4672dad9f0fc2d791f3b81b51b374daea04e7b7 100644 (file)
@@ -202,7 +202,7 @@ 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 struct xt_entry_match *match,
+static int mh_xlate(const void *ip, const struct xt_entry_match *match,
                    struct xt_xlate *xl, int numeric)
 {
        const struct ip6t_mh *mhinfo = (struct ip6t_mh *)match->data;
index 59adfad4e3e2800edd737d77c9fc6fa840437652..14a7f7e7757f5ee8f373368b6cb149a1fa5ae749 100644 (file)
@@ -245,8 +245,8 @@ static void rt_save(const void *ip, const struct xt_entry_match *match)
 
 }
 
-static int rt_xlate(const struct xt_entry_match *match, struct xt_xlate *xl,
-                   int numeric)
+static int rt_xlate(const void *ip, const struct xt_entry_match *match,
+                   struct xt_xlate *xl, int numeric)
 {
        const struct ip6t_rt *rtinfo = (struct ip6t_rt *)match->data;
 
index 45835a97fea89e8def6746e3e72d555afc0fa257..79f50249e1f4187e87e324fffbe04ddf52dc3580 100644 (file)
@@ -262,7 +262,7 @@ static void print_range_xlate(const struct nf_nat_ipv4_range *r,
        }
 }
 
-static int DNAT_xlate(const struct xt_entry_target *target,
+static int DNAT_xlate(const void *ip, const struct xt_entry_target *target,
                      struct xt_xlate *xl, int numeric)
 {
        const struct ipt_natinfo *info = (const void *)target;
index f3875b6738fe38237cce0020003328fadd08a7cb..afe8c9f0f402f47c8c06def1120c56d33770fd89 100644 (file)
@@ -182,7 +182,7 @@ static const struct ipt_log_xlate ipt_log_xlate_names[] = {
        {"warn",        LOG_WARNING }
 };
 
-static int LOG_xlate(const struct xt_entry_target *target,
+static int LOG_xlate(const void *ip, const struct xt_entry_target *target,
                     struct xt_xlate *xl, int numeric)
 {
        unsigned int i = 0;
index d1393c11d7212ed5327d11b3841fa330aea72976..2d11fa950081521d23880f02c9de81dd65c93f60 100644 (file)
@@ -135,7 +135,7 @@ MASQUERADE_save(const void *ip, const struct xt_entry_target *target)
 }
 
 static int
-MASQUERADE_xlate(const struct xt_entry_target *target,
+MASQUERADE_xlate(const void *ip, const struct xt_entry_target *target,
                 struct xt_xlate *xl, int numeric)
 {
        const struct nf_nat_ipv4_multi_range_compat *mr =
index 68efe96ff02ecaa48b497f3840330e1068e9261e..1ffb3ddadd7a74957329abbc643c9d3b93da66c1 100644 (file)
@@ -135,7 +135,7 @@ static void REDIRECT_save(const void *ip, const struct xt_entry_target *target)
        }
 }
 
-static int REDIRECT_xlate(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)
 {
        const struct nf_nat_ipv4_multi_range_compat *mr =
index 56fc346052abacc6a8ccd1cfa1768574c2506052..41487762d0d09fcc05e72613c43cb3259bfe2caf 100644 (file)
@@ -159,7 +159,7 @@ static const struct reject_names_xlate reject_table_xlate[] = {
        {"admin-prohibited",    IPT_ICMP_ADMIN_PROHIBITED}
 };
 
-static int REJECT_xlate(const struct xt_entry_target *target,
+static int REJECT_xlate(const void *ip, const struct xt_entry_target *target,
                        struct xt_xlate *xl, int numeric)
 {
        const struct ipt_reject_info *reject =
index 1962e66e1291daf0dec3a696e013dfaab8a59048..6613316e4b722058fdccf5d0bf37b07459fc0b67 100644 (file)
@@ -273,7 +273,7 @@ static void print_range_xlate(const struct nf_nat_ipv4_range *r,
        }
 }
 
-static int SNAT_xlate(const struct xt_entry_target *target,
+static int SNAT_xlate(const void *ip, const struct xt_entry_target *target,
                      struct xt_xlate *xl, int numeric)
 {
        const struct ipt_natinfo *info = (const void *)target;
index a7d119369d9fb34af1c0b2de9bc9deafd31cf733..b8953d7355fbbc7f17f4ffb055f3b52a8143a5c0 100644 (file)
@@ -92,7 +92,7 @@ static void ah_save(const void *ip, const struct xt_entry_match *match)
 
 }
 
-static int ah_xlate(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)
 {
        const struct ipt_ah *ahinfo = (struct ipt_ah *)match->data;
index 7dba93fe99e70f5f9be87b0192d42a0b43d4a81e..beb2491497fd64f7e62a07638df6325c9f16476c 100644 (file)
@@ -129,7 +129,7 @@ print_realm_xlate(unsigned long id, unsigned long mask,
        }
 }
 
-static int realm_xlate(const struct xt_entry_match *match,
+static int realm_xlate(const void *ip, const struct xt_entry_match *match,
                       struct xt_xlate *xl, int numeric)
 {
        const struct xt_realm_info *ri = (const void *)match->data;
index bd19cd2c94d67cfb223e4824b53eafa07baac361..01e085dc3136329766c36dc642c328c911daa260 100644 (file)
@@ -100,7 +100,7 @@ static void ttl_save(const void *ip, const struct xt_entry_match *match)
        printf(" %u", info->ttl);
 }
 
-static int ttl_xlate(const struct xt_entry_match *match,
+static int ttl_xlate(const void *ip, const struct xt_entry_match *match,
                     struct xt_xlate *xl, int numeric)
 {
        const struct ipt_ttl_info *info =
index e31a3c4b318d1cc16e367deb6704a2916bdb6402..f6116317975be08a9c02583f89e258b18c11fbe7 100644 (file)
@@ -99,7 +99,7 @@ static void nflog_print_xlate(const struct xt_nflog_info *info,
        xt_xlate_add(xl, "group %u ", info->group);
 }
 
-static int NFLOG_xlate(const struct xt_entry_target *target,
+static int NFLOG_xlate(const void *ip, const struct xt_entry_target *target,
                       struct xt_xlate *xl, int numeric)
 {
        const struct xt_nflog_info *info = (struct xt_nflog_info *)target->data;
index fe005cb290cff9cd06e3e1e8df3cd60c440a5122..811545748a5c5ae2c1a468d423fe5b0fd31bfabe 100644 (file)
@@ -205,7 +205,7 @@ static void NFQUEUE_init_v1(struct xt_entry_target *t)
        tinfo->queues_total = 1;
 }
 
-static int NFQUEUE_xlate(const struct xt_entry_target *target,
+static int NFQUEUE_xlate(const void *ip, const struct xt_entry_target *target,
                         struct xt_xlate *xl, int numeric)
 {
        const struct xt_NFQ_info *tinfo =
@@ -216,7 +216,8 @@ static int NFQUEUE_xlate(const struct xt_entry_target *target,
        return 1;
 }
 
-static int NFQUEUE_xlate_v1(const struct xt_entry_target *target,
+static int NFQUEUE_xlate_v1(const void *ip,
+                           const struct xt_entry_target *target,
                            struct xt_xlate *xl, int numeric)
 {
        const struct xt_NFQ_info_v1 *tinfo = (const void *)target->data;
@@ -232,12 +233,13 @@ static int NFQUEUE_xlate_v1(const struct xt_entry_target *target,
        return 1;
 }
 
-static int NFQUEUE_xlate_v2(const struct xt_entry_target *target,
+static int NFQUEUE_xlate_v2(const void *ip,
+                           const struct xt_entry_target *target,
                            struct xt_xlate *xl, int numeric)
 {
        const struct xt_NFQ_info_v2 *info = (void *) target->data;
 
-       NFQUEUE_xlate_v1(target, xl, numeric);
+       NFQUEUE_xlate_v1(ip, target, xl, numeric);
 
        if (info->bypass & NFQ_FLAG_BYPASS)
                xt_xlate_add(xl, "bypass");
@@ -245,12 +247,13 @@ static int NFQUEUE_xlate_v2(const struct xt_entry_target *target,
        return 1;
 }
 
-static int NFQUEUE_xlate_v3(const struct xt_entry_target *target,
+static int NFQUEUE_xlate_v3(const void *ip,
+                           const struct xt_entry_target *target,
                            struct xt_xlate *xl, int numeric)
 {
        const struct xt_NFQ_info_v3 *info = (void *)target->data;
 
-       NFQUEUE_xlate_v2(target, xl, numeric);
+       NFQUEUE_xlate_v2(ip, target, xl, numeric);
        if (info->flags & NFQ_FLAG_CPU_FANOUT)
                xt_xlate_add(xl, "%sfanout ", info->flags & NFQ_FLAG_BYPASS ? "," : "");
 
index 3fcb8b46b6c6c4243c2fee5ba17e56d2a806e1c5..ab229e0b6f9c53f861cdc6e9b416140ef4e7056c 100644 (file)
@@ -49,7 +49,7 @@ comment_save(const void *ip, const struct xt_entry_match *match)
 }
 
 static int
-comment_xlate(const struct xt_entry_match *match,
+comment_xlate(const void *ip, const struct xt_entry_match *match,
              struct xt_xlate *xl, int numeric)
 {
        struct xt_comment_info *commentinfo = (void *)match->data;
index 3d1926fdd8f21d88cf44d7679737ae60ccdb1de6..fbfeb743428c2865d85727ae3cc06561508ebf2b 100644 (file)
@@ -134,7 +134,7 @@ static void print_mark_xlate(unsigned int mark, unsigned int mask,
                           op == XT_OP_EQ ? "" : "!= ", mark);
 }
 
-static int connmark_xlate(const struct xt_entry_match *match,
+static int connmark_xlate(const void *ip, const struct xt_entry_match *match,
                          struct xt_xlate *xl, int numeric)
 {
        const struct xt_connmark_info *info = (const void *)match->data;
@@ -150,8 +150,8 @@ static int connmark_xlate(const struct xt_entry_match *match,
 }
 
 static int
-connmark_mt_xlate(const struct xt_entry_match *match,
-                struct xt_xlate *xl, int numeric)
+connmark_mt_xlate(const void *ip, const struct xt_entry_match *match,
+                 struct xt_xlate *xl, int numeric)
 {
        const struct xt_connmark_mtinfo1 *info = (const void *)match->data;
        enum xt_op op = XT_OP_EQ;
index 7f66895d14f62f10e67c48fcaa877ce660a9c7b8..310a468ca6d3e17758c396397764c9a1856bb480 100644 (file)
@@ -1182,8 +1182,8 @@ static void state_xlate_print(struct xt_xlate *xl, unsigned int statemask)
        }
 }
 
-static int state_xlate(const struct xt_entry_match *match, struct xt_xlate *xl,
-                      int numeric)
+static int state_xlate(const void *ip, const struct xt_entry_match *match,
+                      struct xt_xlate *xl, int numeric)
 {
        const struct xt_conntrack_mtinfo3 *sinfo = (const void *)match->data;
 
index 02286c285e98390dcb82c06758822b655ec5fe43..d453faded8aeef051ff9ce56c2723c7c05525af3 100644 (file)
@@ -44,7 +44,7 @@ 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 struct xt_entry_match *match,
+static int cpu_xlate(const void *ip, const struct xt_entry_match *match,
                     struct xt_xlate *xl, int numeric)
 {
        const struct xt_cpu_info *info = (void *)match->data;
index 0d4f3692d213232fb92996dc4b06403c2e26a987..d442e37abf3c0a429d1cd95a0393db60cf74f0d3 100644 (file)
@@ -329,7 +329,7 @@ static int dccp_type_xlate(const struct xt_dccp_info *einfo,
        return 1;
 }
 
-static int dccp_xlate(const struct xt_entry_match *match,
+static int dccp_xlate(const void *ip, const struct xt_entry_match *match,
                      struct xt_xlate *xl, int numeric)
 {
        const struct xt_dccp_info *einfo =
index fd67bc3c219f4ac48cdfe7c7ef694cb483526ae4..a30fff0fed1aafdf51d7a24796a7447b799f8da3 100644 (file)
@@ -193,7 +193,7 @@ static void devgroup_show_xlate(const struct xt_devgroup_info *info,
        }
 }
 
-static int devgroup_xlate(const struct xt_entry_match *match,
+static int devgroup_xlate(const void *ip, const struct xt_entry_match *match,
                          struct xt_xlate *xl, int numeric)
 {
        const struct xt_devgroup_info *info = (const void *)match->data;
index b5219fd9381b15bfb9583cc28ba9dd2612510539..bd7b643db0cdf1bdb0451997bdc70f61e48e288b 100644 (file)
@@ -86,7 +86,7 @@ static void esp_save(const void *ip, const struct xt_entry_match *match)
 
 }
 
-static int esp_xlate(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)
 {
        const struct xt_esp *espinfo = (struct xt_esp *)match->data;
index 9df4163067fe918bbac7f213cab7c376dce5a3ea..a8b7c68815747020b15d38eff9ec9e7d00171b12 100644 (file)
@@ -45,7 +45,7 @@ static void helper_save(const void *ip, const struct xt_entry_match *match)
        xtables_save_string(info->name);
 }
 
-static int helper_xlate(const struct xt_entry_match *match,
+static int helper_xlate(const void *ip, const struct xt_entry_match *match,
                        struct xt_xlate *xl, int numeric)
 {
        const struct xt_helper_info *info = (const void *)match->data;
index 0b05651bc9b1a64070185a72f2af6390ea7950fa..c2d51e9b2438fb01780275bce3122fd2650b9f89 100644 (file)
@@ -315,7 +315,7 @@ 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 struct xt_entry_match *match,
+static int iprange_xlate(const void *ip, const struct xt_entry_match *match,
                         struct xt_xlate *xl, int numeric)
 {
        const struct ipt_iprange_info *info = (const void *)match->data;
@@ -336,7 +336,7 @@ static int iprange_xlate(const struct xt_entry_match *match,
        return 1;
 }
 
-static int iprange_mt4_xlate(const struct xt_entry_match *match,
+static int iprange_mt4_xlate(const void *ip, const struct xt_entry_match *match,
                             struct xt_xlate *xl, int numeric)
 {
        const struct xt_iprange_mtinfo *info = (const void *)match->data;
@@ -361,7 +361,7 @@ static int iprange_mt4_xlate(const struct xt_entry_match *match,
        return 1;
 }
 
-static int iprange_mt6_xlate(const struct xt_entry_match *match,
+static int iprange_mt6_xlate(const void *ip, const struct xt_entry_match *match,
                             struct xt_xlate *xl, int numeric)
 {
        const struct xt_iprange_mtinfo *info = (const void *)match->data;
index 00acae0e6a11df165cc6e8300414bdbacb8c93d1..1335b4ed51caaf4dbfe00240ab4d04168afc32b4 100644 (file)
@@ -56,7 +56,7 @@ 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 struct xt_entry_match *match,
+static int length_xlate(const void *ip, const struct xt_entry_match *match,
                        struct xt_xlate *xl, int numeric)
 {
        const struct xt_length_info *info = (void *)match->data;
index 9ad00c1463ba5d3379e7591e6905ce23b099ff1d..c88d26b8f2c8d059ac00cb8ace77650b7c4e34fe 100644 (file)
@@ -177,7 +177,7 @@ static void print_rate_xlate(uint32_t period, struct xt_xlate *xl)
                   rates_xlate[i - 1].name);
 }
 
-static int limit_xlate(const struct xt_entry_match *match,
+static int limit_xlate(const void *ip, const struct xt_entry_match *match,
                       struct xt_xlate *xl, int numeric)
 {
        const struct xt_rateinfo *r = (const void *)match->data;
index 85ed1b5becf51ec42538594f5f31f2307f97573f..b4164870ce1b8deba37c219ba4f3187d36ee9427 100644 (file)
@@ -81,7 +81,7 @@ static void print_mac_xlate(const unsigned char *macaddress,
        xt_xlate_add(xl, " ");
 }
 
-static int mac_xlate(const struct xt_entry_match *match,
+static int mac_xlate(const void *ip, const struct xt_entry_match *match,
                     struct xt_xlate *xl, int numeric)
 {
        const struct xt_mac_info *info = (void *)match->data;
index b8c0ed66bb7498978e4bf4dbc6e99427209dc80d..939b4acd77b463dcace88f04bc49a6fda770fae1 100644 (file)
@@ -115,7 +115,7 @@ print_mark_xlate(struct xt_xlate *xl, unsigned int mark,
 }
 
 static int
-mark_mt_xlate(const struct xt_entry_match *match,
+mark_mt_xlate(const void *ip, const struct xt_entry_match *match,
              struct xt_xlate *xl, int numeric)
 {
        const struct xt_mark_mtinfo1 *info = (const void *)match->data;
@@ -131,7 +131,7 @@ mark_mt_xlate(const struct xt_entry_match *match,
 }
 
 static int
-mark_xlate(const struct xt_entry_match *match,
+mark_xlate(const void *ip, const struct xt_entry_match *match,
           struct xt_xlate *xl, int numeric)
 {
        const struct xt_mark_info *info = (const void *)match->data;
index 2085de8215a78410905ee964b6fd7dc3b0b500f8..1ee58ff63e234462dcfef7f9c4e8066b03fde098 100644 (file)
@@ -522,7 +522,7 @@ owner_mt_print_gid_xlate(const struct xt_owner_match_info *info,
        return 1;
 }
 
-static int owner_mt_xlate(const struct xt_entry_match *match,
+static int owner_mt_xlate(const void *ip, const struct xt_entry_match *match,
                          struct xt_xlate *xl, int numeric)
 {
        const struct xt_owner_match_info *info = (void *)match->data;
index 55edf279a692da0d8615a286a6e6bdedba0b5cd2..c8123a25f833c268b4d1c403c9f102bc9e842565 100644 (file)
@@ -140,8 +140,8 @@ static void print_pkttype_xlate(const struct xt_pkttype_info *info,
        xt_xlate_add(xl, "%d", info->pkttype);
 }
 
-static int pkttype_xlate(const struct xt_entry_match *match,
-                         struct xt_xlate *xl, int numeric)
+static int pkttype_xlate(const void *ip, const struct xt_entry_match *match,
+                        struct xt_xlate *xl, int numeric)
 {
        const struct xt_pkttype_info *info = (const void *)match->data;
 
index 3b0b04864bf805bf16e71c3ae54fd9dae0ae9ea3..ae1969a0f0c1f2150ee80884446d82c0a9afcbb2 100644 (file)
@@ -485,7 +485,7 @@ static void sctp_save(const void *ip, const struct xt_entry_match *match)
        }
 }
 
-static int sctp_xlate(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)
 {
        const struct xt_sctp_info *einfo =
index bd4ca77ddb2c4e75c8316c7cebcba411c356ae31..6a85ed468f3d42b9f4697c9a89f333fd6012e90f 100644 (file)
@@ -393,8 +393,8 @@ static void print_tcp_xlate(struct xt_xlate *xl, uint8_t flags)
                xt_xlate_add(xl, "none");
 }
 
-static int tcp_xlate(const struct xt_entry_match *match, struct xt_xlate *xl,
-                    int numeric)
+static int tcp_xlate(const void *ip, const struct xt_entry_match *match,
+                    struct xt_xlate *xl, int numeric)
 {
        const struct xt_tcp *tcpinfo = (const struct xt_tcp *)match->data;
 
index 47c29e9dfde22230c890f12559a42040562a12b6..9af782e4778a3ff63d3223addc93e994fe1c7fcb 100644 (file)
@@ -152,8 +152,8 @@ static void udp_save(const void *ip, const struct xt_entry_match *match)
        }
 }
 
-static int udp_xlate(const struct xt_entry_match *match, struct xt_xlate *xl,
-                    int numeric)
+static int udp_xlate(const void *ip, const struct xt_entry_match *match,
+                    struct xt_xlate *xl, int numeric)
 {
        const struct xt_udp *udpinfo = (struct xt_udp *)match->data;
 
index e219c9f9947f2333fb050d5c3aa021cc5cb03ac1..48be51401bd78abf16483e9f9eedca93f835d829 100644 (file)
@@ -272,8 +272,8 @@ struct xtables_match
        const struct xt_option_entry *x6_options;
 
        /* Translate iptables to nft */
-       int (*xlate)(const struct xt_entry_match *match, struct xt_xlate *xl,
-                    int numeric);
+       int (*xlate)(const void *ip, const struct xt_entry_match *match,
+                    struct xt_xlate *xl, int numeric);
 
        /* Size of per-extension instance extra "global" scratch space */
        size_t udata_size;
@@ -353,8 +353,8 @@ struct xtables_target
        const struct xt_option_entry *x6_options;
 
        /* Translate iptables to nft */
-       int (*xlate)(const struct xt_entry_target *target, struct xt_xlate *xl,
-                    int numeric);
+       int (*xlate)(const void *ip, const struct xt_entry_target *target,
+                    struct xt_xlate *xl, int numeric);
 
        size_t udata_size;
 
index 3c5b5775be1bbcaf5e8139f7753546be369492b9..13a0bc71c450a72cc7bb65c34f5437e88f5dec3a 100644 (file)
@@ -49,7 +49,8 @@ int xlate_action(const struct iptables_command_state *cs, bool goto_set,
                else if (strcmp(cs->jumpto, XTC_LABEL_RETURN) == 0)
                        xt_xlate_add(xl, "return");
                else if (cs->target->xlate)
-                       ret = cs->target->xlate(cs->target->t, xl, numeric);
+                       ret = cs->target->xlate((const void *)&cs->fw,
+                                               cs->target->t, xl, numeric);
                else
                        return 0;
        } else if (strlen(cs->jumpto) > 0) {
@@ -72,7 +73,8 @@ int xlate_matches(const struct iptables_command_state *cs, struct xt_xlate *xl)
                if (!matchp->match->xlate)
                        return 0;
 
-               ret = matchp->match->xlate(matchp->match->m, xl, numeric);
+               ret = matchp->match->xlate((const void *)&cs->fw,
+                                          matchp->match->m, xl, numeric);
                if (!ret)
                        break;
        }