From 382a5cbf423a65c5504a421776412b26daa9e949 Mon Sep 17 00:00:00 2001 From: "Alexander V. Chernikov" Date: Fri, 24 Oct 2014 13:29:12 +0000 Subject: [PATCH] Fix displaying non-contiguous netmasks. Found by: ae Sponsored by: Yandex LLC --- sbin/ipfw/ipfw2.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index a0fc3b85c19f..2c9846628977 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -1225,9 +1225,10 @@ print_ip(struct buf_pr *bp, struct format_opts *fo, ipfw_insn_ip *cmd, else { /* numeric IP followed by some kind of mask */ ia = (struct in_addr *)&a[0]; bprintf(bp, "%s", inet_ntoa(*ia)); - if (mb < 0) - bprintf(bp, ":%s", inet_ntoa(*ia ) ); - else if (mb < 32) + if (mb < 0) { + ia = (struct in_addr *)&a[1]; + bprintf(bp, ":%s", inet_ntoa(*ia)); + } else if (mb < 32) bprintf(bp, "/%d", mb); } if (len > 1)