Date: Thu, 11 May 2017 04:39:11 +0000 (UTC) From: Cy Schubert <cy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r318173 - head/contrib/ipfilter/lib Message-ID: <201705110439.v4B4dBsH029884@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cy Date: Thu May 11 04:39:11 2017 New Revision: 318173 URL: https://svnweb.freebsd.org/changeset/base/318173 Log: Implement outputting of IPv6 addresses in the ippool debug list of tree type pools (ippool -l -d -t tree). Currently IPv6 in ippool tree type pool handling is partially implemented (meaning it doesn't work). This is the first of a series of commits to remediate ippool. This will be MFCed with a yet to be committed series of fixes to ippool after it has been fully remediated. PR: 218433 Modified: head/contrib/ipfilter/lib/printpoolnode.c Modified: head/contrib/ipfilter/lib/printpoolnode.c ============================================================================== --- head/contrib/ipfilter/lib/printpoolnode.c Thu May 11 04:29:20 2017 (r318172) +++ head/contrib/ipfilter/lib/printpoolnode.c Thu May 11 04:39:11 2017 (r318173) @@ -33,8 +33,30 @@ printpoolnode(np, opts, fields) printmask(np->ipn_addr.adf_family, (u_32_t *)&np->ipn_mask.adf_addr); } else { - PRINTF("\tAddress: %s%s", np->ipn_info ? "! " : "", - inet_ntoa(np->ipn_addr.adf_addr.in4)); +#ifdef AF_INET6 + if (np->ipn_addr.adf_family == AF_INET6) { + char buf[INET6_ADDRSTRLEN + 1]; + const char *str; + + buf[0] = '\0'; + str = inet_ntop(AF_INET6, &np->ipn_addr.adf_addr.in6, + buf, sizeof(buf) - 1); + if (str == NULL) + str = "???"; + PRINTF("\tAddress: %s%s", np->ipn_info ? "! " : "", + str); + } else if (np->ipn_addr.adf_family == AF_INET) { +#else + if (np->ipn_addr.adf_family == AF_INET) { +#endif + PRINTF("\tAddress: %s%s", np->ipn_info ? "! " : "", + inet_ntoa(np->ipn_addr.adf_addr.in4)); + } else { + PRINTF("\tAddress: family: %d", + np->ipn_addr.adf_family); +#ifdef AF_INET6 + } +#endif printmask(np->ipn_addr.adf_family, (u_32_t *)&np->ipn_mask.adf_addr); #ifdef USE_QUAD_T
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705110439.v4B4dBsH029884>