mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-02 07:35:26 +00:00
supported multiple listen-on-v6 correctly.
This commit is contained in:
@@ -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,30 +517,36 @@ 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;
|
||||||
struct in6_addr in6a;
|
le = ISC_LIST_NEXT(le, link)) {
|
||||||
|
struct in6_addr in6a;
|
||||||
|
|
||||||
in6a = in6addr_any;
|
if (!listenon_is_ip6_any(le))
|
||||||
isc_sockaddr_fromin6(&listen_addr, &in6a, le->port);
|
continue;
|
||||||
|
|
||||||
ifp = find_matching_interface(mgr, &listen_addr);
|
in6a = in6addr_any;
|
||||||
if (ifp != NULL) {
|
isc_sockaddr_fromin6(&listen_addr, &in6a, le->port);
|
||||||
ifp->generation = mgr->generation;
|
|
||||||
} else {
|
ifp = find_matching_interface(mgr, &listen_addr);
|
||||||
isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_INFO,
|
if (ifp != NULL) {
|
||||||
"listening on IPv6 interfaces, port %u",
|
ifp->generation = mgr->generation;
|
||||||
le->port);
|
} else {
|
||||||
result = ns_interface_setup(mgr, &listen_addr,
|
|
||||||
"<any>", &ifp);
|
|
||||||
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_INFO,
|
||||||
"listening on all IPv6 "
|
"listening on IPv6 "
|
||||||
"interfaces failed");
|
"interfaces, port %u",
|
||||||
|
le->port);
|
||||||
|
result = ns_interface_setup(mgr, &listen_addr,
|
||||||
|
"<any>", &ifp);
|
||||||
|
if (result != ISC_R_SUCCESS)
|
||||||
|
isc_log_write(IFMGR_COMMON_LOGARGS,
|
||||||
|
ISC_LOG_ERROR,
|
||||||
|
"listening on all IPv6 "
|
||||||
|
"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.
|
||||||
|
Reference in New Issue
Block a user