From: Mark Andrews Date: Thu, 11 Oct 2001 01:23:40 +0000 (+0000) Subject: pullup: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d11231b4b42d04bbaee0aaeea9537ae496864ae;p=thirdparty%2Fbind9.git pullup: 1040. [bug] Multiple listen-on-v6 options with different ports were not accepted. [RT #1875] --- diff --git a/CHANGES b/CHANGES index d390faf454e..28bbc233d50 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +1040. [bug] Multiple listen-on-v6 options with different ports + were not accepted. [RT #1875] 1027. [bug] RRs having the reserved type 0 should be rejected. [RT #1471] diff --git a/bin/named/interfacemgr.c b/bin/named/interfacemgr.c index 7826e99e0ec..9f4a5670907 100644 --- a/bin/named/interfacemgr.c +++ b/bin/named/interfacemgr.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: interfacemgr.c,v 1.54.2.1 2001/01/09 22:31:52 bwelling Exp $ */ +/* $Id: interfacemgr.c,v 1.54.2.2 2001/10/11 01:23:40 marka Exp $ */ #include @@ -589,13 +589,7 @@ do_ipv4(ns_interfacemgr_t *mgr) { } static isc_boolean_t -listenon_is_ip6_none(ns_listenlist_t *p) { - ns_listenelt_t *elt; - if (ISC_LIST_EMPTY(p->elts)) - return (ISC_TRUE); /* No listen-on-v6 statements */ - elt = ISC_LIST_HEAD(p->elts); - if (ISC_LIST_NEXT(elt, link) != NULL) - return (ISC_FALSE); /* More than one listen-on-v6 stmt */ +listenon_is_ip6_none(ns_listenelt_t *elt) { if (elt->acl->length == 0) return (ISC_TRUE); /* listen-on-v6 { } */ if (elt->acl->length > 1) @@ -607,20 +601,12 @@ listenon_is_ip6_none(ns_listenlist_t *p) { } static isc_boolean_t -listenon_is_ip6_any(ns_listenlist_t *p, in_port_t *portp) { - ns_listenelt_t *elt; - if (ISC_LIST_EMPTY(p->elts)) - return (ISC_FALSE); /* No listen-on-v6 statements */ - elt = ISC_LIST_HEAD(p->elts); - if (ISC_LIST_NEXT(elt, link) != NULL) - return (ISC_FALSE); /* More than one listen-on-v6 stmt */ +listenon_is_ip6_any(ns_listenelt_t *elt) { if (elt->acl->length != 1) return (ISC_FALSE); if (elt->acl->elements[0].negative == ISC_FALSE && - elt->acl->elements[0].type == dns_aclelementtype_any) { - *portp = elt->port; + elt->acl->elements[0].type == dns_aclelementtype_any) return (ISC_TRUE); /* listen-on-v6 { any; } */ - } return (ISC_FALSE); /* All others */ } @@ -630,33 +616,41 @@ do_ipv6(ns_interfacemgr_t *mgr) { ns_interface_t *ifp; isc_sockaddr_t listen_addr; struct in6_addr in6a; - in_port_t port; - - if (listenon_is_ip6_none(mgr->listenon6)) - return; - - if (! listenon_is_ip6_any(mgr->listenon6, &port)) { - isc_log_write(IFMGR_COMMON_LOGARGS, - ISC_LOG_ERROR, - "bad IPv6 listen-on list: must be 'any' or 'none'"); - return; - } + ns_listenelt_t *le; - in6a = in6addr_any; - isc_sockaddr_fromin6(&listen_addr, &in6a, port); - - ifp = find_matching_interface(mgr, &listen_addr); - if (ifp != NULL) { - ifp->generation = mgr->generation; - } else { - isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_INFO, - "listening on IPv6 interfaces, port %u", port); - result = ns_interface_setup(mgr, &listen_addr, "", &ifp); - if (result != ISC_R_SUCCESS) { + for (le = ISC_LIST_HEAD(mgr->listenon6->elts); + le != NULL; + le = ISC_LIST_NEXT(le, link)) + { + if (listenon_is_ip6_none(le)) + continue; + if (! listenon_is_ip6_any(le)) { isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_ERROR, - "listening on IPv6 interfaces failed"); - /* Continue. */ + "bad IPv6 listen-on list: " + "must be 'any' or 'none'"); + return; + } + + in6a = in6addr_any; + isc_sockaddr_fromin6(&listen_addr, &in6a, le->port); + + ifp = find_matching_interface(mgr, &listen_addr); + if (ifp != NULL) { + ifp->generation = mgr->generation; + } else { + isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_INFO, + "listening on IPv6 interfaces, port %u", + le->port); + result = ns_interface_setup(mgr, &listen_addr, + "", &ifp); + if (result != ISC_R_SUCCESS) { + isc_log_write(IFMGR_COMMON_LOGARGS, + ISC_LOG_ERROR, + "listening on IPv6 interfaces " + "failed"); + /* Continue. */ + } } } }