2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 15:45:25 +00:00

supported multiple listen-on-v6 correctly.

This commit is contained in:
Mark Andrews
2002-08-17 03:00:49 +00:00
parent 741a75f81b
commit 301ef360a1

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: interfacemgr.c,v 1.68 2002/08/16 23:46:11 marka Exp $ */ /* $Id: interfacemgr.c,v 1.69 2002/08/17 03:00:49 marka Exp $ */
#include <config.h> #include <config.h>
@@ -493,7 +493,6 @@ do_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose) {
isc_interfaceiter_t *iter = NULL; isc_interfaceiter_t *iter = NULL;
isc_boolean_t scan_ipv4 = ISC_FALSE; isc_boolean_t scan_ipv4 = ISC_FALSE;
isc_boolean_t scan_ipv6 = ISC_FALSE; isc_boolean_t scan_ipv6 = ISC_FALSE;
isc_boolean_t setup_ipv6 = ISC_TRUE;
isc_result_t result; isc_result_t result;
isc_netaddr_t zero_address, zero_address6; isc_netaddr_t zero_address, zero_address6;
ns_listenelt_t *le; ns_listenelt_t *le;
@@ -518,11 +517,15 @@ do_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose) {
/* A special, but typical case; listen-on-v6 { any; } */ /* A special, but typical case; listen-on-v6 { any; } */
/* XXXJT fix when we probe for IPV6_V6ONLY */ /* XXXJT fix when we probe for IPV6_V6ONLY */
if (scan_ipv6 == ISC_TRUE && if (scan_ipv6 == ISC_TRUE) {
(le = ISC_LIST_HEAD(mgr->listenon6->elts)) != NULL && for (le = ISC_LIST_HEAD(mgr->listenon6->elts);
listenon_is_ip6_any(le)) { le != NULL;
le = ISC_LIST_NEXT(le, link)) {
struct in6_addr in6a; struct in6_addr in6a;
if (!listenon_is_ip6_any(le))
continue;
in6a = in6addr_any; in6a = in6addr_any;
isc_sockaddr_fromin6(&listen_addr, &in6a, le->port); isc_sockaddr_fromin6(&listen_addr, &in6a, le->port);
@@ -530,18 +533,20 @@ do_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose) {
if (ifp != NULL) { if (ifp != NULL) {
ifp->generation = mgr->generation; ifp->generation = mgr->generation;
} else { } else {
isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_INFO, isc_log_write(IFMGR_COMMON_LOGARGS,
"listening on IPv6 interfaces, port %u", ISC_LOG_INFO,
"listening on IPv6 "
"interfaces, port %u",
le->port); le->port);
result = ns_interface_setup(mgr, &listen_addr, result = ns_interface_setup(mgr, &listen_addr,
"<any>", &ifp); "<any>", &ifp);
if (result == ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
setup_ipv6 = ISC_FALSE;
else
isc_log_write(IFMGR_COMMON_LOGARGS, isc_log_write(IFMGR_COMMON_LOGARGS,
ISC_LOG_ERROR, ISC_LOG_ERROR,
"listening on all IPv6 " "listening on all IPv6 "
"interfaces failed"); "interfaces failed");
/* Continue. */
}
} }
} }
@@ -628,13 +633,6 @@ do_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose) {
goto ignore_interface; goto ignore_interface;
} }
/*
* If we've made a wildcard AF_INET6 socket, silently skip all
* IPv6 addresses to bind.
*/
if (family == AF_INET6 && setup_ipv6 == ISC_FALSE)
continue;
ll = (family == AF_INET) ? mgr->listenon4 : mgr->listenon6; ll = (family == AF_INET) ? mgr->listenon4 : mgr->listenon6;
for (le = ISC_LIST_HEAD(ll->elts); for (le = ISC_LIST_HEAD(ll->elts);
le != NULL; le != NULL;
@@ -644,6 +642,10 @@ do_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose) {
isc_netaddr_t listen_netaddr; isc_netaddr_t listen_netaddr;
isc_sockaddr_t listen_sockaddr; isc_sockaddr_t listen_sockaddr;
/* the case of "any" IPv6 address was already done. */
if (family == AF_INET6 && listenon_is_ip6_any(le))
continue;
/* /*
* Construct a socket address for this IP/port * Construct a socket address for this IP/port
* combination. * combination.