mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Use clang-tidy to add curly braces around one-line statements
The command used to reformat the files in this commit was: ./util/run-clang-tidy \ -clang-tidy-binary clang-tidy-11 -clang-apply-replacements-binary clang-apply-replacements-11 \ -checks=-*,readability-braces-around-statements \ -j 9 \ -fix \ -format \ -style=file \ -quiet clang-format -i --style=format $(git ls-files '*.c' '*.h') uncrustify -c .uncrustify.cfg --replace --no-backup $(git ls-files '*.c' '*.h') clang-format -i --style=format $(git ls-files '*.c' '*.h')
This commit is contained in:
@@ -37,8 +37,9 @@
|
||||
#define ROUTE_SOCKET_PROTOCOL PF_ROUTE
|
||||
#define MSGHDR rt_msghdr
|
||||
#define MSGTYPE rtm_type
|
||||
#endif
|
||||
#endif
|
||||
#endif /* if defined(RTM_VERSION) && defined(RTM_NEWADDR) && \
|
||||
* defined(RTM_DELADDR) */
|
||||
#endif /* ifdef HAVE_NET_ROUTE_H */
|
||||
|
||||
#if defined(HAVE_LINUX_NETLINK_H) && defined(HAVE_LINUX_RTNETLINK_H)
|
||||
#include <linux/netlink.h>
|
||||
@@ -48,12 +49,13 @@
|
||||
#define ROUTE_SOCKET_PROTOCOL PF_NETLINK
|
||||
#define MSGHDR nlmsghdr
|
||||
#define MSGTYPE nlmsg_type
|
||||
#endif
|
||||
#endif
|
||||
#endif /* if defined(RTM_NEWADDR) && defined(RTM_DELADDR) */
|
||||
#endif /* if defined(HAVE_LINUX_NETLINK_H) && defined(HAVE_LINUX_RTNETLINK_H) \
|
||||
*/
|
||||
|
||||
#ifdef TUNE_LARGE
|
||||
#define UDPBUFFERS 32768
|
||||
#else
|
||||
#else /* ifdef TUNE_LARGE */
|
||||
#define UDPBUFFERS 1000
|
||||
#endif /* TUNE_LARGE */
|
||||
|
||||
@@ -84,12 +86,13 @@ struct ns_interfacemgr {
|
||||
ISC_LIST(isc_sockaddr_t) listenon;
|
||||
int backlog; /*%< Listen queue size */
|
||||
unsigned int udpdisp; /*%< UDP dispatch count */
|
||||
atomic_bool shuttingdown; /*%< Interfacemgr is shutting down */
|
||||
atomic_bool shuttingdown; /*%< Interfacemgr is shutting
|
||||
* down */
|
||||
#ifdef USE_ROUTE_SOCKET
|
||||
isc_task_t * task;
|
||||
isc_socket_t *route;
|
||||
unsigned char buf[2048];
|
||||
#endif
|
||||
#endif /* ifdef USE_ROUTE_SOCKET */
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -116,11 +119,12 @@ route_event(isc_task_t *task, isc_event_t *event)
|
||||
sevent = (isc_socketevent_t *)event;
|
||||
|
||||
if (sevent->result != ISC_R_SUCCESS) {
|
||||
if (sevent->result != ISC_R_CANCELED)
|
||||
if (sevent->result != ISC_R_CANCELED) {
|
||||
isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_ERROR,
|
||||
"automatic interface scanning "
|
||||
"terminated: %s",
|
||||
isc_result_totext(sevent->result));
|
||||
}
|
||||
ns_interfacemgr_detach(&mgr);
|
||||
isc_event_free(&event);
|
||||
return;
|
||||
@@ -138,13 +142,14 @@ route_event(isc_task_t *task, isc_event_t *event)
|
||||
isc_event_free(&event);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif /* ifdef RTM_VERSION */
|
||||
|
||||
switch (rtm->MSGTYPE) {
|
||||
case RTM_NEWADDR:
|
||||
case RTM_DELADDR:
|
||||
if (mgr->route != NULL && mgr->sctx->interface_auto)
|
||||
if (mgr->route != NULL && mgr->sctx->interface_auto) {
|
||||
ns_interfacemgr_scan(mgr, false);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -159,17 +164,19 @@ route_event(isc_task_t *task, isc_event_t *event)
|
||||
r.length = sizeof(mgr->buf);
|
||||
result = isc_socket_recv(mgr->route, &r, 1, mgr->task,
|
||||
route_event, mgr);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
UNLOCK(&mgr->lock);
|
||||
|
||||
if (done)
|
||||
if (done) {
|
||||
ns_interfacemgr_detach(&mgr);
|
||||
}
|
||||
isc_event_free(&event);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif /* ifdef USE_ROUTE_SOCKET */
|
||||
|
||||
isc_result_t
|
||||
ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
|
||||
@@ -184,7 +191,7 @@ ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
|
||||
|
||||
#ifndef USE_ROUTE_SOCKET
|
||||
UNUSED(task);
|
||||
#endif
|
||||
#endif /* ifndef USE_ROUTE_SOCKET */
|
||||
|
||||
REQUIRE(mctx != NULL);
|
||||
REQUIRE(mgrp != NULL);
|
||||
@@ -224,18 +231,20 @@ ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
|
||||
* The listen-on lists are initially empty.
|
||||
*/
|
||||
result = ns_listenlist_create(mctx, &mgr->listenon4);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup_ctx;
|
||||
}
|
||||
ns_listenlist_attach(mgr->listenon4, &mgr->listenon6);
|
||||
|
||||
result = dns_aclenv_init(mctx, &mgr->aclenv);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup_listenon;
|
||||
}
|
||||
#if defined(HAVE_GEOIP2)
|
||||
mgr->aclenv.geoip = geoip;
|
||||
#else
|
||||
#else /* if defined(HAVE_GEOIP2) */
|
||||
UNUSED(geoip);
|
||||
#endif
|
||||
#endif /* if defined(HAVE_GEOIP2) */
|
||||
|
||||
#ifdef USE_ROUTE_SOCKET
|
||||
mgr->route = NULL;
|
||||
@@ -256,9 +265,9 @@ ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
|
||||
isc_task_attach(task, &mgr->task);
|
||||
}
|
||||
isc_refcount_init(&mgr->references, (mgr->route != NULL) ? 2 : 1);
|
||||
#else
|
||||
#else /* ifdef USE_ROUTE_SOCKET */
|
||||
isc_refcount_init(&mgr->references, 1);
|
||||
#endif
|
||||
#endif /* ifdef USE_ROUTE_SOCKET */
|
||||
mgr->magic = IFMGR_MAGIC;
|
||||
*mgrp = mgr;
|
||||
|
||||
@@ -274,13 +283,13 @@ ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx,
|
||||
ns_interfacemgr_detach(&mgr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* ifdef USE_ROUTE_SOCKET */
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
#ifdef USE_ROUTE_SOCKET
|
||||
cleanup_aclenv:
|
||||
dns_aclenv_destroy(&mgr->aclenv);
|
||||
#endif
|
||||
#endif /* ifdef USE_ROUTE_SOCKET */
|
||||
cleanup_listenon:
|
||||
ns_listenlist_detach(&mgr->listenon4);
|
||||
ns_listenlist_detach(&mgr->listenon6);
|
||||
@@ -300,20 +309,24 @@ ns_interfacemgr_destroy(ns_interfacemgr_t *mgr)
|
||||
isc_refcount_destroy(&mgr->references);
|
||||
|
||||
#ifdef USE_ROUTE_SOCKET
|
||||
if (mgr->route != NULL)
|
||||
if (mgr->route != NULL) {
|
||||
isc_socket_detach(&mgr->route);
|
||||
if (mgr->task != NULL)
|
||||
}
|
||||
if (mgr->task != NULL) {
|
||||
isc_task_detach(&mgr->task);
|
||||
#endif
|
||||
}
|
||||
#endif /* ifdef USE_ROUTE_SOCKET */
|
||||
dns_aclenv_destroy(&mgr->aclenv);
|
||||
ns_listenlist_detach(&mgr->listenon4);
|
||||
ns_listenlist_detach(&mgr->listenon6);
|
||||
clearlistenon(mgr);
|
||||
isc_mutex_destroy(&mgr->lock);
|
||||
if (mgr->sctx != NULL)
|
||||
if (mgr->sctx != NULL) {
|
||||
ns_server_detach(&mgr->sctx);
|
||||
if (mgr->excl != NULL)
|
||||
}
|
||||
if (mgr->excl != NULL) {
|
||||
isc_task_detach(&mgr->excl);
|
||||
}
|
||||
mgr->magic = 0;
|
||||
isc_mem_putanddetach(&mgr->mctx, mgr, sizeof(*mgr));
|
||||
}
|
||||
@@ -375,7 +388,7 @@ ns_interfacemgr_shutdown(ns_interfacemgr_t *mgr)
|
||||
isc_task_detach(&mgr->task);
|
||||
}
|
||||
UNLOCK(&mgr->lock);
|
||||
#endif
|
||||
#endif /* ifdef USE_ROUTE_SOCKET */
|
||||
purge_old_interfaces(mgr);
|
||||
}
|
||||
|
||||
@@ -480,14 +493,15 @@ ns_interface_listentcp(ns_interface_t *ifp)
|
||||
|
||||
#if 0
|
||||
#ifndef ISC_ALLOW_MAPPED
|
||||
isc_socket_ipv6only(ifp->tcpsocket, true);
|
||||
#endif
|
||||
isc_socket_ipv6only(ifp->tcpsocket,true);
|
||||
#endif /* ifndef ISC_ALLOW_MAPPED */
|
||||
|
||||
if (ifp->dscp != -1)
|
||||
isc_socket_dscp(ifp->tcpsocket, ifp->dscp);
|
||||
if (ifp->dscp != -1) {
|
||||
isc_socket_dscp(ifp->tcpsocket,ifp->dscp);
|
||||
}
|
||||
|
||||
(void)isc_socket_filter(ifp->tcpsocket, "dataready");
|
||||
#endif
|
||||
(void)isc_socket_filter(ifp->tcpsocket,"dataready");
|
||||
#endif /* if 0 */
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -502,15 +516,17 @@ ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
|
||||
REQUIRE(addr_in_use == NULL || *addr_in_use == false);
|
||||
|
||||
result = ns_interface_create(mgr, addr, name, &ifp);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
ifp->dscp = dscp;
|
||||
|
||||
result = ns_interface_listenudp(ifp);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if ((result == ISC_R_ADDRINUSE) && (addr_in_use != NULL))
|
||||
if ((result == ISC_R_ADDRINUSE) && (addr_in_use != NULL)) {
|
||||
*addr_in_use = true;
|
||||
}
|
||||
goto cleanup_interface;
|
||||
}
|
||||
|
||||
@@ -519,8 +535,9 @@ ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
|
||||
result = ns_interface_listentcp(ifp);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
if ((result == ISC_R_ADDRINUSE) &&
|
||||
(addr_in_use != NULL))
|
||||
(addr_in_use != NULL)) {
|
||||
*addr_in_use = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXXRTH We don't currently have a way to easily stop
|
||||
@@ -661,8 +678,9 @@ clearacl(isc_mem_t *mctx, dns_acl_t **aclp)
|
||||
dns_acl_t * newacl = NULL;
|
||||
isc_result_t result;
|
||||
result = dns_acl_create(mctx, 0, &newacl);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
dns_acl_detach(aclp);
|
||||
dns_acl_attach(newacl, aclp);
|
||||
dns_acl_detach(&newacl);
|
||||
@@ -673,7 +691,7 @@ static bool
|
||||
listenon_is_ip6_any(ns_listenelt_t *elt)
|
||||
{
|
||||
REQUIRE(elt && elt->acl);
|
||||
return dns_acl_isany(elt->acl);
|
||||
return (dns_acl_isany(elt->acl));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -689,15 +707,17 @@ setup_locals(ns_interfacemgr_t *mgr, isc_interface_t *interface)
|
||||
prefixlen = (netaddr->family == AF_INET) ? 32 : 128;
|
||||
result = dns_iptable_addprefix(mgr->aclenv.localhost->iptable, netaddr,
|
||||
prefixlen, true);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Then add localnets prefix */
|
||||
result = isc_netaddr_masktoprefixlen(&interface->netmask, &prefixlen);
|
||||
|
||||
/* Non contiguous netmasks not allowed by IPv6 arch. */
|
||||
if (result != ISC_R_SUCCESS && netaddr->family == AF_INET6)
|
||||
if (result != ISC_R_SUCCESS && netaddr->family == AF_INET6) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_WARNING,
|
||||
@@ -718,8 +738,9 @@ setup_locals(ns_interfacemgr_t *mgr, isc_interface_t *interface)
|
||||
|
||||
result = dns_iptable_addprefix(mgr->aclenv.localnets->iptable, netaddr,
|
||||
prefixlen, true);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
@@ -786,37 +807,40 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, bool verbose)
|
||||
bool tried_listening;
|
||||
bool all_addresses_in_use;
|
||||
|
||||
if (ext_listen != NULL)
|
||||
if (ext_listen != NULL) {
|
||||
adjusting = true;
|
||||
}
|
||||
|
||||
if (isc_net_probeipv6() == ISC_R_SUCCESS)
|
||||
if (isc_net_probeipv6() == ISC_R_SUCCESS) {
|
||||
scan_ipv6 = true;
|
||||
else if ((mgr->sctx->options & NS_SERVER_DISABLE6) == 0)
|
||||
} else if ((mgr->sctx->options & NS_SERVER_DISABLE6) == 0) {
|
||||
isc_log_write(IFMGR_COMMON_LOGARGS,
|
||||
verbose ? ISC_LOG_INFO : ISC_LOG_DEBUG(1),
|
||||
"no IPv6 interfaces found");
|
||||
}
|
||||
|
||||
if (isc_net_probeipv4() == ISC_R_SUCCESS)
|
||||
if (isc_net_probeipv4() == ISC_R_SUCCESS) {
|
||||
scan_ipv4 = true;
|
||||
else if ((mgr->sctx->options & NS_SERVER_DISABLE4) == 0)
|
||||
} else if ((mgr->sctx->options & NS_SERVER_DISABLE4) == 0) {
|
||||
isc_log_write(IFMGR_COMMON_LOGARGS,
|
||||
verbose ? ISC_LOG_INFO : ISC_LOG_DEBUG(1),
|
||||
"no IPv4 interfaces found");
|
||||
}
|
||||
|
||||
/*
|
||||
* A special, but typical case; listen-on-v6 { any; }.
|
||||
* When we can make the socket IPv6-only, open a single wildcard
|
||||
* socket for IPv6 communication. Otherwise, make separate
|
||||
* socket for each IPv6 address in order to avoid accepting IPv4
|
||||
* packets as the form of mapped addresses unintentionally
|
||||
* unless explicitly allowed.
|
||||
*/
|
||||
/*
|
||||
* A special, but typical case; listen-on-v6 { any; }.
|
||||
* When we can make the socket IPv6-only, open a single wildcard
|
||||
* socket for IPv6 communication. Otherwise, make separate
|
||||
* socket for each IPv6 address in order to avoid accepting IPv4
|
||||
* packets as the form of mapped addresses unintentionally
|
||||
* unless explicitly allowed.
|
||||
*/
|
||||
#ifndef ISC_ALLOW_MAPPED
|
||||
if (scan_ipv6 == true && isc_net_probe_ipv6only() != ISC_R_SUCCESS) {
|
||||
ipv6only = false;
|
||||
log_explicit = true;
|
||||
}
|
||||
#endif
|
||||
#endif /* ifndef ISC_ALLOW_MAPPED */
|
||||
if (scan_ipv6 == true && isc_net_probe_ipv6pktinfo() != ISC_R_SUCCESS) {
|
||||
ipv6pktinfo = false;
|
||||
log_explicit = true;
|
||||
@@ -826,8 +850,9 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, bool verbose)
|
||||
le = ISC_LIST_NEXT(le, link)) {
|
||||
struct in6_addr in6a;
|
||||
|
||||
if (!listenon_is_ip6_any(le))
|
||||
if (!listenon_is_ip6_any(le)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
in6a = in6addr_any;
|
||||
isc_sockaddr_fromin6(&listen_addr, &in6a, le->port);
|
||||
@@ -835,9 +860,9 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, bool verbose)
|
||||
ifp = find_matching_interface(mgr, &listen_addr);
|
||||
if (ifp != NULL) {
|
||||
ifp->generation = mgr->generation;
|
||||
if (le->dscp != -1 && ifp->dscp == -1)
|
||||
if (le->dscp != -1 && ifp->dscp == -1) {
|
||||
ifp->dscp = le->dscp;
|
||||
else if (le->dscp != ifp->dscp) {
|
||||
} else if (le->dscp != ifp->dscp) {
|
||||
isc_sockaddr_format(&listen_addr, sabuf,
|
||||
sizeof(sabuf));
|
||||
isc_log_write(IFMGR_COMMON_LOGARGS,
|
||||
@@ -855,13 +880,14 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, bool verbose)
|
||||
result = ns_interface_setup(mgr, &listen_addr,
|
||||
"<any>", &ifp, true,
|
||||
le->dscp, NULL);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
ifp->flags |= NS_INTERFACEFLAG_ANYADDR;
|
||||
else
|
||||
} else {
|
||||
isc_log_write(IFMGR_COMMON_LOGARGS,
|
||||
ISC_LOG_ERROR,
|
||||
"listening on all IPv6 "
|
||||
"interfaces failed");
|
||||
}
|
||||
/* Continue. */
|
||||
}
|
||||
}
|
||||
@@ -871,16 +897,19 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, bool verbose)
|
||||
isc_netaddr_any6(&zero_address6);
|
||||
|
||||
result = isc_interfaceiter_create(mgr->mctx, &iter);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (result);
|
||||
}
|
||||
|
||||
if (adjusting == false) {
|
||||
result = clearacl(mgr->mctx, &mgr->aclenv.localhost);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup_iter;
|
||||
}
|
||||
result = clearacl(mgr->mctx, &mgr->aclenv.localnets);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup_iter;
|
||||
}
|
||||
clearlistenon(mgr);
|
||||
}
|
||||
|
||||
@@ -893,16 +922,20 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, bool verbose)
|
||||
unsigned int family;
|
||||
|
||||
result = isc_interfaceiter_current(iter, &interface);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
|
||||
family = interface.address.family;
|
||||
if (family != AF_INET && family != AF_INET6)
|
||||
if (family != AF_INET && family != AF_INET6) {
|
||||
continue;
|
||||
if (scan_ipv4 == false && family == AF_INET)
|
||||
}
|
||||
if (scan_ipv4 == false && family == AF_INET) {
|
||||
continue;
|
||||
if (scan_ipv6 == false && family == AF_INET6)
|
||||
}
|
||||
if (scan_ipv6 == false && family == AF_INET6) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Test for the address being nonzero rather than testing
|
||||
@@ -932,8 +965,9 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, bool verbose)
|
||||
}
|
||||
|
||||
result = setup_locals(mgr, &interface);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto ignore_interface;
|
||||
}
|
||||
}
|
||||
|
||||
listenon:
|
||||
@@ -983,8 +1017,9 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, bool verbose)
|
||||
* special considerations later, so remember it.
|
||||
*/
|
||||
if (family == AF_INET6 && ipv6only && ipv6pktinfo &&
|
||||
listenon_is_ip6_any(le))
|
||||
listenon_is_ip6_any(le)) {
|
||||
ipv6_wildcard = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* When adjusting interfaces with extra a listening
|
||||
@@ -1011,16 +1046,17 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, bool verbose)
|
||||
match = 0;
|
||||
}
|
||||
}
|
||||
if (ipv6_wildcard == true && match == 0)
|
||||
if (ipv6_wildcard == true && match == 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ifp = find_matching_interface(mgr, &listen_sockaddr);
|
||||
if (ifp != NULL) {
|
||||
ifp->generation = mgr->generation;
|
||||
if (le->dscp != -1 && ifp->dscp == -1)
|
||||
if (le->dscp != -1 && ifp->dscp == -1) {
|
||||
ifp->dscp = le->dscp;
|
||||
else if (le->dscp != ifp->dscp) {
|
||||
} else if (le->dscp != ifp->dscp) {
|
||||
isc_sockaddr_format(&listen_sockaddr,
|
||||
sabuf,
|
||||
sizeof(sabuf));
|
||||
@@ -1033,8 +1069,10 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, bool verbose)
|
||||
} else {
|
||||
bool addr_in_use = false;
|
||||
|
||||
if (adjusting == false && ipv6_wildcard == true)
|
||||
if (adjusting == false &&
|
||||
ipv6_wildcard == true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (log_explicit && family == AF_INET6 &&
|
||||
!adjusting && listenon_is_ip6_any(le)) {
|
||||
@@ -1067,8 +1105,9 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, bool verbose)
|
||||
le->dscp, &addr_in_use);
|
||||
|
||||
tried_listening = true;
|
||||
if (!addr_in_use)
|
||||
if (!addr_in_use) {
|
||||
all_addresses_in_use = false;
|
||||
}
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_log_write(IFMGR_COMMON_LOGARGS,
|
||||
@@ -1095,14 +1134,15 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, bool verbose)
|
||||
interface.name, isc_result_totext(result));
|
||||
continue;
|
||||
}
|
||||
if (result != ISC_R_NOMORE)
|
||||
if (result != ISC_R_NOMORE) {
|
||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||
"interface iteration failed: %s",
|
||||
isc_result_totext(result));
|
||||
else
|
||||
} else {
|
||||
result = ((tried_listening && all_addresses_in_use)
|
||||
? ISC_R_ADDRINUSE
|
||||
: ISC_R_SUCCESS);
|
||||
}
|
||||
cleanup_iter:
|
||||
isc_interfaceiter_destroy(&iter);
|
||||
return (result);
|
||||
@@ -1120,8 +1160,9 @@ ns_interfacemgr_scan0(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
|
||||
mgr->generation++; /* Increment the generation count. */
|
||||
|
||||
result = do_scan(mgr, ext_listen, verbose);
|
||||
if ((result != ISC_R_SUCCESS) && (result != ISC_R_ADDRINUSE))
|
||||
if ((result != ISC_R_SUCCESS) && (result != ISC_R_ADDRINUSE)) {
|
||||
purge = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now go through the interface list and delete anything that
|
||||
@@ -1129,8 +1170,9 @@ ns_interfacemgr_scan0(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
|
||||
* how we catch interfaces that go away or change their
|
||||
* addresses.
|
||||
*/
|
||||
if (purge)
|
||||
if (purge) {
|
||||
purge_old_interfaces(mgr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Warn if we are not listening on any interface.
|
||||
@@ -1163,13 +1205,15 @@ ns_interfacemgr_scan(ns_interfacemgr_t *mgr, bool verbose)
|
||||
* lock now will we need to relinquish it later.
|
||||
*/
|
||||
result = isc_task_beginexclusive(mgr->excl);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
unlock = true;
|
||||
}
|
||||
|
||||
result = ns_interfacemgr_scan0(mgr, NULL, verbose);
|
||||
|
||||
if (unlock)
|
||||
if (unlock) {
|
||||
isc_task_endexclusive(mgr->excl);
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
@@ -1213,8 +1257,9 @@ ns_interfacemgr_dumprecursing(FILE *f, ns_interfacemgr_t *mgr)
|
||||
LOCK(&mgr->lock);
|
||||
interface = ISC_LIST_HEAD(mgr->interfaces);
|
||||
while (interface != NULL) {
|
||||
if (interface->clientmgr != NULL)
|
||||
if (interface->clientmgr != NULL) {
|
||||
ns_client_dumprecursing(f, interface->clientmgr);
|
||||
}
|
||||
interface = ISC_LIST_NEXT(interface, link);
|
||||
}
|
||||
UNLOCK(&mgr->lock);
|
||||
|
Reference in New Issue
Block a user