[master] fixes for singleton on hpux
- 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
This commit is contained in:
@@ -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) {
|
||||
|
||||
31
bin/tests/system/runtime/ns2/named-alt1.conf
Normal file
31
bin/tests/system/runtime/ns2/named-alt1.conf
Normal file
@@ -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;
|
||||
};
|
||||
@@ -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;
|
||||
@@ -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`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user