Failing to open/bind the lwresd socket should be a fatal error, since

it's only attempted if the user explicitly calls named with -r.
This commit is contained in:
Brian Wellington 2000-06-16 07:42:41 +00:00
parent 7777118507
commit f6c700247a

View file

@ -290,25 +290,16 @@ ns_lwresd_create(isc_mem_t *mctx, dns_view_t *view, ns_lwresd_t **lwresdp) {
sock = NULL;
result = isc_socket_create(ns_g_socketmgr, AF_INET, isc_sockettype_udp,
&sock);
if (result != ISC_R_SUCCESS) {
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_NETWORK,
NS_LOGMODULE_LWRESD, ISC_LOG_ERROR,
"failed to create socket: %s",
isc_result_totext(result));
return;
}
if (result != ISC_R_SUCCESS)
fatal("failed to create socket", result);
lh_addr.s_addr = htonl(INADDR_LOOPBACK);
isc_sockaddr_fromin(&localhost, &lh_addr, LWRES_UDP_PORT);
result = isc_socket_bind(sock, &localhost);
if (result != ISC_R_SUCCESS) {
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_NETWORK,
NS_LOGMODULE_LWRESD, ISC_LOG_ERROR,
"binding lwres protocol socket to port %d: %s",
LWRES_UDP_PORT, isc_result_totext(result));
isc_socket_detach(&sock);
return;
fatal("failed to bind lwresd protocol socket", result);
}
lwresd = isc_mem_get(mctx, sizeof(*lwresd));