From 3ee90dffea02c9be38dca6544ad5f22d4467e334 Mon Sep 17 00:00:00 2001 From: Hans Schillstrom Date: Mon, 16 Jul 2012 13:53:42 +0200 Subject: libxt_HMARK: fix output of iptables -L Fix accidental swap of [s|d]port-mask and [s|d]port-port. Use xtables_ipmask_to_cidr instead of xtables_ipmask_to_numeric. Signed-off-by: Hans Schillstrom Signed-off-by: Pablo Neira Ayuso --- extensions/libxt_HMARK.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/extensions/libxt_HMARK.c b/extensions/libxt_HMARK.c index 719effe8..736a671a 100644 --- a/extensions/libxt_HMARK.c +++ b/extensions/libxt_HMARK.c @@ -282,15 +282,15 @@ static void HMARK_check(struct xt_fcheck_call *cb) static void HMARK_print(const struct xt_hmark_info *info) { - if (info->flags & XT_HMARK_FLAG(XT_HMARK_SPORT)) + if (info->flags & XT_HMARK_FLAG(XT_HMARK_SPORT_MASK)) printf("sport-mask 0x%x ", htons(info->port_mask.p16.src)); - if (info->flags & XT_HMARK_FLAG(XT_HMARK_DPORT)) + if (info->flags & XT_HMARK_FLAG(XT_HMARK_DPORT_MASK)) printf("dport-mask 0x%x ", htons(info->port_mask.p16.dst)); if (info->flags & XT_HMARK_FLAG(XT_HMARK_SPI)) printf("spi-mask 0x%x ", htonl(info->port_mask.v32)); - if (info->flags & XT_HMARK_FLAG(XT_HMARK_SPORT_MASK)) + if (info->flags & XT_HMARK_FLAG(XT_HMARK_SPORT)) printf("sport-set 0x%x ", htons(info->port_set.p16.src)); - if (info->flags & XT_HMARK_FLAG(XT_HMARK_DPORT_MASK)) + if (info->flags & XT_HMARK_FLAG(XT_HMARK_DPORT)) printf("dport-set 0x%x ", htons(info->port_set.p16.dst)); if (info->flags & XT_HMARK_FLAG(XT_HMARK_SPI_MASK)) printf("spi-set 0x%x ", htonl(info->port_set.v32)); @@ -335,11 +335,11 @@ static void HMARK_ip4_print(const void *ip, if (info->flags & XT_HMARK_FLAG(XT_HMARK_CT)) printf("ct, "); if (info->flags & XT_HMARK_FLAG(XT_HMARK_SADDR_MASK)) - printf("src-prefix %s ", - xtables_ipmask_to_numeric(&info->src_mask.in) + 1); + printf("src-prefix %u ", + xtables_ipmask_to_cidr(&info->src_mask.in)); if (info->flags & XT_HMARK_FLAG(XT_HMARK_DADDR_MASK)) - printf("dst-prefix %s ", - xtables_ipmask_to_numeric(&info->dst_mask.in) + 1); + printf("dst-prefix %u ", + xtables_ipmask_to_cidr(&info->dst_mask.in)); HMARK_print(info); } -- cgit v1.2.3