appropriate zone statements rather than using this functionality.
[ISC-Bugs #30461]
+- Add support for specifying the address from which to send
+ DDNS updates on the DHCP server. There are two new options
+ "ddns-local-address4" and "ddns-local-address6" that each take
+ one instance of their respective address types.
+ [ISC-Bugs #34779]
+
Changes since 4.2.5
- Address static analysis warnings.
#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,
+ NULL, NULL);
if (status != ISC_R_SUCCESS)
log_fatal("Can't initialize context: %s",
isc_result_totext(status));
Subroutines providing general support for objects. */
/*
- * Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2009,2013 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004,2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
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,
+ NULL, NULL);
if (status != ISC_R_SUCCESS)
return status;
#endif
#define SV_CACHE_THRESHOLD 78
#define SV_DONT_USE_FSYNC 79
+#define SV_DDNS_LOCAL_ADDRESS4 80
+#define SV_DDNS_LOCAL_ADDRESS6 81
#if !defined (DEFAULT_PING_TIMEOUT)
# define DEFAULT_PING_TIMEOUT 1
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,
+ struct in_addr *local4,
+ struct in6_addr *local6);
void isclib_cleanup(void);
void dhcp_signal_handler(int signal);
}
isc_result_t
-dhcp_context_create(void) {
+dhcp_context_create(int flags,
+ struct in_addr *local4,
+ struct in6_addr *local6) {
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);
- }
+ 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));
+ 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;
-#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 = 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;
- result = isc_app_ctxstart(dhcp_gbl_ctx.actx);
- if (result != ISC_R_SUCCESS)
- return (result);
- 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;
+#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)
+ return (result);
+ 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;
-
- result = dhcp_dns_client_setservers();
- 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) {
+ isc_sockaddr_t localaddr4, *localaddr4_ptr = NULL;
+ isc_sockaddr_t localaddr6, *localaddr6_ptr = NULL;
+ if (local4 != NULL) {
+ isc_sockaddr_fromin(&localaddr4, local4, 0);
+ localaddr4_ptr = &localaddr4;
+ }
+ if (local6 != NULL) {
+ isc_sockaddr_fromin6(&localaddr6, local6, 0);
+ localaddr6_ptr = &localaddr6;
+ }
+ result = dns_client_createx2(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,
+ localaddr4_ptr,
+ localaddr6_ptr);
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+
+ result = dhcp_dns_client_setservers();
+ if (result != ISC_R_SUCCESS)
+ goto cleanup;
+ }
#endif
+
return(ISC_R_SUCCESS);
cleanup:
Test code for omapip... */
/*
- * Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2009-2010,2013 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
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,
+ NULL, NULL);
if (status != ISC_R_SUCCESS) {
fprintf(stderr, "Can't initialize context: %s\n",
isc_result_totext(status));
#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,
+ NULL, NULL);
if (status != ISC_R_SUCCESS)
log_fatal("Can't initialize context: %s",
isc_result_totext(status));
close(fd);
/* Set up the isc and dns library managers */
- status = dhcp_context_create();
+ status = dhcp_context_create(DHCP_CONTEXT_PRE_DB,
+ NULL, NULL);
if (status != ISC_R_SUCCESS)
log_fatal("Can't initialize context: %s",
isc_result_totext(status));
char *s;
isc_result_t result;
int tmp;
+#if defined (NSUPDATE)
+ struct in_addr local4, *local4_ptr = NULL;
+ struct in6_addr local6, *local6_ptr = NULL;
+#endif
/* Now try to get the lease file name. */
option_state_allocate(&options, MDL);
if (ddns_update_style == DDNS_UPDATE_STYLE_AD_HOC) {
log_fatal("ddns-update-style ad_hoc no longer supported");
}
+
+ oc = lookup_option(&server_universe, options, SV_DDNS_LOCAL_ADDRESS4);
+ if (oc) {
+ if (evaluate_option_cache(&db, NULL, NULL, NULL, options, NULL,
+ &global_scope, oc, MDL)) {
+ if (db.len == 4) {
+ memcpy(&local4, db.data, 4);
+ local4_ptr = &local4;
+ }
+ data_string_forget(&db, MDL);
+ }
+ }
+
+ oc = lookup_option(&server_universe, options, SV_DDNS_LOCAL_ADDRESS6);
+ if (oc) {
+ if (evaluate_option_cache(&db, NULL, NULL, NULL, options, NULL,
+ &global_scope, oc, MDL)) {
+ if (db.len == 16) {
+ memcpy(&local6, db.data, 16);
+ local6_ptr = &local6;
+ }
+ data_string_forget(&db, MDL);
+ }
+ }
+
+ if (dhcp_context_create(DHCP_CONTEXT_POST_DB, local4_ptr, local6_ptr)
+ != 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) {
domain-name (FQDN).
.RE
.PP
+The \fddns-local-address4\fR and \fddns-local-address6\fR statements
+.RS 0.25i
+.PP
+.B ddns-local-address4 \fIaddress\fB;\fR
+.PP
+.B ddns-local-address6 \fIaddress\fB;\fR
+.PP
+The \fIaddress\fR parameter should be the local IPv4 or IPv6 address
+the server should use as the from address when sending DDNS update
+requests.
+.RE
+.PP
The \fIddns-rev-domainname\fR statement
.RS 0.25i
.PP
.B ddns-rev-domainname \fIname\fB;\fR
+.PP
The \fIname\fR parameter should be the domain name that will be
appended to the client's reversed IP address to produce a name for use
in the client's PTR record. By default, this is "in-addr.arpa.", but
.RS 0.25i
.PP
.B delayed-ack \fIcount\fR\fB;\fR
+.PP
.B max-ack-delay \fImicroseconds\fR\fB;\fR
.PP
.I Count
#endif /* LDAP_CONFIGURATION */
{ "dhcp-cache-threshold", "B", &server_universe, 78, 1 },
{ "dont-use-fsync", "f", &server_universe, 79, 1 },
+
+ { "ddns-local-address4", "I", &server_universe, 80, 1 },
+ { "ddns-local-address6", "6", &server_universe, 81, 1 },
+
{ NULL, NULL, NULL, 0, 0 }
};
struct iasubopt *iaaddr_copy;
/* set up dhcp globals */
- dhcp_context_create();
+ dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB,
+ NULL, NULL);
/* and other common arguments */
iaaddr = NULL;
struct iasubopt *iaaddr_copy;
/* set up dhcp globals */
- dhcp_context_create();
+ dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB,
+ NULL, NULL);
/* tests */
/* bogus allocate arguments */
struct iasubopt *iaaddr;
/* set up dhcp globals */
- dhcp_context_create();
+ dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB,
+ NULL, NULL);
/* and other common arguments */
iaid = 666;
int i;
/* set up dhcp globals */
- dhcp_context_create();
+ dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB,
+ NULL, NULL);
/* tests */
/* lots of iaaddr that we delete */
struct ia_xx *ia_na_copy;
/* set up dhcp globals */
- dhcp_context_create();
+ dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB,
+ NULL, NULL);
/* tests */
/* bogus allocate arguments */
unsigned int attempts;
/* set up dhcp globals */
- dhcp_context_create();
+ dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB,
+ NULL, NULL);
/* and other common arguments */
inet_pton(AF_INET6, "1:2:3:4::", &addr);
struct ipv6_pool *pool_copy;
/* set up dhcp globals */
- dhcp_context_create();
+ dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB,
+ NULL, NULL);
/* and other common arguments */
inet_pton(AF_INET6, "1:2:3:4::", &addr);
unsigned int attempts;
/* set up dhcp globals */
- dhcp_context_create();
+ dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB,
+ NULL, NULL);
/* and other common arguments */
inet_pton(AF_INET6, "1:2:3:4::", &addr);
unsigned int attempts;
/* set up dhcp globals */
- dhcp_context_create();
+ dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB,
+ NULL, NULL);
/* and other common arguments */
inet_pton(AF_INET6, "1:2:3:4::", &addr);
unsigned int attempts;
/* set up dhcp globals */
- dhcp_context_create();
+ dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB,
+ NULL, NULL);
/* and other common arguments */
inet_pton(AF_INET6, "1:2:3:4::", &addr);
struct ipv6_pool *pool;
/* set up dhcp globals */
- dhcp_context_create();
+ dhcp_context_create(DHCP_CONTEXT_PRE_DB | DHCP_CONTEXT_POST_DB,
+ NULL, NULL);
/* and other common arguments */
inet_pton(AF_INET6, "1:2:3:4::", &addr);
#!/bin/sh
#
-# Copyright (C) 2009-2012 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2009-2013 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
### be used to chdir down into the directory that is unpacked.
###
v4_2) noSNAP=snapshot BINDTAG=v9_8 ;;
+ v4_3) noSNAP=snapshot BINDTAG=v9_9 ;;
### change to using the head of v9_9 until we upgrade DHCP
### to use shared libraries
HEAD|v[0-9]_[0-9].*) noSNAP=snapshot BINDTAG=v9_9 ;;
### For ease of use, this records the sticky tag of versions
### released with each point release.
###
+ 4.3.0a1) BINDTAG=v9_9 ;;
4.2.6b1) BINDTAG=v9_8_6 ;;
4.2.5b1|4.2.5rc1) BINDTAG=v9_8_4_P1 ;;
4.2.4rc2|4.2.4) BINDTAG=v9_8_3 ;;