]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: rename xt_buf to xt_xlate
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 1 Feb 2016 18:24:38 +0000 (19:24 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 16 Feb 2016 18:30:25 +0000 (19:30 +0100)
Use a more generic name for this object to prepare the introduction of
other translation specific fields.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
37 files changed:
extensions/libip6t_DNAT.c
extensions/libip6t_LOG.c
extensions/libip6t_REDIRECT.c
extensions/libip6t_REJECT.c
extensions/libip6t_SNAT.c
extensions/libip6t_ah.c
extensions/libip6t_hl.c
extensions/libipt_DNAT.c
extensions/libipt_LOG.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_connmark.c
extensions/libxt_conntrack.c
extensions/libxt_cpu.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_pkttype.c
extensions/libxt_tcp.c
extensions/libxt_udp.c
include/xtables.h
iptables/nft-ipv4.c
iptables/nft-ipv6.c
iptables/nft-shared.h
iptables/nft.h
iptables/xtables-translate.c
libxtables/xtables.c

index 395975588782eb8996f79b0d1a7695d763407cf5..7fc21a38821efe7207bc33651d66076be5f54077 100644 (file)
@@ -232,43 +232,43 @@ static void DNAT_save(const void *ip, const struct xt_entry_target *target)
 }
 
 static void print_range_xlate(const struct nf_nat_range *range,
-                             struct xt_buf *buf)
+                             struct xt_xlate *xl)
 {
        if (range->flags & NF_NAT_RANGE_MAP_IPS) {
-               xt_buf_add(buf, "%s",
+               xt_xlate_add(xl, "%s",
                           xtables_ip6addr_to_numeric(&range->min_addr.in6));
 
                if (memcmp(&range->min_addr, &range->max_addr,
                           sizeof(range->min_addr)))
-                       xt_buf_add(buf, "-%s",
+                       xt_xlate_add(xl, "-%s",
                             xtables_ip6addr_to_numeric(&range->max_addr.in6));
        }
        if (range->flags & NF_NAT_RANGE_PROTO_SPECIFIED) {
-               xt_buf_add(buf, " :%hu", ntohs(range->min_proto.tcp.port));
+               xt_xlate_add(xl, " :%hu", ntohs(range->min_proto.tcp.port));
 
                if (range->max_proto.tcp.port != range->min_proto.tcp.port)
-                       xt_buf_add(buf, "-%hu",
+                       xt_xlate_add(xl, "-%hu",
                                   ntohs(range->max_proto.tcp.port));
        }
 }
 
 static int DNAT_xlate(const struct xt_entry_target *target,
-                      struct xt_buf *buf, int numeric)
+                     struct xt_xlate *xl, int numeric)
 {
        const struct nf_nat_range *range = (const void *)target->data;
        bool sep_need = false;
        const char *sep = " ";
 
-       xt_buf_add(buf, "dnat ");
-       print_range_xlate(range, buf);
+       xt_xlate_add(xl, "dnat ");
+       print_range_xlate(range, xl);
        if (range->flags & NF_NAT_RANGE_PROTO_RANDOM) {
-               xt_buf_add(buf, " random");
+               xt_xlate_add(xl, " random");
                sep_need = true;
        }
        if (range->flags & NF_NAT_RANGE_PERSISTENT) {
                if (sep_need)
                        sep = ",";
-               xt_buf_add(buf, "%spersistent", sep);
+               xt_xlate_add(xl, "%spersistent", sep);
        }
 
        return 1;
index 9df86fdb7a3f8ba29eb6bf77647d29d7f02a5a05..17d76a8d8ff5d469229b1e011e576710acfa2e91 100644 (file)
@@ -183,19 +183,19 @@ static const struct ip6t_log_xlate ip6t_log_xlate_names[] = {
 };
 
 static int LOG_xlate(const struct xt_entry_target *target,
-                    struct xt_buf *buf, int numeric)
+                    struct xt_xlate *xl, int numeric)
 {
        unsigned int i = 0;
        const struct ip6t_log_info *loginfo =
                        (const struct ip6t_log_info *)target->data;
 
-       xt_buf_add(buf, "log ");
+       xt_xlate_add(xl, "log ");
        if (strcmp(loginfo->prefix, "") != 0)
-               xt_buf_add(buf, "prefix \\\"%s\\\" ", loginfo->prefix);
+               xt_xlate_add(xl, "prefix \\\"%s\\\" ", loginfo->prefix);
 
        for (i = 0; i < ARRAY_SIZE(ip6t_log_xlate_names); ++i)
                if (loginfo->level == ip6t_log_xlate_names[i].level) {
-                       xt_buf_add(buf, "level %s",
+                       xt_xlate_add(xl, "level %s",
                                   ip6t_log_xlate_names[i].name);
                        break;
                }
index d907d94c29af1214c641a0d63fc4a515ed0be42c..fc4a4d8469c2e54d55adbf8b2038f0353d0f7cd2 100644 (file)
@@ -133,18 +133,18 @@ static void REDIRECT_save(const void *ip, const struct xt_entry_target *target)
 }
 
 static int REDIRECT_xlate(const struct xt_entry_target *target,
-                         struct xt_buf *buf, int numeric)
+                         struct xt_xlate *xl, int numeric)
 {
        const struct nf_nat_range *range = (const void *)target->data;
 
        if (range->flags & NF_NAT_RANGE_PROTO_SPECIFIED) {
-               xt_buf_add(buf, "redirect to %hu",
+               xt_xlate_add(xl, "redirect to %hu",
                           ntohs(range->min_proto.tcp.port));
                if (range->max_proto.tcp.port != range->min_proto.tcp.port)
-                       xt_buf_add(buf, "-%hu ",
+                       xt_xlate_add(xl, "-%hu ",
                                   ntohs(range->max_proto.tcp.port));
                if (range->flags & NF_NAT_RANGE_PROTO_RANDOM)
-                       xt_buf_add(buf, " random ");
+                       xt_xlate_add(xl, " random ");
        }
 
        return 1;
index 3b8431c0c3c9045024092e1d22957a5a3c858f70..ad2a8ecc23b9bb4c620c40201f2d9efc33b1e30b 100644 (file)
@@ -140,7 +140,7 @@ static const struct reject_names_xlate reject_table_xlate[] = {
 };
 
 static int REJECT_xlate(const struct xt_entry_target *target,
-                       struct xt_buf *buf, int numeric)
+                       struct xt_xlate *xl, int numeric)
 {
        const struct ip6t_reject_info *reject =
                                (const struct ip6t_reject_info *)target->data;
@@ -150,9 +150,9 @@ static int REJECT_xlate(const struct xt_entry_target *target,
                if (reject_table_xlate[i].with == reject->with)
                        break;
        if (reject->with == IP6T_TCP_RESET)
-               xt_buf_add(buf, "reject with %s", reject_table_xlate[i].name);
+               xt_xlate_add(xl, "reject with %s", reject_table_xlate[i].name);
        else
-               xt_buf_add(buf, "reject with icmpv6 type %s",
+               xt_xlate_add(xl, "reject with icmpv6 type %s",
                           reject_table_xlate[i].name);
 
        return 1;
index b85c86c3654409ebe76e6eaf7aa2398424d53aed..28e29daec9068fd814f60cedaf4baca274dadbb7 100644 (file)
@@ -242,49 +242,49 @@ static void SNAT_save(const void *ip, const struct xt_entry_target *target)
 }
 
 static void print_range_xlate(const struct nf_nat_range *range,
-                             struct xt_buf *buf)
+                             struct xt_xlate *xl)
 {
        if (range->flags & NF_NAT_RANGE_MAP_IPS) {
-               xt_buf_add(buf, "%s",
+               xt_xlate_add(xl, "%s",
                           xtables_ip6addr_to_numeric(&range->min_addr.in6));
 
                if (memcmp(&range->min_addr, &range->max_addr,
                           sizeof(range->min_addr)))
-                       xt_buf_add(buf, "-%s",
+                       xt_xlate_add(xl, "-%s",
                             xtables_ip6addr_to_numeric(&range->max_addr.in6));
        }
        if (range->flags & NF_NAT_RANGE_PROTO_SPECIFIED) {
-               xt_buf_add(buf, " :%hu", ntohs(range->min_proto.tcp.port));
+               xt_xlate_add(xl, " :%hu", ntohs(range->min_proto.tcp.port));
 
                if (range->max_proto.tcp.port != range->min_proto.tcp.port)
-                       xt_buf_add(buf, "-%hu",
+                       xt_xlate_add(xl, "-%hu",
                                   ntohs(range->max_proto.tcp.port));
        }
 }
 
 static int SNAT_xlate(const struct xt_entry_target *target,
-                     struct xt_buf *buf, int numeric)
+                     struct xt_xlate *xl, int numeric)
 {
        const struct nf_nat_range *range = (const void *)target->data;
        bool sep_need = false;
        const char *sep = " ";
 
-       xt_buf_add(buf, "snat ");
-       print_range_xlate(range, buf);
+       xt_xlate_add(xl, "snat ");
+       print_range_xlate(range, xl);
        if (range->flags & NF_NAT_RANGE_PROTO_RANDOM) {
-               xt_buf_add(buf, " random");
+               xt_xlate_add(xl, " random");
                sep_need = true;
        }
        if (range->flags & NF_NAT_RANGE_PROTO_RANDOM_FULLY) {
                if (sep_need)
                        sep = ",";
-               xt_buf_add(buf, "%sfully-random", sep);
+               xt_xlate_add(xl, "%sfully-random", sep);
                sep_need = true;
        }
        if (range->flags & NF_NAT_RANGE_PERSISTENT) {
                if (sep_need)
                        sep = ",";
-               xt_buf_add(buf, "%spersistent", sep);
+               xt_xlate_add(xl, "%spersistent", sep);
        }
 
        return 1;
index f7c30f466b5f37f3c20cdf4517ea73409361a877..087b3ac320a5900795b50937c513c229a013ee51 100644 (file)
@@ -129,27 +129,27 @@ static void ah_save(const void *ip, const struct xt_entry_match *match)
 }
 
 static int ah_xlate(const struct xt_entry_match *match,
-                   struct xt_buf *buf, int numeric)
+                   struct xt_xlate *xl, int numeric)
 {
        const struct ip6t_ah *ahinfo = (struct ip6t_ah *)match->data;
 
        if (!(ahinfo->spis[0] == 0 && ahinfo->spis[1] == 0xFFFFFFFF)) {
-               xt_buf_add(buf, "ah spi%s ",
+               xt_xlate_add(xl, "ah spi%s ",
                           (ahinfo->invflags & IP6T_AH_INV_SPI) ? " !=" : "");
        if (ahinfo->spis[0] != ahinfo->spis[1])
-               xt_buf_add(buf, "%u-%u ", ahinfo->spis[0], ahinfo->spis[1]);
+               xt_xlate_add(xl, "%u-%u ", ahinfo->spis[0], ahinfo->spis[1]);
        else
-               xt_buf_add(buf, "%u ", ahinfo->spis[0]);
+               xt_xlate_add(xl, "%u ", ahinfo->spis[0]);
        }
 
        if (ahinfo->hdrlen != 0 || (ahinfo->invflags & IP6T_AH_INV_LEN)) {
-               xt_buf_add(buf, "ah hdrlength%s %u ",
+               xt_xlate_add(xl, "ah hdrlength%s %u ",
                           (ahinfo->invflags & IP6T_AH_INV_LEN) ? " !=" : "",
                           ahinfo->hdrlen);
        }
 
        if (ahinfo->hdrres != 0)
-               xt_buf_add(buf, "ah reserved %u ", ahinfo->hdrres);
+               xt_xlate_add(xl, "ah reserved %u ", ahinfo->hdrres);
 
        return 1;
 }
index 226b69c379cc70c77afacc098963ed66011df400..9fe893a3bc177a06d119eb202435a697329ddce4 100644 (file)
@@ -84,7 +84,7 @@ static void hl_save(const void *ip, const struct xt_entry_match *match)
 }
 
 static int hl_xlate(const struct xt_entry_match *match,
-                   struct xt_buf *buf, int numeric)
+                   struct xt_xlate *xl, int numeric)
 {
        static const char *const op[] = {
                [IP6T_HL_EQ] = "",
@@ -95,7 +95,7 @@ static int hl_xlate(const struct xt_entry_match *match,
        const struct ip6t_hl_info *info =
                (struct ip6t_hl_info *) match->data;
 
-       xt_buf_add(buf, "ip6 hoplimit %s%u ", op[info->mode], info->hop_limit);
+       xt_xlate_add(xl, "ip6 hoplimit %s%u ", op[info->mode], info->hop_limit);
 
        return 1;
 }
index e5291418250ea85bb54b9b3867559b0e1f80dc9b..45835a97fea89e8def6746e3e72d555afc0fa257 100644 (file)
@@ -243,27 +243,27 @@ static void DNAT_save(const void *ip, const struct xt_entry_target *target)
 }
 
 static void print_range_xlate(const struct nf_nat_ipv4_range *r,
-                       struct xt_buf *buf)
+                       struct xt_xlate *xl)
 {
        if (r->flags & NF_NAT_RANGE_MAP_IPS) {
                struct in_addr a;
 
                a.s_addr = r->min_ip;
-               xt_buf_add(buf, "%s", xtables_ipaddr_to_numeric(&a));
+               xt_xlate_add(xl, "%s", xtables_ipaddr_to_numeric(&a));
                if (r->max_ip != r->min_ip) {
                        a.s_addr = r->max_ip;
-                       xt_buf_add(buf, "-%s", xtables_ipaddr_to_numeric(&a));
+                       xt_xlate_add(xl, "-%s", xtables_ipaddr_to_numeric(&a));
                }
        }
        if (r->flags & NF_NAT_RANGE_PROTO_SPECIFIED) {
-               xt_buf_add(buf, ":%hu", ntohs(r->min.tcp.port));
+               xt_xlate_add(xl, ":%hu", ntohs(r->min.tcp.port));
                if (r->max.tcp.port != r->min.tcp.port)
-                       xt_buf_add(buf, "-%hu", ntohs(r->max.tcp.port));
+                       xt_xlate_add(xl, "-%hu", ntohs(r->max.tcp.port));
        }
 }
 
 static int DNAT_xlate(const struct xt_entry_target *target,
-                     struct xt_buf *buf, int numeric)
+                     struct xt_xlate *xl, int numeric)
 {
        const struct ipt_natinfo *info = (const void *)target;
        unsigned int i = 0;
@@ -271,16 +271,16 @@ static int DNAT_xlate(const struct xt_entry_target *target,
        const char *sep = " ";
 
        for (i = 0; i < info->mr.rangesize; i++) {
-               xt_buf_add(buf, "dnat ");
-               print_range_xlate(&info->mr.range[i], buf);
+               xt_xlate_add(xl, "dnat ");
+               print_range_xlate(&info->mr.range[i], xl);
                if (info->mr.range[i].flags & NF_NAT_RANGE_PROTO_RANDOM) {
-                       xt_buf_add(buf, " random");
+                       xt_xlate_add(xl, " random");
                        sep_need = true;
                }
                if (info->mr.range[i].flags & NF_NAT_RANGE_PERSISTENT) {
                        if (sep_need)
                                sep = ",";
-                       xt_buf_add(buf, "%spersistent", sep);
+                       xt_xlate_add(xl, "%spersistent", sep);
                }
        }
 
index f2beee38a79d6a7a5a5228ed71255eea0393fb52..f3875b6738fe38237cce0020003328fadd08a7cb 100644 (file)
@@ -183,19 +183,19 @@ static const struct ipt_log_xlate ipt_log_xlate_names[] = {
 };
 
 static int LOG_xlate(const struct xt_entry_target *target,
-                    struct xt_buf *buf, int numeric)
+                    struct xt_xlate *xl, int numeric)
 {
        unsigned int i = 0;
        const struct ipt_log_info *loginfo =
                        (const struct ipt_log_info *)target->data;
 
-       xt_buf_add(buf, "log ");
+       xt_xlate_add(xl, "log ");
        if (strcmp(loginfo->prefix, "") != 0)
-               xt_buf_add(buf, "prefix \\\"%s\\\" ", loginfo->prefix);
+               xt_xlate_add(xl, "prefix \\\"%s\\\" ", loginfo->prefix);
 
        for (i = 0; i < ARRAY_SIZE(ipt_log_xlate_names); ++i)
                if (loginfo->level == ipt_log_xlate_names[i].level) {
-                       xt_buf_add(buf, "level %s ",
+                       xt_xlate_add(xl, "level %s ",
                                   ipt_log_xlate_names[i].name);
                        break;
                }
index 2e5b33dd3cc936abfeeb43120038329e2cc70856..68efe96ff02ecaa48b497f3840330e1068e9261e 100644 (file)
@@ -136,18 +136,18 @@ static void REDIRECT_save(const void *ip, const struct xt_entry_target *target)
 }
 
 static int REDIRECT_xlate(const struct xt_entry_target *target,
-                         struct xt_buf *buf, int numeric)
+                         struct xt_xlate *xl, int numeric)
 {
        const struct nf_nat_ipv4_multi_range_compat *mr =
                                        (const void *)target->data;
        const struct nf_nat_ipv4_range *r = &mr->range[0];
 
        if (r->flags & NF_NAT_RANGE_PROTO_SPECIFIED) {
-               xt_buf_add(buf, "redirect to %hu", ntohs(r->min.tcp.port));
+               xt_xlate_add(xl, "redirect to %hu", ntohs(r->min.tcp.port));
                if (r->max.tcp.port != r->min.tcp.port)
-                       xt_buf_add(buf, "-%hu ", ntohs(r->max.tcp.port));
+                       xt_xlate_add(xl, "-%hu ", ntohs(r->max.tcp.port));
                if (mr->range[0].flags & NF_NAT_RANGE_PROTO_RANDOM)
-                       xt_buf_add(buf, " random ");
+                       xt_xlate_add(xl, " random ");
        }
 
        return 1;
index dd4ac6295d1e0ea06ac6ed2d9c8b1e3a4fa0ead0..56fc346052abacc6a8ccd1cfa1768574c2506052 100644 (file)
@@ -160,7 +160,7 @@ static const struct reject_names_xlate reject_table_xlate[] = {
 };
 
 static int REJECT_xlate(const struct xt_entry_target *target,
-                       struct xt_buf *buf, int numeric)
+                       struct xt_xlate *xl, int numeric)
 {
        const struct ipt_reject_info *reject =
                (const struct ipt_reject_info *)target->data;
@@ -172,10 +172,10 @@ static int REJECT_xlate(const struct xt_entry_target *target,
        }
 
        if (reject->with == IPT_TCP_RESET)
-               xt_buf_add(buf, "reject with %s",
+               xt_xlate_add(xl, "reject with %s",
                           reject_table_xlate[i].name);
        else
-               xt_buf_add(buf, "reject with icmp type %s",
+               xt_xlate_add(xl, "reject with icmp type %s",
                           reject_table_xlate[i].name);
 
        return 1;
index 42fe92def15e0fba9bceef2813c323390f3ce045..1962e66e1291daf0dec3a696e013dfaab8a59048 100644 (file)
@@ -253,28 +253,28 @@ static void SNAT_save(const void *ip, const struct xt_entry_target *target)
 }
 
 static void print_range_xlate(const struct nf_nat_ipv4_range *r,
-                             struct xt_buf *buf)
+                             struct xt_xlate *xl)
 {
        if (r->flags & NF_NAT_RANGE_MAP_IPS) {
                struct in_addr a;
 
                a.s_addr = r->min_ip;
-               xt_buf_add(buf, "%s", xtables_ipaddr_to_numeric(&a));
+               xt_xlate_add(xl, "%s", xtables_ipaddr_to_numeric(&a));
                if (r->max_ip != r->min_ip) {
                        a.s_addr = r->max_ip;
-                       xt_buf_add(buf, "-%s", xtables_ipaddr_to_numeric(&a));
+                       xt_xlate_add(xl, "-%s", xtables_ipaddr_to_numeric(&a));
                }
        }
        if (r->flags & NF_NAT_RANGE_PROTO_SPECIFIED) {
-               xt_buf_add(buf, ":");
-               xt_buf_add(buf, "%hu", ntohs(r->min.tcp.port));
+               xt_xlate_add(xl, ":");
+               xt_xlate_add(xl, "%hu", ntohs(r->min.tcp.port));
                if (r->max.tcp.port != r->min.tcp.port)
-                       xt_buf_add(buf, "-%hu", ntohs(r->max.tcp.port));
+                       xt_xlate_add(xl, "-%hu", ntohs(r->max.tcp.port));
        }
 }
 
 static int SNAT_xlate(const struct xt_entry_target *target,
-                     struct xt_buf *buf, int numeric)
+                     struct xt_xlate *xl, int numeric)
 {
        const struct ipt_natinfo *info = (const void *)target;
        unsigned int i = 0;
@@ -282,22 +282,22 @@ static int SNAT_xlate(const struct xt_entry_target *target,
        const char *sep = " ";
 
        for (i = 0; i < info->mr.rangesize; i++) {
-               xt_buf_add(buf, "snat ");
-               print_range_xlate(&info->mr.range[i], buf);
+               xt_xlate_add(xl, "snat ");
+               print_range_xlate(&info->mr.range[i], xl);
                if (info->mr.range[i].flags & NF_NAT_RANGE_PROTO_RANDOM) {
-                       xt_buf_add(buf, " random");
+                       xt_xlate_add(xl, " random");
                        sep_need = true;
                }
                if (info->mr.range[i].flags & NF_NAT_RANGE_PROTO_RANDOM_FULLY) {
                        if (sep_need)
                                sep = ",";
-                       xt_buf_add(buf, "%sfully-random", sep);
+                       xt_xlate_add(xl, "%sfully-random", sep);
                        sep_need = true;
                }
                if (info->mr.range[i].flags & NF_NAT_RANGE_PERSISTENT) {
                        if (sep_need)
                                sep = ",";
-                       xt_buf_add(buf, "%spersistent", sep);
+                       xt_xlate_add(xl, "%spersistent", sep);
                }
        }
 
index 8973e49c18ba1822b32916ef9f94838971b8db07..a7d119369d9fb34af1c0b2de9bc9deafd31cf733 100644 (file)
@@ -93,18 +93,18 @@ static void ah_save(const void *ip, const struct xt_entry_match *match)
 }
 
 static int ah_xlate(const struct xt_entry_match *match,
-                   struct xt_buf *buf, int numeric)
+                   struct xt_xlate *xl, int numeric)
 {
        const struct ipt_ah *ahinfo = (struct ipt_ah *)match->data;
 
        if (!(ahinfo->spis[0] == 0 && ahinfo->spis[1] == 0xFFFFFFFF)) {
-               xt_buf_add(buf, "ah spi%s ",
+               xt_xlate_add(xl, "ah spi%s ",
                           (ahinfo->invflags & IPT_AH_INV_SPI) ? " !=" : "");
                if (ahinfo->spis[0] != ahinfo->spis[1])
-                       xt_buf_add(buf, "%u-%u ", ahinfo->spis[0],
+                       xt_xlate_add(xl, "%u-%u ", ahinfo->spis[0],
                                   ahinfo->spis[1]);
                else
-                       xt_buf_add(buf, "%u ", ahinfo->spis[0]);
+                       xt_xlate_add(xl, "%u ", ahinfo->spis[0]);
        }
 
        return 1;
index d0160408769d8a1ad9fc73b3e4386919ead30fb5..7dba93fe99e70f5f9be87b0192d42a0b43d4a81e 100644 (file)
@@ -110,27 +110,27 @@ static void realm_save(const void *ip, const struct xt_entry_match *match)
 
 static void
 print_realm_xlate(unsigned long id, unsigned long mask,
-                 int numeric, struct xt_buf *buf, uint32_t op)
+                 int numeric, struct xt_xlate *xl, uint32_t op)
 {
        const char *name = NULL;
 
        if (mask != 0xffffffff)
-               xt_buf_add(buf, " and 0x%lx %s 0x%lx ", id,
+               xt_xlate_add(xl, " and 0x%lx %s 0x%lx ", id,
                           op == XT_OP_EQ ? "==" : "!=", mask);
        else {
                if (numeric == 0)
                        name = xtables_lmap_id2name(realms, id);
                if (name)
-                       xt_buf_add(buf, "%s%s ",
+                       xt_xlate_add(xl, "%s%s ",
                                   op == XT_OP_EQ ? "" : "!= ", name);
                else
-                       xt_buf_add(buf, " %s0x%lx ",
+                       xt_xlate_add(xl, " %s0x%lx ",
                                   op == XT_OP_EQ ? "" : "!= ", id);
        }
 }
 
 static int realm_xlate(const struct xt_entry_match *match,
-                      struct xt_buf *buf, int numeric)
+                      struct xt_xlate *xl, int numeric)
 {
        const struct xt_realm_info *ri = (const void *)match->data;
        enum xt_op op = XT_OP_EQ;
@@ -138,8 +138,8 @@ static int realm_xlate(const struct xt_entry_match *match,
        if (ri->invert)
                op = XT_OP_NEQ;
 
-       xt_buf_add(buf, "rtclassid");
-       print_realm_xlate(ri->id, ri->mask, 0, buf, op);
+       xt_xlate_add(xl, "rtclassid");
+       print_realm_xlate(ri->id, ri->mask, 0, xl, op);
 
        return 1;
 }
index c952502d689b1dc07e6082d65b17891f6931fb29..bd19cd2c94d67cfb223e4824b53eafa07baac361 100644 (file)
@@ -101,30 +101,30 @@ static void ttl_save(const void *ip, const struct xt_entry_match *match)
 }
 
 static int ttl_xlate(const struct xt_entry_match *match,
-                    struct xt_buf *buf, int numeric)
+                    struct xt_xlate *xl, int numeric)
 {
        const struct ipt_ttl_info *info =
                        (struct ipt_ttl_info *) match->data;
 
                switch (info->mode) {
                case IPT_TTL_EQ:
-                       xt_buf_add(buf, "ip ttl");
+                       xt_xlate_add(xl, "ip ttl");
                        break;
                case IPT_TTL_NE:
-                       xt_buf_add(buf, "ip ttl !=");
+                       xt_xlate_add(xl, "ip ttl !=");
                        break;
                case IPT_TTL_LT:
-                       xt_buf_add(buf, "ip ttl lt");
+                       xt_xlate_add(xl, "ip ttl lt");
                        break;
                case IPT_TTL_GT:
-                       xt_buf_add(buf, "ip ttl gt");
+                       xt_xlate_add(xl, "ip ttl gt");
                        break;
                default:
                        /* Should not happen. */
                        break;
        }
 
-       xt_buf_add(buf, " %u ", info->ttl);
+       xt_xlate_add(xl, " %u ", info->ttl);
 
        return 1;
 }
index 4f9024abdd5f46ef6a197480d9cca9b1272e9e87..e31a3c4b318d1cc16e367deb6704a2916bdb6402 100644 (file)
@@ -87,24 +87,24 @@ static void NFLOG_save(const void *ip, const struct xt_entry_target *target)
 }
 
 static void nflog_print_xlate(const struct xt_nflog_info *info,
-                             struct xt_buf *buf)
+                             struct xt_xlate *xl)
 {
-       xt_buf_add(buf, "log ");
+       xt_xlate_add(xl, "log ");
        if (info->prefix[0] != '\0')
-               xt_buf_add(buf, "prefix \\\"%s\\\" ", info->prefix);
+               xt_xlate_add(xl, "prefix \\\"%s\\\" ", info->prefix);
        if (info->len)
-               xt_buf_add(buf, "snaplen %u ", info->len);
+               xt_xlate_add(xl, "snaplen %u ", info->len);
        if (info->threshold != XT_NFLOG_DEFAULT_THRESHOLD)
-               xt_buf_add(buf, "queue-threshold %u ", info->threshold);
-       xt_buf_add(buf, "group %u ", info->group);
+               xt_xlate_add(xl, "queue-threshold %u ", info->threshold);
+       xt_xlate_add(xl, "group %u ", info->group);
 }
 
 static int NFLOG_xlate(const struct xt_entry_target *target,
-                      struct xt_buf *buf, int numeric)
+                      struct xt_xlate *xl, int numeric)
 {
        const struct xt_nflog_info *info = (struct xt_nflog_info *)target->data;
 
-       nflog_print_xlate(info, buf);
+       nflog_print_xlate(info, xl);
 
        return 1;
 }
index 087d4bf753d5b504f8cd19a78f65a0b2f2d10750..3d1926fdd8f21d88cf44d7679737ae60ccdb1de6 100644 (file)
@@ -124,18 +124,18 @@ connmark_mt_save(const void *ip, const struct xt_entry_match *match)
 }
 
 static void print_mark_xlate(unsigned int mark, unsigned int mask,
-                            struct xt_buf *buf, uint32_t op)
+                            struct xt_xlate *xl, uint32_t op)
 {
        if (mask != 0xffffffffU)
-               xt_buf_add(buf, " and 0x%x %s 0x%x ", mark,
+               xt_xlate_add(xl, " and 0x%x %s 0x%x ", mark,
                           op == XT_OP_EQ ? "==" : "!=", mask);
        else
-               xt_buf_add(buf, " %s0x%x ",
+               xt_xlate_add(xl, " %s0x%x ",
                           op == XT_OP_EQ ? "" : "!= ", mark);
 }
 
 static int connmark_xlate(const struct xt_entry_match *match,
-                         struct xt_buf *buf, int numeric)
+                         struct xt_xlate *xl, int numeric)
 {
        const struct xt_connmark_info *info = (const void *)match->data;
        enum xt_op op = XT_OP_EQ;
@@ -143,15 +143,15 @@ static int connmark_xlate(const struct xt_entry_match *match,
        if (info->invert)
                op = XT_OP_NEQ;
 
-       xt_buf_add(buf, "ct mark");
-       print_mark_xlate(info->mark, info->mask, buf, op);
+       xt_xlate_add(xl, "ct mark");
+       print_mark_xlate(info->mark, info->mask, xl, op);
 
        return 1;
 }
 
 static int
 connmark_mt_xlate(const struct xt_entry_match *match,
-                struct xt_buf *buf, int numeric)
+                struct xt_xlate *xl, int numeric)
 {
        const struct xt_connmark_mtinfo1 *info = (const void *)match->data;
        enum xt_op op = XT_OP_EQ;
@@ -159,8 +159,8 @@ connmark_mt_xlate(const struct xt_entry_match *match,
        if (info->invert)
                op = XT_OP_NEQ;
 
-       xt_buf_add(buf, "ct mark");
-       print_mark_xlate(info->mark, info->mask, buf, op);
+       xt_xlate_add(xl, "ct mark");
+       print_mark_xlate(info->mark, info->mask, xl, op);
 
        return 1;
 }
index 4c5b6e91598971bb06b12799b6cf189e9f73e4f6..7f66895d14f62f10e67c48fcaa877ce660a9c7b8 100644 (file)
@@ -1156,41 +1156,41 @@ static void state_save(const void *ip, const struct xt_entry_match *match)
        state_print_state(sinfo->statemask);
 }
 
-static void state_xlate_print(struct xt_buf *buf, unsigned int statemask)
+static void state_xlate_print(struct xt_xlate *xl, unsigned int statemask)
 {
        const char *sep = "";
 
        if (statemask & XT_CONNTRACK_STATE_INVALID) {
-               xt_buf_add(buf, "%s%s", sep, "invalid");
+               xt_xlate_add(xl, "%s%s", sep, "invalid");
                sep = ",";
        }
        if (statemask & XT_CONNTRACK_STATE_BIT(IP_CT_NEW)) {
-               xt_buf_add(buf, "%s%s", sep, "new");
+               xt_xlate_add(xl, "%s%s", sep, "new");
                sep = ",";
        }
        if (statemask & XT_CONNTRACK_STATE_BIT(IP_CT_RELATED)) {
-               xt_buf_add(buf, "%s%s", sep, "related");
+               xt_xlate_add(xl, "%s%s", sep, "related");
                sep = ",";
        }
        if (statemask & XT_CONNTRACK_STATE_BIT(IP_CT_ESTABLISHED)) {
-               xt_buf_add(buf, "%s%s", sep, "established");
+               xt_xlate_add(xl, "%s%s", sep, "established");
                sep = ",";
        }
        if (statemask & XT_CONNTRACK_STATE_UNTRACKED) {
-               xt_buf_add(buf, "%s%s", sep, "untracked");
+               xt_xlate_add(xl, "%s%s", sep, "untracked");
                sep = ",";
        }
 }
 
-static int state_xlate(const struct xt_entry_match *match, struct xt_buf *buf,
+static int state_xlate(const struct xt_entry_match *match, struct xt_xlate *xl,
                       int numeric)
 {
        const struct xt_conntrack_mtinfo3 *sinfo = (const void *)match->data;
 
-       xt_buf_add(buf, "ct state %s", sinfo->invert_flags & XT_CONNTRACK_STATE ?
+       xt_xlate_add(xl, "ct state %s", sinfo->invert_flags & XT_CONNTRACK_STATE ?
                                        "!= " : "");
-       state_xlate_print(buf, sinfo->state_mask);
-       xt_buf_add(buf, " ");
+       state_xlate_print(xl, sinfo->state_mask);
+       xt_xlate_add(xl, " ");
        return 1;
 }
 
index 74e6077eb1d953a5fba7198bb5d094e776342666..02286c285e98390dcb82c06758822b655ec5fe43 100644 (file)
@@ -45,11 +45,11 @@ static void cpu_save(const void *ip, const struct xt_entry_match *match)
 }
 
 static int cpu_xlate(const struct xt_entry_match *match,
-                    struct xt_buf *buf, int numeric)
+                    struct xt_xlate *xl, int numeric)
 {
        const struct xt_cpu_info *info = (void *)match->data;
 
-       xt_buf_add(buf, "cpu%s %u ", info->invert ? " !=" : "", info->cpu);
+       xt_xlate_add(xl, "cpu%s %u ", info->invert ? " !=" : "", info->cpu);
 
        return 1;
 }
index 645f2f31df22fda02226686aa564a2eead9de597..fd67bc3c219f4ac48cdfe7c7ef694cb483526ae4 100644 (file)
@@ -153,52 +153,52 @@ static void devgroup_check(struct xt_fcheck_call *cb)
 
 static void
 print_devgroup_xlate(unsigned int id, uint32_t op,  unsigned int mask,
-                    struct xt_buf *buf, int numeric)
+                    struct xt_xlate *xl, int numeric)
 {
        const char *name = NULL;
 
        if (mask != 0xffffffff)
-               xt_buf_add(buf, "and 0x%x %s 0x%x ", id,
+               xt_xlate_add(xl, "and 0x%x %s 0x%x ", id,
                           op == XT_OP_EQ ? "==" : "!=", mask);
        else {
                if (numeric == 0)
                        name = xtables_lmap_id2name(devgroups, id);
                if (name)
-                       xt_buf_add(buf, "%s ", name);
+                       xt_xlate_add(xl, "%s ", name);
                else
-                       xt_buf_add(buf, "%s0x%x ",
+                       xt_xlate_add(xl, "%s0x%x ",
                                   op == XT_OP_EQ ? "" : "!= ", id);
        }
 }
 
 static void devgroup_show_xlate(const struct xt_devgroup_info *info,
-                               struct xt_buf *buf, int numeric)
+                               struct xt_xlate *xl, int numeric)
 {
        enum xt_op op = XT_OP_EQ;
 
        if (info->flags & XT_DEVGROUP_MATCH_SRC) {
                if (info->flags & XT_DEVGROUP_INVERT_SRC)
                        op = XT_OP_NEQ;
-               xt_buf_add(buf, "iifgroup ");
+               xt_xlate_add(xl, "iifgroup ");
                print_devgroup_xlate(info->src_group, op,
-                                    info->src_mask, buf, numeric);
+                                    info->src_mask, xl, numeric);
        }
 
        if (info->flags & XT_DEVGROUP_MATCH_DST) {
                if (info->flags & XT_DEVGROUP_INVERT_DST)
                        op = XT_OP_NEQ;
-               xt_buf_add(buf, "oifgroup ");
+               xt_xlate_add(xl, "oifgroup ");
                print_devgroup_xlate(info->dst_group, op,
-                                    info->dst_mask, buf, numeric);
+                                    info->dst_mask, xl, numeric);
        }
 }
 
 static int devgroup_xlate(const struct xt_entry_match *match,
-                         struct xt_buf *buf, int numeric)
+                         struct xt_xlate *xl, int numeric)
 {
        const struct xt_devgroup_info *info = (const void *)match->data;
 
-       devgroup_show_xlate(info, buf, 0);
+       devgroup_show_xlate(info, xl, 0);
 
        return 1;
 }
index e04daf82e2f3c86508ae25505cd7d2f345b99777..b5219fd9381b15bfb9583cc28ba9dd2612510539 100644 (file)
@@ -87,18 +87,18 @@ static void esp_save(const void *ip, const struct xt_entry_match *match)
 }
 
 static int esp_xlate(const struct xt_entry_match *match,
-                    struct xt_buf *buf, int numeric)
+                    struct xt_xlate *xl, int numeric)
 {
        const struct xt_esp *espinfo = (struct xt_esp *)match->data;
 
        if (!(espinfo->spis[0] == 0 && espinfo->spis[1] == 0xFFFFFFFF)) {
-               xt_buf_add(buf, "esp spi%s",
+               xt_xlate_add(xl, "esp spi%s",
                           (espinfo->invflags & XT_ESP_INV_SPI) ? " !=" : "");
                if (espinfo->spis[0] != espinfo->spis[1])
-                       xt_buf_add(buf, " %u-%u ", espinfo->spis[0],
+                       xt_xlate_add(xl, " %u-%u ", espinfo->spis[0],
                                   espinfo->spis[1]);
                else
-                       xt_buf_add(buf, " %u ", espinfo->spis[0]);
+                       xt_xlate_add(xl, " %u ", espinfo->spis[0]);
        }
 
        return 1;
index 971ce4ab7e9fca54a1edde53646bd4141aa97d7c..9df4163067fe918bbac7f213cab7c376dce5a3ea 100644 (file)
@@ -46,11 +46,11 @@ static void helper_save(const void *ip, const struct xt_entry_match *match)
 }
 
 static int helper_xlate(const struct xt_entry_match *match,
-                       struct xt_buf *buf, int numeric)
+                       struct xt_xlate *xl, int numeric)
 {
        const struct xt_helper_info *info = (const void *)match->data;
 
-       xt_buf_add(buf, "ct helper%s \\\"%s\\\" ",
+       xt_xlate_add(xl, "ct helper%s \\\"%s\\\" ",
                   info->invert ? " !=" : "", info->name);
 
        return 1;
index 9cf6225e691279c735fc0c3f105f51cf4fedbcce..0b05651bc9b1a64070185a72f2af6390ea7950fa 100644 (file)
@@ -304,57 +304,57 @@ static void iprange_mt6_save(const void *ip, const struct xt_entry_match *match)
 
 static void
 print_iprange_xlate(const struct ipt_iprange *range,
-                   struct xt_buf *buf)
+                   struct xt_xlate *xl)
 {
        const unsigned char *byte_min, *byte_max;
 
        byte_min = (const unsigned char *)&range->min_ip;
        byte_max = (const unsigned char *)&range->max_ip;
-       xt_buf_add(buf, " %u.%u.%u.%u-%u.%u.%u.%u ",
+       xt_xlate_add(xl, " %u.%u.%u.%u-%u.%u.%u.%u ",
                   byte_min[0], byte_min[1], byte_min[2], byte_min[3],
                   byte_max[0], byte_max[1], byte_max[2], byte_max[3]);
 }
 
 static int iprange_xlate(const struct xt_entry_match *match,
-                        struct xt_buf *buf, int numeric)
+                        struct xt_xlate *xl, int numeric)
 {
        const struct ipt_iprange_info *info = (const void *)match->data;
 
        if (info->flags & IPRANGE_SRC) {
                if (info->flags & IPRANGE_SRC_INV)
-                       xt_buf_add(buf, " !=");
-               xt_buf_add(buf, " ip saddr");
-               print_iprange_xlate(&info->src, buf);
+                       xt_xlate_add(xl, " !=");
+               xt_xlate_add(xl, " ip saddr");
+               print_iprange_xlate(&info->src, xl);
        }
        if (info->flags & IPRANGE_DST) {
                if (info->flags & IPRANGE_DST_INV)
-                       xt_buf_add(buf, " !=");
-               xt_buf_add(buf, " ip daddr");
-               print_iprange_xlate(&info->dst, buf);
+                       xt_xlate_add(xl, " !=");
+               xt_xlate_add(xl, " ip daddr");
+               print_iprange_xlate(&info->dst, xl);
        }
 
        return 1;
 }
 
 static int iprange_mt4_xlate(const struct xt_entry_match *match,
-                            struct xt_buf *buf, int numeric)
+                            struct xt_xlate *xl, int numeric)
 {
        const struct xt_iprange_mtinfo *info = (const void *)match->data;
 
        if (info->flags & IPRANGE_SRC) {
                if (info->flags & IPRANGE_SRC_INV)
-                       xt_buf_add(buf, " !=");
-               xt_buf_add(buf, " ip saddr %s",
+                       xt_xlate_add(xl, " !=");
+               xt_xlate_add(xl, " ip saddr %s",
                           xtables_ipaddr_to_numeric(&info->src_min.in));
-               xt_buf_add(buf, "-%s ",
+               xt_xlate_add(xl, "-%s ",
                           xtables_ipaddr_to_numeric(&info->src_max.in));
        }
        if (info->flags & IPRANGE_DST) {
                if (info->flags & IPRANGE_DST_INV)
-                       xt_buf_add(buf, " !=");
-               xt_buf_add(buf, " ip daddr %s",
+                       xt_xlate_add(xl, " !=");
+               xt_xlate_add(xl, " ip daddr %s",
                           xtables_ipaddr_to_numeric(&info->dst_min.in));
-               xt_buf_add(buf, "-%s ",
+               xt_xlate_add(xl, "-%s ",
                           xtables_ipaddr_to_numeric(&info->dst_max.in));
        }
 
@@ -362,24 +362,24 @@ static int iprange_mt4_xlate(const struct xt_entry_match *match,
 }
 
 static int iprange_mt6_xlate(const struct xt_entry_match *match,
-                            struct xt_buf *buf, int numeric)
+                            struct xt_xlate *xl, int numeric)
 {
        const struct xt_iprange_mtinfo *info = (const void *)match->data;
 
        if (info->flags & IPRANGE_SRC) {
                if (info->flags & IPRANGE_SRC_INV)
-                       xt_buf_add(buf, " !=");
-               xt_buf_add(buf, " ip saddr %s",
+                       xt_xlate_add(xl, " !=");
+               xt_xlate_add(xl, " ip saddr %s",
                           xtables_ip6addr_to_numeric(&info->src_min.in6));
-               xt_buf_add(buf, "-%s ",
+               xt_xlate_add(xl, "-%s ",
                           xtables_ip6addr_to_numeric(&info->src_max.in6));
        }
        if (info->flags & IPRANGE_DST) {
                if (info->flags & IPRANGE_DST_INV)
-                       xt_buf_add(buf, " !=");
-               xt_buf_add(buf, " ip daddr %s",
+                       xt_xlate_add(xl, " !=");
+               xt_xlate_add(xl, " ip daddr %s",
                           xtables_ip6addr_to_numeric(&info->dst_min.in6));
-               xt_buf_add(buf, "-%s ",
+               xt_xlate_add(xl, "-%s ",
                           xtables_ip6addr_to_numeric(&info->dst_max.in6));
        }
 
index 96dab0cf434892da804cd47bed5646d24c96cdbd..00acae0e6a11df165cc6e8300414bdbacb8c93d1 100644 (file)
@@ -57,15 +57,15 @@ static void length_save(const void *ip, const struct xt_entry_match *match)
 }
 
 static int length_xlate(const struct xt_entry_match *match,
-                       struct xt_buf *buf, int numeric)
+                       struct xt_xlate *xl, int numeric)
 {
        const struct xt_length_info *info = (void *)match->data;
 
-       xt_buf_add(buf, "meta length %s", info->invert ? "!= " : "");
+       xt_xlate_add(xl, "meta length %s", info->invert ? "!= " : "");
        if (info->min == info->max)
-               xt_buf_add(buf, "%u ", info->min);
+               xt_xlate_add(xl, "%u ", info->min);
        else
-               xt_buf_add(buf, "%u-%u ", info->min, info->max);
+               xt_xlate_add(xl, "%u-%u ", info->min, info->max);
 
        return 1;
 }
index a018f87b32b1100a31603c5890f8f02610f8e73f..9ad00c1463ba5d3379e7591e6905ce23b099ff1d 100644 (file)
@@ -159,12 +159,12 @@ static const struct rates rates_xlate[] = {
        { "second",     XT_LIMIT_SCALE }
 };
 
-static void print_rate_xlate(uint32_t period, struct xt_buf *buf)
+static void print_rate_xlate(uint32_t period, struct xt_xlate *xl)
 {
        unsigned int i;
 
        if (period == 0) {
-               xt_buf_add(buf, " %f ", INFINITY);
+               xt_xlate_add(xl, " %f ", INFINITY);
                return;
        }
 
@@ -173,19 +173,19 @@ static void print_rate_xlate(uint32_t period, struct xt_buf *buf)
                    rates_xlate[i].mult / period < rates_xlate[i].mult % period)
                        break;
 
-       xt_buf_add(buf, " %u/%s ", rates_xlate[i - 1].mult / period,
+       xt_xlate_add(xl, " %u/%s ", rates_xlate[i - 1].mult / period,
                   rates_xlate[i - 1].name);
 }
 
 static int limit_xlate(const struct xt_entry_match *match,
-                      struct xt_buf *buf, int numeric)
+                      struct xt_xlate *xl, int numeric)
 {
        const struct xt_rateinfo *r = (const void *)match->data;
 
-       xt_buf_add(buf, "limit rate");
-       print_rate_xlate(r->avg, buf);
+       xt_xlate_add(xl, "limit rate");
+       print_rate_xlate(r->avg, xl);
        if (r->burst != XT_LIMIT_BURST)
-               xt_buf_add(buf, "burst %u packets ", r->burst);
+               xt_xlate_add(xl, "burst %u packets ", r->burst);
 
        return 1;
 }
index d7303440edb92eecf4d36bade7f07a7d3cf9b663..85ed1b5becf51ec42538594f5f31f2307f97573f 100644 (file)
@@ -71,23 +71,23 @@ static void mac_save(const void *ip, const struct xt_entry_match *match)
 }
 
 static void print_mac_xlate(const unsigned char *macaddress,
-                           struct xt_buf *buf)
+                           struct xt_xlate *xl)
 {
        unsigned int i;
 
-       xt_buf_add(buf, "%02x", macaddress[0]);
+       xt_xlate_add(xl, "%02x", macaddress[0]);
        for (i = 1; i < ETH_ALEN; ++i)
-               xt_buf_add(buf, ":%02x", macaddress[i]);
-       xt_buf_add(buf, " ");
+               xt_xlate_add(xl, ":%02x", macaddress[i]);
+       xt_xlate_add(xl, " ");
 }
 
 static int mac_xlate(const struct xt_entry_match *match,
-                    struct xt_buf *buf, int numeric)
+                    struct xt_xlate *xl, int numeric)
 {
        const struct xt_mac_info *info = (void *)match->data;
 
-       xt_buf_add(buf, "ether saddr%s ", info->invert ? " !=" : "");
-       print_mac_xlate(info->srcaddr, buf);
+       xt_xlate_add(xl, "ether saddr%s ", info->invert ? " !=" : "");
+       print_mac_xlate(info->srcaddr, xl);
 
        return 1;
 }
index 93d38d90ec99cf16d0973d5eedd7a9ab6b72fa46..b8c0ed66bb7498978e4bf4dbc6e99427209dc80d 100644 (file)
@@ -103,20 +103,20 @@ mark_save(const void *ip, const struct xt_entry_match *match)
 }
 
 static void
-print_mark_xlate(struct xt_buf *buf, unsigned int mark,
+print_mark_xlate(struct xt_xlate *xl, unsigned int mark,
                 unsigned int mask, uint32_t op)
 {
        if (mask != 0xffffffffU)
-               xt_buf_add(buf, " and 0x%x %s 0x%x ", mark,
+               xt_xlate_add(xl, " and 0x%x %s 0x%x ", mark,
                           op == XT_OP_EQ ? "==" : "!=", mask);
        else
-               xt_buf_add(buf, " %s0x%x ",
+               xt_xlate_add(xl, " %s0x%x ",
                           op == XT_OP_EQ ? "" : "!= ", mark);
 }
 
 static int
 mark_mt_xlate(const struct xt_entry_match *match,
-             struct xt_buf *buf, int numeric)
+             struct xt_xlate *xl, int numeric)
 {
        const struct xt_mark_mtinfo1 *info = (const void *)match->data;
        enum xt_op op = XT_OP_EQ;
@@ -124,15 +124,15 @@ mark_mt_xlate(const struct xt_entry_match *match,
        if (info->invert)
                op = XT_OP_NEQ;
 
-       xt_buf_add(buf, "mark");
-       print_mark_xlate(buf, info->mark, info->mask, op);
+       xt_xlate_add(xl, "mark");
+       print_mark_xlate(xl, info->mark, info->mask, op);
 
        return 1;
 }
 
 static int
 mark_xlate(const struct xt_entry_match *match,
-          struct xt_buf *buf, int numeric)
+          struct xt_xlate *xl, int numeric)
 {
        const struct xt_mark_info *info = (const void *)match->data;
        enum xt_op op = XT_OP_EQ;
@@ -140,8 +140,8 @@ mark_xlate(const struct xt_entry_match *match,
        if (info->invert)
                op = XT_OP_NEQ;
 
-       xt_buf_add(buf, "mark");
-       print_mark_xlate(buf, info->mark, info->mask, op);
+       xt_xlate_add(xl, "mark");
+       print_mark_xlate(xl, info->mark, info->mask, op);
 
        return 1;
 }
index f572e831f0136c09c28f76c03a2848b231ea8253..55edf279a692da0d8615a286a6e6bdedba0b5cd2 100644 (file)
@@ -127,26 +127,26 @@ static const struct pkttypes_xlate supported_types_xlate[] = {
 };
 
 static void print_pkttype_xlate(const struct xt_pkttype_info *info,
-                               struct xt_buf *buf)
+                               struct xt_xlate *xl)
 {
        unsigned int i;
 
        for (i = 0; i < ARRAY_SIZE(supported_types_xlate); ++i) {
                if (supported_types_xlate[i].pkttype == info->pkttype) {
-                       xt_buf_add(buf, "%s ", supported_types_xlate[i].name);
+                       xt_xlate_add(xl, "%s ", supported_types_xlate[i].name);
                        return;
                }
        }
-       xt_buf_add(buf, "%d", info->pkttype);
+       xt_xlate_add(xl, "%d", info->pkttype);
 }
 
 static int pkttype_xlate(const struct xt_entry_match *match,
-                         struct xt_buf *buf, int numeric)
+                         struct xt_xlate *xl, int numeric)
 {
        const struct xt_pkttype_info *info = (const void *)match->data;
 
-       xt_buf_add(buf, "pkttype%s ", info->invert ? " !=" : "");
-       print_pkttype_xlate(info, buf);
+       xt_xlate_add(xl, "pkttype%s ", info->invert ? " !=" : "");
+       print_pkttype_xlate(info, xl);
 
        return 1;
 }
index 2a454ea2dd835bf231305761b80c727c7586090a..bd4ca77ddb2c4e75c8316c7cebcba411c356ae31 100644 (file)
@@ -371,7 +371,7 @@ static const struct tcp_flag_names tcp_flag_names_xlate[] = {
        { "urg", 0x20 },
 };
 
-static void print_tcp_xlate(struct xt_buf *buf, uint8_t flags)
+static void print_tcp_xlate(struct xt_xlate *xl, uint8_t flags)
 {
        int have_flag = 0;
 
@@ -381,31 +381,31 @@ static void print_tcp_xlate(struct xt_buf *buf, uint8_t flags)
                for (i = 0; (flags & tcp_flag_names_xlate[i].flag) == 0; i++);
 
                if (have_flag)
-                       xt_buf_add(buf, "|");
+                       xt_xlate_add(xl, "|");
 
-               xt_buf_add(buf, "%s", tcp_flag_names_xlate[i].name);
+               xt_xlate_add(xl, "%s", tcp_flag_names_xlate[i].name);
                have_flag = 1;
 
                flags &= ~tcp_flag_names_xlate[i].flag;
        }
 
        if (!have_flag)
-               xt_buf_add(buf, "none");
+               xt_xlate_add(xl, "none");
 }
 
-static int tcp_xlate(const struct xt_entry_match *match, struct xt_buf *buf,
+static int tcp_xlate(const struct xt_entry_match *match, struct xt_xlate *xl,
                     int numeric)
 {
        const struct xt_tcp *tcpinfo = (const struct xt_tcp *)match->data;
 
        if (tcpinfo->spts[0] != 0 || tcpinfo->spts[1] != 0xffff) {
                if (tcpinfo->spts[0] != tcpinfo->spts[1]) {
-                       xt_buf_add(buf, "tcp sport %s%u-%u ",
+                       xt_xlate_add(xl, "tcp sport %s%u-%u ",
                                   tcpinfo->invflags & XT_TCP_INV_SRCPT ?
                                        "!= " : "",
                                   tcpinfo->spts[0], tcpinfo->spts[1]);
                } else {
-                       xt_buf_add(buf, "tcp sport %s%u ",
+                       xt_xlate_add(xl, "tcp sport %s%u ",
                                   tcpinfo->invflags & XT_TCP_INV_SRCPT ?
                                        "!= " : "",
                                   tcpinfo->spts[0]);
@@ -414,12 +414,12 @@ static int tcp_xlate(const struct xt_entry_match *match, struct xt_buf *buf,
 
        if (tcpinfo->dpts[0] != 0 || tcpinfo->dpts[1] != 0xffff) {
                if (tcpinfo->dpts[0] != tcpinfo->dpts[1]) {
-                       xt_buf_add(buf, "tcp dport %s%u-%u ",
+                       xt_xlate_add(xl, "tcp dport %s%u-%u ",
                                   tcpinfo->invflags & XT_TCP_INV_DSTPT ?
                                        "!= " : "",
                                   tcpinfo->dpts[0], tcpinfo->dpts[1]);
                } else {
-                       xt_buf_add(buf, "tcp dport %s%u ",
+                       xt_xlate_add(xl, "tcp dport %s%u ",
                                   tcpinfo->invflags & XT_TCP_INV_DSTPT ?
                                        "!= " : "",
                                   tcpinfo->dpts[0]);
@@ -431,12 +431,12 @@ static int tcp_xlate(const struct xt_entry_match *match, struct xt_buf *buf,
                return 0;
 
        if (tcpinfo->flg_mask || (tcpinfo->invflags & XT_TCP_INV_FLAGS)) {
-               xt_buf_add(buf, "tcp flags & ");
-               print_tcp_xlate(buf, tcpinfo->flg_mask);
-               xt_buf_add(buf, " %s ",
+               xt_xlate_add(xl, "tcp flags & ");
+               print_tcp_xlate(xl, tcpinfo->flg_mask);
+               xt_xlate_add(xl, " %s ",
                           tcpinfo->invflags & XT_TCP_INV_FLAGS ? "!=": "==");
-               print_tcp_xlate(buf, tcpinfo->flg_cmp);
-               xt_buf_add(buf, " ");
+               print_tcp_xlate(xl, tcpinfo->flg_cmp);
+               xt_xlate_add(xl, " ");
        }
 
        return 1;
index 0b89df4f7410524682eb76b446abdb0c25540d7d..47c29e9dfde22230c890f12559a42040562a12b6 100644 (file)
@@ -152,19 +152,19 @@ 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_buf *buf,
+static int udp_xlate(const struct xt_entry_match *match, struct xt_xlate *xl,
                     int numeric)
 {
        const struct xt_udp *udpinfo = (struct xt_udp *)match->data;
 
        if (udpinfo->spts[0] != 0 || udpinfo->spts[1] != 0xFFFF) {
                if (udpinfo->spts[0] != udpinfo->spts[1]) {
-                       xt_buf_add(buf,"udp sport %s%u-%u ",
+                       xt_xlate_add(xl,"udp sport %s%u-%u ",
                                   udpinfo->invflags & XT_UDP_INV_SRCPT ?
                                         "!= ": "",
                                   udpinfo->spts[0], udpinfo->spts[1]);
                } else {
-                       xt_buf_add(buf, "udp sport %s%u ",
+                       xt_xlate_add(xl, "udp sport %s%u ",
                                   udpinfo->invflags & XT_UDP_INV_SRCPT ?
                                         "!= ": "",
                                   udpinfo->spts[0]);
@@ -173,12 +173,12 @@ static int udp_xlate(const struct xt_entry_match *match, struct xt_buf *buf,
 
        if (udpinfo->dpts[0] != 0 || udpinfo->dpts[1] != 0xFFFF) {
                if (udpinfo->dpts[0]  != udpinfo->dpts[1]) {
-                       xt_buf_add(buf,"udp dport %s%u-%u ",
+                       xt_xlate_add(xl,"udp dport %s%u-%u ",
                                   udpinfo->invflags & XT_UDP_INV_SRCPT ?
                                         "!= ": "",
                                   udpinfo->dpts[0], udpinfo->dpts[1]);
                } else {
-                       xt_buf_add(buf,"udp dport %s%u ",
+                       xt_xlate_add(xl,"udp dport %s%u ",
                                   udpinfo->invflags & XT_UDP_INV_SRCPT ?
                                         "!= ": "",
                                   udpinfo->dpts[0]);
index 175ae50b42a319a767587398d7dfc651d0e0dc76..82aa2bbe1f3ef4a255433c3ad2aa2c911af3d3d8 100644 (file)
@@ -205,7 +205,7 @@ enum xtables_ext_flags {
        XTABLES_EXT_ALIAS = 1 << 0,
 };
 
-struct xt_buf;
+struct xt_xlate;
 
 /* Include file for additions: new matches and targets. */
 struct xtables_match
@@ -272,7 +272,7 @@ struct xtables_match
        const struct xt_option_entry *x6_options;
 
        /* Translate iptables to nft */
-       int (*xlate)(const struct xt_entry_match *match, struct xt_buf *buf,
+       int (*xlate)(const struct xt_entry_match *match, struct xt_xlate *xl,
                     int numeric);
 
        /* Size of per-extension instance extra "global" scratch space */
@@ -353,7 +353,7 @@ struct xtables_target
        const struct xt_option_entry *x6_options;
 
        /* Translate iptables to nft */
-       int (*xlate)(const struct xt_entry_target *target, struct xt_buf *buf,
+       int (*xlate)(const struct xt_entry_target *target, struct xt_xlate *xl,
                     int numeric);
 
        size_t udata_size;
@@ -569,11 +569,11 @@ extern void xtables_lmap_free(struct xtables_lmap *);
 extern int xtables_lmap_name2id(const struct xtables_lmap *, const char *);
 extern const char *xtables_lmap_id2name(const struct xtables_lmap *, int);
 
-/* generic buffer */
-struct xt_buf *xt_buf_alloc(int size);
-void xt_buf_free(struct xt_buf *buf);
-void xt_buf_add(struct xt_buf *buf, const char *fmt, ...);
-const char *xt_buf_get(struct xt_buf *buf);
+/* xlate infrastructure */
+struct xt_xlate *xt_xlate_alloc(int size);
+void xt_xlate_free(struct xt_xlate *xl);
+void xt_xlate_add(struct xt_xlate *xl, const char *fmt, ...);
+const char *xt_xlate_get(struct xt_xlate *xl);
 
 #ifdef XTABLES_INTERNAL
 
index ede8f176227fab68f5e6a6412c2c125de87e8044..5e2857d38c322a0f0f067b5462d12e597e67cd62 100644 (file)
@@ -429,24 +429,24 @@ static void nft_ipv4_save_counters(const void *data)
        save_counters(cs->counters.pcnt, cs->counters.bcnt);
 }
 
-static int nft_ipv4_xlate(const void *data, struct xt_buf *buf)
+static int nft_ipv4_xlate(const void *data, struct xt_xlate *xl)
 {
        const struct iptables_command_state *cs = data;
        int ret;
 
        if (cs->fw.ip.iniface[0] != '\0') {
-               xt_buf_add(buf, "iifname %s%s ",
+               xt_xlate_add(xl, "iifname %s%s ",
                           cs->fw.ip.invflags & IPT_INV_VIA_IN ? "!= " : "",
                           cs->fw.ip.iniface);
        }
        if (cs->fw.ip.outiface[0] != '\0') {
-               xt_buf_add(buf, "oifname %s%s ",
+               xt_xlate_add(xl, "oifname %s%s ",
                           cs->fw.ip.invflags & IPT_INV_VIA_OUT? "!= " : "",
                           cs->fw.ip.outiface);
        }
 
        if (cs->fw.ip.flags & IPT_F_FRAG) {
-               xt_buf_add(buf, "ip frag-off %s%x ",
+               xt_xlate_add(xl, "ip frag-off %s%x ",
                           cs->fw.ip.invflags & IPT_INV_FRAG? "" : "!= ", 0);
        }
 
@@ -459,7 +459,7 @@ static int nft_ipv4_xlate(const void *data, struct xt_buf *buf)
                        snprintf(protonum, sizeof(protonum), "%u",
                                 cs->fw.ip.proto);
                        protonum[sizeof(protonum) - 1] = '\0';
-                       xt_buf_add(buf, "ip protocol %s%s ",
+                       xt_xlate_add(xl, "ip protocol %s%s ",
                                   cs->fw.ip.invflags & IPT_INV_PROTO ?
                                        "!= " : "",
                                   pent ? pent->p_name : protonum);
@@ -467,24 +467,24 @@ static int nft_ipv4_xlate(const void *data, struct xt_buf *buf)
        }
 
        if (cs->fw.ip.src.s_addr != 0) {
-               xt_buf_add(buf, "ip saddr %s%s ",
+               xt_xlate_add(xl, "ip saddr %s%s ",
                           cs->fw.ip.invflags & IPT_INV_SRCIP ? "!= " : "",
                           inet_ntoa(cs->fw.ip.src));
        }
        if (cs->fw.ip.dst.s_addr != 0) {
-               xt_buf_add(buf, "ip daddr %s%s ",
+               xt_xlate_add(xl, "ip daddr %s%s ",
                           cs->fw.ip.invflags & IPT_INV_DSTIP ? "!= " : "",
                           inet_ntoa(cs->fw.ip.dst));
        }
 
-       ret = xlate_matches(cs, buf);
+       ret = xlate_matches(cs, xl);
        if (!ret)
                return ret;
 
        /* Always add counters per rule, as in iptables */
-       xt_buf_add(buf, "counter ");
+       xt_xlate_add(xl, "counter ");
 
-       ret = xlate_action(cs, !!(cs->fw.ip.flags & IPT_F_GOTO), buf);
+       ret = xlate_action(cs, !!(cs->fw.ip.flags & IPT_F_GOTO), xl);
 
        return ret;
 }
index 0b6ff97e0aa2285a4065b487fdce91a162afc67c..77ac5b8039b3e284dde60d0a92962d3e4ef3fabc 100644 (file)
@@ -378,7 +378,7 @@ static void nft_ipv6_save_counters(const void *data)
 }
 
 static void xlate_ipv6_addr(const char *selector, const struct in6_addr *addr,
-                           int invert, struct xt_buf *buf)
+                           int invert, struct xt_xlate *xl)
 {
        char addr_str[INET6_ADDRSTRLEN];
 
@@ -386,22 +386,22 @@ static void xlate_ipv6_addr(const char *selector, const struct in6_addr *addr,
                return;
 
        inet_ntop(AF_INET6, addr, addr_str, INET6_ADDRSTRLEN);
-       xt_buf_add(buf, "%s %s%s ", selector, invert ? "!= " : "", addr_str);
+       xt_xlate_add(xl, "%s %s%s ", selector, invert ? "!= " : "", addr_str);
 }
 
-static int nft_ipv6_xlate(const void *data, struct xt_buf *buf)
+static int nft_ipv6_xlate(const void *data, struct xt_xlate *xl)
 {
        const struct iptables_command_state *cs = data;
        int ret;
 
        if (cs->fw6.ipv6.iniface[0] != '\0') {
-               xt_buf_add(buf, "iifname %s%s ",
+               xt_xlate_add(xl, "iifname %s%s ",
                           cs->fw6.ipv6.invflags & IP6T_INV_VIA_IN ?
                                "!= " : "",
                           cs->fw6.ipv6.iniface);
        }
        if (cs->fw6.ipv6.outiface[0] != '\0') {
-               xt_buf_add(buf, "oifname %s%s ",
+               xt_xlate_add(xl, "oifname %s%s ",
                           cs->fw6.ipv6.invflags & IP6T_INV_VIA_OUT ?
                                "!= " : "",
                           cs->fw6.ipv6.outiface);
@@ -416,7 +416,7 @@ static int nft_ipv6_xlate(const void *data, struct xt_buf *buf)
                        snprintf(protonum, sizeof(protonum), "%u",
                                 cs->fw6.ipv6.proto);
                        protonum[sizeof(protonum) - 1] = '\0';
-                       xt_buf_add(buf, "ip6 nexthdr %s%s ",
+                       xt_xlate_add(xl, "ip6 nexthdr %s%s ",
                                   cs->fw6.ipv6.invflags & IP6T_INV_PROTO ?
                                        "!= " : "",
                                   pent ? pent->p_name : protonum);
@@ -424,18 +424,18 @@ static int nft_ipv6_xlate(const void *data, struct xt_buf *buf)
        }
 
        xlate_ipv6_addr("ip6 saddr", &cs->fw6.ipv6.src,
-                       cs->fw6.ipv6.invflags & IP6T_INV_SRCIP, buf);
+                       cs->fw6.ipv6.invflags & IP6T_INV_SRCIP, xl);
        xlate_ipv6_addr("ip6 daddr", &cs->fw6.ipv6.dst,
-                       cs->fw6.ipv6.invflags & IP6T_INV_DSTIP, buf);
+                       cs->fw6.ipv6.invflags & IP6T_INV_DSTIP, xl);
 
-       ret = xlate_matches(cs, buf);
+       ret = xlate_matches(cs, xl);
        if (!ret)
                return ret;
 
        /* Always add counters per rule, as in iptables */
-       xt_buf_add(buf, "counter ");
+       xt_xlate_add(xl, "counter ");
 
-       ret = xlate_action(cs, !!(cs->fw6.ipv6.flags & IP6T_F_GOTO), buf);
+       ret = xlate_action(cs, !!(cs->fw6.ipv6.flags & IP6T_F_GOTO), xl);
 
        return ret;
 }
index 73861833844ade25f0842a759131858f5b7b71c0..c0948fd4e266c31f52ae461b191879b2d3371c76 100644 (file)
@@ -37,7 +37,7 @@
 #define FMT(tab,notab) ((format) & FMT_NOTABLE ? (notab) : (tab))
 
 struct xtables_args;
-struct xt_buf;
+struct xt_xlate;
 
 enum {
        NFT_XT_CTX_PAYLOAD      = (1 << 0),
@@ -102,7 +102,7 @@ struct nft_family_ops {
        void (*parse_target)(struct xtables_target *t, void *data);
        bool (*rule_find)(struct nft_family_ops *ops, struct nftnl_rule *r,
                          void *data);
-       int (*xlate)(const void *data, struct xt_buf *buf);
+       int (*xlate)(const void *data, struct xt_xlate *xl);
 };
 
 void add_meta(struct nftnl_rule *r, uint32_t key);
index 192050a4fa5cd8b0b5bc76e996f61eede6a68e66..281e1c69e9141c9e8632113641cd64ca60d4028c 100644 (file)
@@ -161,9 +161,9 @@ int nft_xtables_config_load(struct nft_handle *h, const char *filename, uint32_t
 struct xt_buf;
 
 bool xlate_find_match(const struct iptables_command_state *cs, const char *p_name);
-int xlate_matches(const struct iptables_command_state *cs, struct xt_buf *buf);
+int xlate_matches(const struct iptables_command_state *cs, struct xt_xlate *xl);
 int xlate_action(const struct iptables_command_state *cs, bool goto_set,
-                struct xt_buf *buf);
+                struct xt_xlate *xl);
 
 /*
  * ARP
index 30028c35e4e4d5de5a7e40843062a82c67ea77f7..9e2c6aeb9f404cd22a29eb1c089921212d3c86ab 100644 (file)
@@ -35,7 +35,7 @@
 #include "nft-shared.h"
 
 int xlate_action(const struct iptables_command_state *cs, bool goto_set,
-                struct xt_buf *buf)
+                struct xt_xlate *xl)
 {
        int ret = 1, numeric = cs->options & OPT_NUMERIC;
 
@@ -43,27 +43,27 @@ int xlate_action(const struct iptables_command_state *cs, bool goto_set,
        if (cs->target != NULL) {
                /* Standard target? */
                if (strcmp(cs->jumpto, XTC_LABEL_ACCEPT) == 0)
-                       xt_buf_add(buf, "accept");
+                       xt_xlate_add(xl, "accept");
                else if (strcmp(cs->jumpto, XTC_LABEL_DROP) == 0)
-                       xt_buf_add(buf, "drop");
+                       xt_xlate_add(xl, "drop");
                else if (strcmp(cs->jumpto, XTC_LABEL_RETURN) == 0)
-                       xt_buf_add(buf, "return");
+                       xt_xlate_add(xl, "return");
                else if (cs->target->xlate)
-                       ret = cs->target->xlate(cs->target->t, buf, numeric);
+                       ret = cs->target->xlate(cs->target->t, xl, numeric);
                else
                        return 0;
        } else if (strlen(cs->jumpto) > 0) {
                /* Not standard, then it's a go / jump to chain */
                if (goto_set)
-                       xt_buf_add(buf, "goto %s", cs->jumpto);
+                       xt_xlate_add(xl, "goto %s", cs->jumpto);
                else
-                       xt_buf_add(buf, "jump %s", cs->jumpto);
+                       xt_xlate_add(xl, "jump %s", cs->jumpto);
        }
 
        return ret;
 }
 
-int xlate_matches(const struct iptables_command_state *cs, struct xt_buf *buf)
+int xlate_matches(const struct iptables_command_state *cs, struct xt_xlate *xl)
 {
        struct xtables_rule_match *matchp;
        int ret = 1, numeric = cs->options & OPT_NUMERIC;
@@ -72,7 +72,7 @@ int xlate_matches(const struct iptables_command_state *cs, struct xt_buf *buf)
                if (!matchp->match->xlate)
                        return 0;
 
-               ret = matchp->match->xlate(matchp->match->m, buf, numeric);
+               ret = matchp->match->xlate(matchp->match->m, xl, numeric);
                if (!ret)
                        break;
        }
@@ -101,22 +101,22 @@ static int nft_rule_xlate_add(struct nft_handle *h,
                              const struct iptables_command_state *cs,
                              bool append)
 {
-       struct xt_buf *buf = xt_buf_alloc(10240);
+       struct xt_xlate *xl = xt_xlate_alloc(10240);
        int ret;
 
        if (append) {
-               xt_buf_add(buf, "add rule %s %s %s ",
+               xt_xlate_add(xl, "add rule %s %s %s ",
                           family2str[h->family], p->table, p->chain);
        } else {
-               xt_buf_add(buf, "insert rule %s %s %s ",
+               xt_xlate_add(xl, "insert rule %s %s %s ",
                           family2str[h->family], p->table, p->chain);
        }
 
-       ret = h->ops->xlate(cs, buf);
+       ret = h->ops->xlate(cs, xl);
        if (ret)
-               printf("%s\n", xt_buf_get(buf));
+               printf("%s\n", xt_xlate_get(xl));
 
-       xt_buf_free(buf);
+       xt_xlate_free(xl);
        return ret;
 }
 
index 21e515d2c664849c07e641fb0363c1f294b1bb93..32d6a5a2bbe6e363338ffdc5be3deaf51fb8e48a 100644 (file)
@@ -1987,54 +1987,54 @@ void get_kernel_version(void)
        kernel_version = LINUX_VERSION(x, y, z);
 }
 
-struct xt_buf {
+struct xt_xlate {
        char    *data;
        int     size;
        int     rem;
        int     off;
 };
 
-struct xt_buf *xt_buf_alloc(int size)
+struct xt_xlate *xt_xlate_alloc(int size)
 {
-       struct xt_buf *buf;
+       struct xt_xlate *xl;
 
-       buf = malloc(sizeof(struct xt_buf));
-       if (buf == NULL)
+       xl = malloc(sizeof(struct xt_xlate));
+       if (xl == NULL)
                xtables_error(RESOURCE_PROBLEM, "OOM");
 
-       buf->data = malloc(size);
-       if (buf->data == NULL)
+       xl->data = malloc(size);
+       if (xl->data == NULL)
                xtables_error(RESOURCE_PROBLEM, "OOM");
 
-       buf->size = size;
-       buf->rem = size;
-       buf->off = 0;
+       xl->size = size;
+       xl->rem = size;
+       xl->off = 0;
 
-       return buf;
+       return xl;
 }
 
-void xt_buf_free(struct xt_buf *buf)
+void xt_xlate_free(struct xt_xlate *xl)
 {
-       free(buf->data);
-       free(buf);
+       free(xl->data);
+       free(xl);
 }
 
-void xt_buf_add(struct xt_buf *buf, const char *fmt, ...)
+void xt_xlate_add(struct xt_xlate *xl, const char *fmt, ...)
 {
        va_list ap;
        int len;
 
        va_start(ap, fmt);
-       len = vsnprintf(buf->data + buf->off, buf->rem, fmt, ap);
-       if (len < 0 || len >= buf->rem)
+       len = vsnprintf(xl->data + xl->off, xl->rem, fmt, ap);
+       if (len < 0 || len >= xl->rem)
                xtables_error(RESOURCE_PROBLEM, "OOM");
 
        va_end(ap);
-       buf->rem -= len;
-       buf->off += len;
+       xl->rem -= len;
+       xl->off += len;
 }
 
-const char *xt_buf_get(struct xt_buf *buf)
+const char *xt_xlate_get(struct xt_xlate *xl)
 {
-       return buf->data;
+       return xl->data;
 }