]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] fixes for singleton on hpux
authorEvan Hunt <each@isc.org>
Sat, 20 Dec 2014 08:31:54 +0000 (00:31 -0800)
committerEvan Hunt <each@isc.org>
Sat, 20 Dec 2014 08:31:54 +0000 (00:31 -0800)
- hpux returns EADDRINUSE when listening on UDP sockets, so
  we need to check for that
- also need to ensure that subsidiary named processes are shut
  down in the runtime system test

bin/named/interfacemgr.c
bin/tests/system/runtime/ns2/named-alt1.conf [new file with mode: 0644]
bin/tests/system/runtime/ns2/named-alt2.conf [moved from bin/tests/system/runtime/ns2/named-alt.conf with 97% similarity]
bin/tests/system/runtime/tests.sh

index 49edef24bdafb7f7db9eabae83e975f2d7f6ad71..515fb0f92c081163cf815256fec99a96eb95e05a 100644 (file)
@@ -552,12 +552,12 @@ static isc_result_t
 ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
                   const char *name, ns_interface_t **ifpret,
                   isc_boolean_t accept_tcp, isc_dscp_t dscp,
-                  isc_boolean_t *tcp_addr_in_use)
+                  isc_boolean_t *addr_in_use)
 {
        isc_result_t result;
        ns_interface_t *ifp = NULL;
        REQUIRE(ifpret != NULL && *ifpret == NULL);
-       REQUIRE(tcp_addr_in_use == NULL || *tcp_addr_in_use == ISC_FALSE);
+       REQUIRE(addr_in_use == NULL || *addr_in_use == ISC_FALSE);
 
        result = ns_interface_create(mgr, addr, name, &ifp);
        if (result != ISC_R_SUCCESS)
@@ -566,15 +566,18 @@ ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
        ifp->dscp = dscp;
 
        result = ns_interface_listenudp(ifp);
-       if (result != ISC_R_SUCCESS)
+       if (result != ISC_R_SUCCESS) {
+               if ((result == ISC_R_ADDRINUSE) && (addr_in_use != NULL))
+                       *addr_in_use = ISC_TRUE;
                goto cleanup_interface;
+       }
 
        if (!ns_g_notcp && accept_tcp == ISC_TRUE) {
                result = ns_interface_accepttcp(ifp);
                if (result != ISC_R_SUCCESS) {
                        if ((result == ISC_R_ADDRINUSE) &&
-                           (tcp_addr_in_use != NULL))
-                               *tcp_addr_in_use = ISC_TRUE;
+                           (addr_in_use != NULL))
+                               *addr_in_use = ISC_TRUE;
 
                        /*
                         * XXXRTH We don't currently have a way to easily stop
@@ -1060,7 +1063,7 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
                                                      sabuf, ifp->dscp);
                                }
                        } else {
-                               isc_boolean_t tcp_addr_in_use = ISC_FALSE;
+                               isc_boolean_t addr_in_use = ISC_FALSE;
 
                                if (adjusting == ISC_FALSE &&
                                    ipv6_wildcard == ISC_TRUE)
@@ -1097,10 +1100,10 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
                                                    (adjusting == ISC_TRUE) ?
                                                    ISC_FALSE : ISC_TRUE,
                                                    le->dscp,
-                                                   &tcp_addr_in_use);
+                                                   &addr_in_use);
 
                                tried_listening = ISC_TRUE;
-                               if (!tcp_addr_in_use)
+                               if (!addr_in_use)
                                        all_addresses_in_use = ISC_FALSE;
 
                                if (result != ISC_R_SUCCESS) {
diff --git a/bin/tests/system/runtime/ns2/named-alt1.conf b/bin/tests/system/runtime/ns2/named-alt1.conf
new file mode 100644 (file)
index 0000000..57fc018
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2014  Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+// NS2
+
+controls { /* empty */ };
+
+options {
+       query-source address 10.53.0.2;
+       port 5300;
+       pid-file "named2.pid";
+       listen-on { 10.53.0.2; };
+       listen-on-v6 { fd92:7065:b8e:ffff::2; };
+       recursion no;
+       notify yes;
+       dnssec-enable no;
+       dnssec-validation no;
+};
similarity index 97%
rename from bin/tests/system/runtime/ns2/named-alt.conf
rename to bin/tests/system/runtime/ns2/named-alt2.conf
index c890564b9a19a51a5bf1e29b6eda22bc8c7f123d..142567cb7eb8f5470bce65b3d7f02e9283a998dd 100644 (file)
@@ -21,7 +21,7 @@ controls { /* empty */ };
 options {
        query-source address 10.53.0.2;
        port 5300;
-       pid-file "named.pid";
+       pid-file "named3.pid";
        listen-on { 10.53.0.2; 10.53.0.3; };
        listen-on-v6 { fd92:7065:b8e:ffff::2; };
        recursion no;
index 417cb7a98e650c53ef3b9e95cfceb670c6f1b290..f4cbf966b34bee49d6b8861e18791da230fcd4dc 100644 (file)
@@ -30,18 +30,20 @@ status=`expr $status + $ret`
 n=`expr $n + 1`
 echo "I:verifying that named checks for conflicting listeners ($n)"
 ret=0
-(cd ns2; $NAMED -c named.conf -D ns2-extra-1 -X .nolock -m record,size,mctx -d 99 -g -U 4 >> named2.run 2>&1 & )
+(cd ns2; $NAMED -c named-alt1.conf -D ns2-extra-1 -X .nolock -m record,size,mctx -d 99 -g -U 4 >> named2.run 2>&1 & )
 sleep 2
 grep "unable to listen on any configured interface" ns2/named2.run > /dev/null || ret=1
+[ -s ns2/named2.pid ] && kill -15 `cat ns2/named2.pid`
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
 n=`expr $n + 1`
 echo "I:verifying that named checks for conflicting named processes ($n)"
 ret=0
-(cd ns2; $NAMED -c named-alt.conf -D ns2-extra-1 -X named.lock -m record,size,mctx -d 99 -g -U 4 >> named3.run 2>&1 & )
+(cd ns2; $NAMED -c named-alt2.conf -D ns2-extra-2 -X named.lock -m record,size,mctx -d 99 -g -U 4 >> named3.run 2>&1 & )
 sleep 2
 grep "another named process" ns2/named3.run > /dev/null || ret=1
+[ -s ns2/named3.pid ] && kill -15 `cat ns3/named2.pid`
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`