diff options
author | Cy Schubert <cy@FreeBSD.org> | 2017-05-11 04:39:11 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2017-05-11 04:39:11 +0000 |
commit | 9322c566a0fb369c99a93ac830ba14a3b48c5be0 (patch) | |
tree | ff8d766026162ca29e4d2b11cf084a71ca372062 | |
parent | f9e7a80482e43d1f59161ed9be8973f09211d08c (diff) | |
download | src-9322c566a0fb369c99a93ac830ba14a3b48c5be0.tar.gz src-9322c566a0fb369c99a93ac830ba14a3b48c5be0.zip |
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
Notes
Notes:
svn path=/head/; revision=318173
-rw-r--r-- | contrib/ipfilter/lib/printpoolnode.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/contrib/ipfilter/lib/printpoolnode.c b/contrib/ipfilter/lib/printpoolnode.c index aa2aed96cad3..95ce8c3a4ed7 100644 --- a/contrib/ipfilter/lib/printpoolnode.c +++ b/contrib/ipfilter/lib/printpoolnode.c @@ -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 |