summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2014-10-24 13:29:12 +0000
committermelifaro <melifaro@FreeBSD.org>2014-10-24 13:29:12 +0000
commitc9090358025e1fc68662c5fad7a839a1b71b35c0 (patch)
tree1708a4f1eecc15c629b755cea7157664628242e1
parentcbbca2de4dfaf610c857bebc91cd6029026797ad (diff)
downloadFreeBSD-src-c9090358025e1fc68662c5fad7a839a1b71b35c0.zip
FreeBSD-src-c9090358025e1fc68662c5fad7a839a1b71b35c0.tar.gz
Fix displaying non-contiguous netmasks.
Found by: ae Sponsored by: Yandex LLC
-rw-r--r--sbin/ipfw/ipfw2.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index a0fc3b8..2c98466 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)
OpenPOWER on IntegriCloud