]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
pullup:
authorMark Andrews <marka@isc.org>
Thu, 11 Oct 2001 01:23:40 +0000 (01:23 +0000)
committerMark Andrews <marka@isc.org>
Thu, 11 Oct 2001 01:23:40 +0000 (01:23 +0000)
1040.   [bug]           Multiple listen-on-v6 options with different ports
                        were not accepted. [RT #1875]

CHANGES
bin/named/interfacemgr.c

diff --git a/CHANGES b/CHANGES
index d390faf454eb963ae07513a07238499fb8e89506..28bbc233d5074edb28cdcf90a00c5360d755b04e 100644 (file)
--- 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]
index 7826e99e0ec32f8c6a328f4850d29e5022557e3b..9f4a567090770ebef3d764cc9ec76003e339c4f8 100644 (file)
@@ -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 <config.h>
 
@@ -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, "<any>", &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,
+                                                   "<any>", &ifp);
+                       if (result != ISC_R_SUCCESS) {
+                               isc_log_write(IFMGR_COMMON_LOGARGS,
+                                             ISC_LOG_ERROR,
+                                             "listening on IPv6 interfaces "
+                                             "failed");
+                               /* Continue. */
+                       }
                }
        }
 }