static void HMARK_ip6_save(const void *ip, const struct xt_entry_target *target) { const struct xt_hmark_info *info = (const struct xt_hmark_info *)target->data; int ret; if (info->flags & XT_HMARK_FLAG(XT_HMARK_SADDR_MASK)) { ret = xtables_ip6mask_to_cidr(&info->src_mask.in6); printf(" --hmark-src-prefix %d", ret); } if (info->flags & XT_HMARK_FLAG(XT_HMARK_DADDR_MASK)) { ret = xtables_ip6mask_to_cidr(&info->dst_mask.in6); printf(" --hmark-dst-prefix %d", ret); } HMARK_save(info); }
const char *xtables_ip6mask_to_numeric(const struct in6_addr *addrp) { static char buf[50+2]; int l = xtables_ip6mask_to_cidr(addrp); if (l == -1) { strcpy(buf, "/"); strcat(buf, xtables_ip6addr_to_numeric(addrp)); return buf; } sprintf(buf, "/%d", l); return buf; }
const char *xtables_ip6mask_to_numeric(const struct in6_addr *addrp) { static char buf[50+2]; int l = xtables_ip6mask_to_cidr(addrp); if (l == -1) { strcpy(buf, "/"); strcat(buf, xtables_ip6addr_to_numeric(addrp)); return buf; } /* we don't want to see "/128" */ if (l == 128) return ""; else sprintf(buf, "/%d", l); return buf; }