From 111e3433d289e8b4ea1260add39baa78c2a46891 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 3 Dec 2001 04:41:42 +0000 Subject: [PATCH] 1154. [bug] When scanning interfaces skip the interface if address no address is configured. [RT #2176] --- CHANGES | 3 +++ lib/isc/unix/ifiter_ioctl.c | 32 +++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index d0fdb8d3ce..4fdb54e74a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +1154. [bug] When scanning interfaces skip the interface + if address no address is configured. [RT #2176] + 1153. [func] 'rndc {stop|halt} -p' now reports the process id of the instance of named being shutdown. diff --git a/lib/isc/unix/ifiter_ioctl.c b/lib/isc/unix/ifiter_ioctl.c index 29440a6d6b..3fcd3caf3d 100644 --- a/lib/isc/unix/ifiter_ioctl.c +++ b/lib/isc/unix/ifiter_ioctl.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ifiter_ioctl.c,v 1.25 2001/11/27 01:56:14 gson Exp $ */ +/* $Id: ifiter_ioctl.c,v 1.26 2001/12/03 04:41:42 marka Exp $ */ /* * Obtain the list of network interfaces using the SIOCGLIFCONF ioctl. @@ -341,6 +341,21 @@ internal_current4(isc_interfaceiter_t *iter) { get_addr(family, &iter->current.address, (struct sockaddr *)&ifreq.ifr_addr); + /* + * If the interface does not have a address ignore it. + */ + switch (family) { + case AF_INET: + if (iter->current.address.type.in.s_addr == htonl(INADDR_ANY)) + return (ISC_R_IGNORE); + break; + case AF_INET6: + if (memcmp(&iter->current.address.type.in6, &in6addr_any, + sizeof(in6addr_any)) == 0) + return (ISC_R_IGNORE); + break; + } + /* * Get interface flags. */ @@ -464,6 +479,21 @@ internal_current6(isc_interfaceiter_t *iter) { get_addr(family, &iter->current.address, (struct sockaddr *)&lifreq.lifr_addr); + /* + * If the interface does not have a address ignore it. + */ + switch (family) { + case AF_INET: + if (iter->current.address.type.in.s_addr == htonl(INADDR_ANY)) + return (ISC_R_IGNORE); + break; + case AF_INET6: + if (memcmp(&iter->current.address.type.in6, &in6addr_any, + sizeof(in6addr_any)) == 0) + return (ISC_R_IGNORE); + break; + } + /* * Get interface flags. */