/* Shamelessly copied from libxt_conntrack.c */ static void ipvs_mt_dump_addr(const union nf_inet_addr *addr, const union nf_inet_addr *mask, unsigned int family, bool numeric) { char buf[BUFSIZ]; if (family == NFPROTO_IPV4) { if (!numeric && addr->ip == 0) { printf("anywhere "); return; } if (numeric) strcpy(buf, xtables_ipaddr_to_numeric(&addr->in)); else strcpy(buf, xtables_ipaddr_to_anyname(&addr->in)); strcat(buf, xtables_ipmask_to_numeric(&mask->in)); printf("%s ", buf); } else if (family == NFPROTO_IPV6) { if (!numeric && addr->ip6[0] == 0 && addr->ip6[1] == 0 && addr->ip6[2] == 0 && addr->ip6[3] == 0) { printf("anywhere "); return; } if (numeric) strcpy(buf, xtables_ip6addr_to_numeric(&addr->in6)); else strcpy(buf, xtables_ip6addr_to_anyname(&addr->in6)); strcat(buf, xtables_ip6mask_to_numeric(&mask->in6)); printf("%s ", buf); } }
static void conntrack_dump_addr(const union nf_inet_addr *addr, const union nf_inet_addr *mask, unsigned int family, bool numeric) { if (family == NFPROTO_IPV4) { if (!numeric && addr->ip == 0) { printf("anywhere "); return; } if (numeric) printf("%s ", xtables_ipaddr_to_numeric(&addr->in)); else printf("%s ", xtables_ipaddr_to_anyname(&addr->in)); } else if (family == NFPROTO_IPV6) { if (!numeric && addr->ip6[0] == 0 && addr->ip6[1] == 0 && addr->ip6[2] == 0 && addr->ip6[3] == 0) { printf("anywhere "); return; } if (numeric) printf("%s ", xtables_ip6addr_to_numeric(&addr->in6)); else printf("%s ", xtables_ip6addr_to_anyname(&addr->in6)); } }
static void tee_tg6_print(const void *ip, const struct xt_entry_target *target, int numeric) { const struct xt_tee_tginfo *info = (const void *)target->data; if (numeric) printf(" TEE gw:%s", xtables_ip6addr_to_numeric(&info->gw.in6)); else printf(" TEE gw:%s", xtables_ip6addr_to_anyname(&info->gw.in6)); if (*info->oif != '\0') printf(" oif=%s", info->oif); }
void nat64_tg6_print(const void *entry, const struct xt_entry_target *target, int numeric) { const struct xt_nat64_tginfo *info = (const void *)target->data; if (info->flags & XT_NAT64_IPV6_DST) { printf("dst IP "); printf("%s ", numeric ? xtables_ip6addr_to_numeric(&info->ip6dst.in6): xtables_ip6addr_to_anyname(&info->ip6dst.in6)); } }
static int tee_tg6_xlate(const void *ip, const struct xt_entry_target *target, struct xt_xlate *xl, int numeric) { const struct xt_tee_tginfo *info = (const void *)target->data; if (numeric) xt_xlate_add(xl, "dup to %s", xtables_ip6addr_to_numeric(&info->gw.in6)); else xt_xlate_add(xl, "dup to %s", xtables_ip6addr_to_anyname(&info->gw.in6)); if (*info->oif != '\0') xt_xlate_add(xl, " device %s", info->oif); return 1; }