From: Shawn Routhier Date: Mon, 28 Apr 2014 22:27:02 +0000 (-0700) Subject: [master] Add #ifdefs to allow code to compile if NSUPDATE isn't defined X-Git-Tag: v4_3_1b1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=158a34fb6801ff5be39d72af8b1962a96a3dc6d8;p=thirdparty%2Fdhcp.git [master] Add #ifdefs to allow code to compile if NSUPDATE isn't defined --- diff --git a/RELNOTES b/RELNOTES index 3960563dd..89d7561c8 100644 --- a/RELNOTES +++ b/RELNOTES @@ -77,6 +77,9 @@ by Eric Young (eay@cryptsoft.com). - Fix some minor issues in the dst code. [ISC-Bugs #34172] +- Properly #ifdef functions so that the code can compile without NSUPDATE + [ISC-Bugs #35058] + Changes since 4.3.0rc1 - None diff --git a/common/tests/dns_unittest.c b/common/tests/dns_unittest.c index 7bc537dab..0236f6674 100644 --- a/common/tests/dns_unittest.c +++ b/common/tests/dns_unittest.c @@ -31,6 +31,8 @@ * from rfc 4701 */ +#if defined (NSUPDATE) + char *name_1 = "chi6.example.com"; u_int8_t clid_1[] = {0x00, 0x01, 0x00, 0x06, 0x41, 0x2d, 0xf1, 0x66, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06}; u_int8_t std_result_1[] = {0x00, 0x02, 0x01, 0x63, 0x6f, 0xc0, 0xb8, 0x27, 0x1c, @@ -173,3 +175,19 @@ ATF_TP_ADD_TCS(tp) return (atf_no_error()); } + +#else /* NSUPDATE */ +ATF_TC(untested); +ATF_TC_HEAD(untested, tc) { + atf_tc_set_md_var(tc, "descr", "skipping dns test"); +} +ATF_TC_BODY(untested, tc) { + IGNORE_UNUSED(tc); + atf_tc_skip("NSUPDATE is not defined"); +} +ATF_TP_ADD_TCS(tp) { + ATF_TP_ADD_TC(tp, untested); + + return (atf_no_error()); +} +#endif /* NSUPDATE */ diff --git a/omapip/isclib.c b/omapip/isclib.c index 671b321ba..59332ed9b 100644 --- a/omapip/isclib.c +++ b/omapip/isclib.c @@ -144,6 +144,15 @@ dhcp_context_create(int flags, gettimeofday(&cur_tv, (struct timezone *)0); isc_random_seed(cur_tv.tv_sec); + /* we need to create the memory context before + * the lib inits in case we aren't doing NSUPDATE + * in which case dst needs a memory context + */ + result = isc_mem_create(0, 0, &dhcp_gbl_ctx.mctx); + if (result != ISC_R_SUCCESS) + goto cleanup; + + #if defined (NSUPDATE) result = dns_lib_init(); if (result != ISC_R_SUCCESS) @@ -156,9 +165,6 @@ dhcp_context_create(int flags, 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); diff --git a/server/dhcpd.c b/server/dhcpd.c index a06913ee2..2ae031e6f 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c @@ -412,7 +412,9 @@ main(int argc, char **argv) { trace_srandom = trace_type_register ("random-seed", (void *)0, trace_seed_input, trace_seed_stop, MDL); +#if defined (NSUPDATE) trace_ddns_init(); +#endif /* NSUPDATE */ #endif #if defined (PARANOIA) diff --git a/server/failover.c b/server/failover.c index 618bdc62d..96ee1774e 100644 --- a/server/failover.c +++ b/server/failover.c @@ -5222,7 +5222,9 @@ isc_result_t dhcp_failover_process_bind_update (dhcp_failover_state_t *state, */ if (msg->binding_status == FTS_ACTIVE && (chaddr_changed || ident_changed)) { +#if defined (NSUPDATE) (void) ddns_removals(lease, NULL, NULL, ISC_FALSE); +#endif /* NSUPDATE */ if (lease->scope != NULL) binding_scope_dereference(&lease->scope, MDL);