Date: Wed, 13 May 2015 16:03:37 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 200169] ipfw table list uses IPv6 format for zero IPv4 addresses Message-ID: <bug-200169-8-5f7Ju4o2yR@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-200169-8@https.bugs.freebsd.org/bugzilla/> References: <bug-200169-8@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200169 --- Comment #1 from zuborg@gmail.com --- The problem is in IN6_IS_ADDR_V4COMPAT macro: ipfw2.c: static void table_list(uint16_t num, int need_header) ... if (IN6_IS_ADDR_V4COMPAT(addr6)) { /* IPv4 address */ inet_ntop(AF_INET, &addr6->s6_addr32[3], tbuf, sizeof(tbuf)); } else { /* IPv6 address */ inet_ntop(AF_INET6, addr6, tbuf, sizeof(tbuf)); } ... netinet6/in6.h: /* * IPv4 compatible */ #define IN6_IS_ADDR_V4COMPAT(a) \ ((a)->__u6_addr.__u6_addr32[0] == 0 && \ (a)->__u6_addr.__u6_addr32[1] == 0 && \ (a)->__u6_addr.__u6_addr32[2] == 0 && \ (a)->__u6_addr.__u6_addr32[3] != 0 && \ (a)->__u6_addr.__u6_addr32[3] != ntohl(1)) this macro consider values 0.0.0.0 and 0.0.0.1 as non IPv4 compatible. # ipfw table 1 flush # ipfw table 1 add 0.0.0.0/32 # ipfw table 1 add 0.0.0.1/32 # ipfw table 1 add 0.0.0.2/32 # ipfw table 1 add 0.0.0.128/32 # ipfw table 1 list ::/32 0 ::1/32 0 0.0.0.2/32 0 0.0.0.128/32 0 # -- You are receiving this mail because: You are the assignee for the bug.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-200169-8-5f7Ju4o2yR>