mirror of
https://github.com/isc-projects/bind9.git
synced 2026-04-22 23:01:43 -04:00
when binding to the lwres protocol port fails, log an error message
and exit instead of catching an assertion
This commit is contained in:
parent
b01324ef07
commit
3eb48635d7
1 changed files with 26 additions and 0 deletions
|
|
@ -65,6 +65,21 @@ dns_dispatchmgr_t *dispatchmgr;
|
|||
|
||||
isc_sockaddrlist_t forwarders;
|
||||
|
||||
static isc_logmodule_t logmodules[] = {
|
||||
{ "main", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
#define LWRES_LOGMODULE_MAIN (&logmodules[0])
|
||||
|
||||
static isc_logcategory_t logcategories[] = {
|
||||
{ "network", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
#define LWRES_LOGCATEGORY_NETWORK (&logcategories[0])
|
||||
|
||||
|
||||
static isc_result_t
|
||||
create_view(isc_mem_t *mctx) {
|
||||
dns_cache_t *cache;
|
||||
|
|
@ -261,6 +276,8 @@ main(int argc, char **argv) {
|
|||
lctx = NULL;
|
||||
result = isc_log_create(mem, &lctx, &lcfg);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
isc_log_registermodules(lctx, logmodules);
|
||||
isc_log_registercategories(lctx, logcategories);
|
||||
isc_log_setcontext(lctx);
|
||||
dns_log_init(lctx);
|
||||
dns_log_setcontext(lctx);
|
||||
|
|
@ -336,6 +353,15 @@ main(int argc, char **argv) {
|
|||
isc_sockaddr_fromin(&localhost, &lh_addr, LWRES_UDP_PORT);
|
||||
|
||||
result = isc_socket_bind(sock, &localhost);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_log_write(lctx, LWRES_LOGCATEGORY_NETWORK,
|
||||
LWRES_LOGMODULE_MAIN, ISC_LOG_ERROR,
|
||||
"binding lwres protocol socket to port %d: %s",
|
||||
LWRES_UDP_PORT,
|
||||
isc_result_totext(result));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
|
||||
cmgr = isc_mem_get(mem, sizeof(clientmgr_t) * NTASKS);
|
||||
|
|
|
|||
Loading…
Reference in a new issue