Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP5:Update
dhcp.1901
0026-dhcp-4.2.x-disable-unused-ddns-port-in-ser...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0026-dhcp-4.2.x-disable-unused-ddns-port-in-server.891655.patch of Package dhcp.1901
Author: William Preston <wpreston@suse.com> Subject: do not bind ddns socket in server when ddns-update-style is none References: bsc#891655 Upstream: yes backported from commit 61ef216b8dc05bc4245b61eee812038757d12ffe by Shawn Routhier <sar@isc.org> with changes. diff --git a/client/dhclient.c b/client/dhclient.c index bfa99fb..93f1dfc 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -171,7 +171,7 @@ main(int argc, char **argv) { #endif /* Set up the isc and dns library managers */ - status = dhcp_context_create(); + status = dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB); if (status != ISC_R_SUCCESS) log_fatal("Can't initialize context: %s", isc_result_totext(status)); diff --git a/dhcpctl/dhcpctl.c b/dhcpctl/dhcpctl.c index a4aee7f..2217956 100644 --- a/dhcpctl/dhcpctl.c +++ b/dhcpctl/dhcpctl.c @@ -43,7 +43,7 @@ dhcpctl_status dhcpctl_initialize () isc_result_t status; /* Set up the isc and dns library managers */ - status = dhcp_context_create(); + status = dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB); if (status != ISC_R_SUCCESS) return status; diff --git a/includes/omapip/isclib.h b/includes/omapip/isclib.h index a9df110..05a18f1 100644 --- a/includes/omapip/isclib.h +++ b/includes/omapip/isclib.h @@ -121,7 +121,9 @@ isclib_make_dst_key(char *inname, int length, dst_key_t **dstkey); -isc_result_t dhcp_context_create(void); +#define DHCP_CONTEXT_PRE_DB 1 +#define DHCP_CONTEXT_POST_DB 2 +isc_result_t dhcp_context_create(int flags); void isclib_cleanup(void); void dhcp_signal_handler(int signal); diff --git a/omapip/isclib.c b/omapip/isclib.c index e9cb321..d833bc9 100644 --- a/omapip/isclib.c +++ b/omapip/isclib.c @@ -87,98 +87,102 @@ handle_signal(int sig, void (*handler)(int)) { } isc_result_t -dhcp_context_create(void) { +dhcp_context_create(int flags) { isc_result_t result; - /* - * Set up the error messages, this isn't the right place - * for this call but it is convienent for now. - */ - result = dhcp_result_register(); - if (result != ISC_R_SUCCESS) { - log_fatal("register_table() %s: %u", "failed", result); - } - - memset(&dhcp_gbl_ctx, 0, sizeof (dhcp_gbl_ctx)); + if ((flags & DHCP_CONTEXT_PRE_DB) != 0) { + /* + * Set up the error messages, this isn't the right place + * for this call but it is convienent for now. + */ + result = dhcp_result_register(); + if (result != ISC_R_SUCCESS) { + log_fatal("register_table() %s: %u", "failed", result); + } + + memset(&dhcp_gbl_ctx, 0, sizeof (dhcp_gbl_ctx)); - isc_lib_register(); + isc_lib_register(); - /* get the current time for use as the random seed */ - gettimeofday(&cur_tv, (struct timezone *)0); - isc_random_seed(cur_tv.tv_sec); + /* get the current time for use as the random seed */ + gettimeofday(&cur_tv, (struct timezone *)0); + isc_random_seed(cur_tv.tv_sec); #if defined (NSUPDATE) - result = dns_lib_init(); - if (result != ISC_R_SUCCESS) - goto cleanup; + result = dns_lib_init(); + if (result != ISC_R_SUCCESS) + goto cleanup; +#else + /* The dst library is inited as part of dns_lib_init, we don't + * need it if NSUPDATE is enabled */ + result = dst_lib_init(dhcp_gbl_ctx.mctx, NULL, 0); + if (result != ISC_R_SUCCESS) + goto cleanup; #endif - result = isc_mem_create(0, 0, &dhcp_gbl_ctx.mctx); - if (result != ISC_R_SUCCESS) - goto cleanup; - - result = isc_appctx_create(dhcp_gbl_ctx.mctx, &dhcp_gbl_ctx.actx); - if (result != ISC_R_SUCCESS) - goto cleanup; - - result = isc_app_ctxstart(dhcp_gbl_ctx.actx); - if (result != ISC_R_SUCCESS) - goto cleanup; - - /* - * Always ignore SIGPIPE. - * Otherwise we will die before the errno == EPIPE - * checks in the socket code are reached. - * - * Note: unlike isc_app_start(), isc_app_ctxstart() - * does not set any signal handlers. - */ - result = handle_signal(SIGPIPE, SIG_IGN); - if (result != ISC_R_SUCCESS) - goto cleanup; - - dhcp_gbl_ctx.actx_started = ISC_TRUE; - - result = isc_taskmgr_createinctx(dhcp_gbl_ctx.mctx, - dhcp_gbl_ctx.actx, - 1, 0, - &dhcp_gbl_ctx.taskmgr); - if (result != ISC_R_SUCCESS) - goto cleanup; - - result = isc_socketmgr_createinctx(dhcp_gbl_ctx.mctx, - dhcp_gbl_ctx.actx, - &dhcp_gbl_ctx.socketmgr); - if (result != ISC_R_SUCCESS) - goto cleanup; - - result = isc_timermgr_createinctx(dhcp_gbl_ctx.mctx, - dhcp_gbl_ctx.actx, - &dhcp_gbl_ctx.timermgr); - if (result != ISC_R_SUCCESS) - goto cleanup; - - result = isc_task_create(dhcp_gbl_ctx.taskmgr, 0, &dhcp_gbl_ctx.task); - if (result != ISC_R_SUCCESS) - goto cleanup; + result = isc_mem_create(0, 0, &dhcp_gbl_ctx.mctx); + if (result != ISC_R_SUCCESS) + goto cleanup; + + result = isc_appctx_create(dhcp_gbl_ctx.mctx, &dhcp_gbl_ctx.actx); + if (result != ISC_R_SUCCESS) + goto cleanup; + + result = isc_app_ctxstart(dhcp_gbl_ctx.actx); + if (result != ISC_R_SUCCESS) + goto cleanup; + + /* + * Always ignore SIGPIPE. + * Otherwise we will die before the errno == EPIPE + * checks in the socket code are reached. + * + * Note: unlike isc_app_start(), isc_app_ctxstart() + * does not set any signal handlers. + */ + result = handle_signal(SIGPIPE, SIG_IGN); + if (result != ISC_R_SUCCESS) + goto cleanup; + + dhcp_gbl_ctx.actx_started = ISC_TRUE; + + result = isc_taskmgr_createinctx(dhcp_gbl_ctx.mctx, + dhcp_gbl_ctx.actx, + 1, 0, + &dhcp_gbl_ctx.taskmgr); + if (result != ISC_R_SUCCESS) + goto cleanup; + + result = isc_socketmgr_createinctx(dhcp_gbl_ctx.mctx, + dhcp_gbl_ctx.actx, + &dhcp_gbl_ctx.socketmgr); + if (result != ISC_R_SUCCESS) + goto cleanup; + + result = isc_timermgr_createinctx(dhcp_gbl_ctx.mctx, + dhcp_gbl_ctx.actx, + &dhcp_gbl_ctx.timermgr); + if (result != ISC_R_SUCCESS) + goto cleanup; + + result = isc_task_create(dhcp_gbl_ctx.taskmgr, 0, &dhcp_gbl_ctx.task); + if (result != ISC_R_SUCCESS) + goto cleanup; + } #if defined (NSUPDATE) - result = dns_client_createx(dhcp_gbl_ctx.mctx, - dhcp_gbl_ctx.actx, - dhcp_gbl_ctx.taskmgr, - dhcp_gbl_ctx.socketmgr, - dhcp_gbl_ctx.timermgr, - 0, - &dhcp_gbl_ctx.dnsclient); - if (result != ISC_R_SUCCESS) - goto cleanup; -#else - /* The dst library is inited as part of dns_lib_init, we don't - * need it if NSUPDATE is enabled */ - result = dst_lib_init(dhcp_gbl_ctx.mctx, NULL, 0); - if (result != ISC_R_SUCCESS) - goto cleanup; - + if ((flags & DHCP_CONTEXT_POST_DB) != 0) { + + result = dns_client_createx(dhcp_gbl_ctx.mctx, + dhcp_gbl_ctx.actx, + dhcp_gbl_ctx.taskmgr, + dhcp_gbl_ctx.socketmgr, + dhcp_gbl_ctx.timermgr, + 0, + &dhcp_gbl_ctx.dnsclient); + if (result != ISC_R_SUCCESS) + goto cleanup; + } #endif return(ISC_R_SUCCESS); diff --git a/omapip/test.c b/omapip/test.c index e97a61f..2735716 100644 --- a/omapip/test.c +++ b/omapip/test.c @@ -45,7 +45,7 @@ int main (int argc, char **argv) omapi_object_t *connection = (omapi_object_t*)0; isc_result_t status; - status = dhcp_context_create(); + status = dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB); if (status != ISC_R_SUCCESS) { fprintf(stderr, "Can't initialize context: %s\n", isc_result_totext(status)); diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c index 4ef6737..15e5c46 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c @@ -195,7 +195,7 @@ main(int argc, char **argv) { #endif /* Set up the isc and dns library managers */ - status = dhcp_context_create(); + status = dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB); if (status != ISC_R_SUCCESS) log_fatal("Can't initialize context: %s", isc_result_totext(status)); diff --git a/server/dhcpd.c b/server/dhcpd.c index b28c34c..434db00 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c @@ -281,7 +281,7 @@ main(int argc, char **argv) { close(fd); /* Set up the isc and dns library managers */ - status = dhcp_context_create(); + status = dhcp_context_create(DHCP_CONTEXT_PRE_DB); if (status != ISC_R_SUCCESS) log_fatal("Can't initialize context: %s", isc_result_totext(status)); @@ -1100,6 +1100,11 @@ void postconf_initialization (int quiet) if (ddns_update_style == DDNS_UPDATE_STYLE_AD_HOC) { log_fatal("ddns-update-style ad_hoc no longer supported"); } + + if (ddns_update_style != DDNS_UPDATE_STYLE_NONE && dhcp_context_create(DHCP_CONTEXT_POST_DB) + != ISC_R_SUCCESS) + log_fatal("Unable to complete ddns initialization"); + #else /* If we don't have support for updates compiled in tell the user */ if (ddns_update_style != DDNS_UPDATE_STYLE_NONE) { -- 2.1.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor