aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/Makefile.in7
-rw-r--r--server/ddns.c275
-rw-r--r--server/dhcpd.conf.511
-rw-r--r--server/dhcpd.leases.56
-rw-r--r--server/stables.c2
5 files changed, 172 insertions, 129 deletions
diff --git a/server/Makefile.in b/server/Makefile.in
index 9c808c0..3b0426b 100644
--- a/server/Makefile.in
+++ b/server/Makefile.in
@@ -115,6 +115,7 @@ LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
@@ -192,7 +193,7 @@ all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -217,9 +218,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(top_srcdir)/configure: $(am__configure_deps)
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
diff --git a/server/ddns.c b/server/ddns.c
index b1683c3..2387e04 100644
--- a/server/ddns.c
+++ b/server/ddns.c
@@ -125,10 +125,17 @@ ddns_updates(struct packet *packet, struct lease *lease, struct lease *old,
}
/* assume that we shall update both the A and ptr records */
ddns_cb->flags = DDNS_UPDATE_ADDR | DDNS_UPDATE_PTR;
-
+
+ /*
+ * For v4 we flag static leases so we don't try
+ * and manipulate the lease later. For v6 we don't
+ * get static leases and don't need to flag them.
+ */
if (lease != NULL) {
scope = &(lease->scope);
ddns_cb->address = lease->ip_addr;
+ if (lease->flags & STATIC_LEASE)
+ ddns_cb->flags |= DDNS_STATIC_LEASE;
} else if (lease6 != NULL) {
scope = &(lease6->scope);
memcpy(ddns_cb->address.iabuf, lease6->addr.s6_addr, 16);
@@ -725,6 +732,13 @@ ddns_update_lease_text(dhcp_ddns_cb_t *ddns_cb,
struct in6_addr addr;
struct data_string lease_dhcid;
+ /*
+ * If the lease was static (for a fixed address)
+ * we don't need to do any work.
+ */
+ if (ddns_cb->flags & DDNS_STATIC_LEASE)
+ return (ISC_R_SUCCESS);
+
if (inscope != NULL) {
scope = inscope;
} else if (ddns_cb->address.len == 4) {
@@ -838,8 +852,10 @@ update_lease_failed(struct lease *lease,
sprintf(reason, "unknown");
sprintf(lease_address, "unknown");
- /* let's pretend that everything is ok, so we can continue for
- for information gathering purposes */
+ /*
+ * let's pretend that everything is ok, so we can continue for
+ * information gathering purposes
+ */
if (ddns_cb != NULL) {
strncpy(lease_address, piaddr(ddns_cb->address),
@@ -890,133 +906,138 @@ update_lease_failed(struct lease *lease,
void
safe_lease_update(struct lease *lease,
- struct iasubopt *lease6,
dhcp_ddns_cb_t *oldcb,
dhcp_ddns_cb_t *newcb,
const char *file, int line)
{
- char addrbuf[MAX_ADDRESS_STRING_LEN];
+ if (lease == NULL) {
+ /* should never get here */
+ log_fatal("Impossible condition at %s:%d (called from %s:%d).",
+ MDL, file, line);
+ }
- if (lease != NULL) {
- if ( (lease->ddns_cb == NULL) && (newcb == NULL) ) {
- /*
- * Trying to clean up pointer that is already null. We
- * are most likely trying to update wrong lease here.
- */
+ if ( (lease->ddns_cb == NULL) && (newcb == NULL) ) {
+ /*
+ * Trying to clean up pointer that is already null. We
+ * are most likely trying to update wrong lease here.
+ */
- /*
- * this error message pops out during every DNS Update
- * for fixed leases. It is enabled only for debugging
- * DNS Updates. Investigation pending.
- */
-#if defined (DEBUG_DNS_UPDATES)
- log_error("%s(%d): Invalid lease update. Tried to "
- "clear already NULL DDNS control block "
- "pointer for lease %s.",
- file, line, piaddr(lease->ip_addr) );
-#endif
+ /*
+ * Previously this error message popped out during
+ * DNS update for fixed leases. As we no longer
+ * try to update the lease for a fixed (static) lease
+ * this should not be a problem.
+ */
+ log_error("%s(%d): Invalid lease update. Tried to "
+ "clear already NULL DDNS control block "
+ "pointer for lease %s.",
+ file, line, piaddr(lease->ip_addr) );
#if defined (DNS_UPDATES_MEMORY_CHECKS)
- update_lease_failed(lease, NULL, oldcb, newcb, file,
- line);
+ update_lease_failed(lease, NULL, oldcb, newcb, file, line);
#endif
- /*
- * May not reach this: update_lease_failed calls
- * log_fatal.
- */
- return;
- }
+ /*
+ * May not reach this: update_lease_failed calls
+ * log_fatal.
+ */
+ return;
+ }
- if ( (lease->ddns_cb != NULL) && (lease->ddns_cb != oldcb) ) {
- /*
- * There is existing cb structure, but it differs from
- * what we expected to see there. Most likely we are
- * trying to update wrong lease.
- */
- log_error("%s(%d): Failed to update internal lease "
- "structure with DDNS control block. Existing"
- " ddns_cb structure does not match "
- "expectations.IPv4=%s, old ddns_cb=%p, tried"
- "to update to new ddns_cb=%p", file, line,
- piaddr(lease->ip_addr), oldcb, newcb);
+ if ( (lease->ddns_cb != NULL) && (lease->ddns_cb != oldcb) ) {
+ /*
+ * There is existing cb structure, but it differs from
+ * what we expected to see there. Most likely we are
+ * trying to update wrong lease.
+ */
+ log_error("%s(%d): Failed to update internal lease "
+ "structure with DDNS control block. Existing"
+ " ddns_cb structure does not match "
+ "expectations.IPv4=%s, old ddns_cb=%p, tried"
+ "to update to new ddns_cb=%p", file, line,
+ piaddr(lease->ip_addr), oldcb, newcb);
#if defined (DNS_UPDATES_MEMORY_CHECKS)
- update_lease_failed(lease, NULL, oldcb, newcb, file,
- line);
+ update_lease_failed(lease, NULL, oldcb, newcb, file, line);
#endif
- /*
- * May not reach this: update_lease_failed calls
- * log_fatal.
- */
- return;
- }
- /* additional IPv4 specific checks may be added here */
+ /*
+ * May not reach this: update_lease_failed calls
+ * log_fatal.
+ */
+ return;
+ }
- /* update the lease */
- lease->ddns_cb = newcb;
- } else if (lease6 != NULL) {
- if ( (lease6->ddns_cb == NULL) && (newcb == NULL) ) {
- inet_ntop(AF_INET6, &lease6->addr, addrbuf,
- MAX_ADDRESS_STRING_LEN);
- /*
- * Trying to clean up pointer that is already null. We
- * are most likely trying to update wrong lease here.
- */
-#if defined (DEBUG_DNS_UPDATES)
- log_error("%s(%d): Failed to update internal lease "
- "structure. Tried to clear already NULL "
- "DDNS control block pointer for lease %s.",
- file, line, addrbuf);
-#endif
+ /* additional IPv4 specific checks may be added here */
+
+ /* update the lease */
+ lease->ddns_cb = newcb;
+}
+
+void
+safe_lease6_update(struct iasubopt *lease6,
+ dhcp_ddns_cb_t *oldcb,
+ dhcp_ddns_cb_t *newcb,
+ const char *file, int line)
+{
+ char addrbuf[MAX_ADDRESS_STRING_LEN];
+
+ if (lease6 == NULL) {
+ /* should never get here */
+ log_fatal("Impossible condition at %s:%d (called from %s:%d).",
+ MDL, file, line);
+ }
+
+ if ( (lease6->ddns_cb == NULL) && (newcb == NULL) ) {
+ inet_ntop(AF_INET6, &lease6->addr, addrbuf,
+ MAX_ADDRESS_STRING_LEN);
+ /*
+ * Trying to clean up pointer that is already null. We
+ * are most likely trying to update wrong lease here.
+ */
+ log_error("%s(%d): Failed to update internal lease "
+ "structure. Tried to clear already NULL "
+ "DDNS control block pointer for lease %s.",
+ file, line, addrbuf);
#if defined (DNS_UPDATES_MEMORY_CHECKS)
- update_lease_failed(NULL, lease6, oldcb, newcb, file,
- line);
+ update_lease_failed(NULL, lease6, oldcb, newcb, file, line);
#endif
- /*
- * May not reach this: update_lease_failed calls
- * log_fatal.
- */
- return;
- }
+ /*
+ * May not reach this: update_lease_failed calls
+ * log_fatal.
+ */
+ return;
+ }
- if ( (lease6->ddns_cb != NULL) && (lease6->ddns_cb != oldcb) ) {
- /*
- * there is existing cb structure, but it differs from
- * what we expected to see there. Most likely we are
- * trying to update wrong lease.
- */
- inet_ntop(AF_INET6, &lease6->addr, addrbuf,
- MAX_ADDRESS_STRING_LEN);
+ if ( (lease6->ddns_cb != NULL) && (lease6->ddns_cb != oldcb) ) {
+ /*
+ * there is existing cb structure, but it differs from
+ * what we expected to see there. Most likely we are
+ * trying to update wrong lease.
+ */
+ inet_ntop(AF_INET6, &lease6->addr, addrbuf,
+ MAX_ADDRESS_STRING_LEN);
- log_error("%s(%d): Failed to update internal lease "
- "structure with DDNS control block. Existing"
- " ddns_cb structure does not match "
- "expectations.IPv6=%s, old ddns_cb=%p, tried"
- "to update to new ddns_cb=%p", file, line,
- addrbuf, oldcb, newcb);
+ log_error("%s(%d): Failed to update internal lease "
+ "structure with DDNS control block. Existing"
+ " ddns_cb structure does not match "
+ "expectations.IPv6=%s, old ddns_cb=%p, tried"
+ "to update to new ddns_cb=%p", file, line,
+ addrbuf, oldcb, newcb);
#if defined (DNS_UPDATES_MEMORY_CHECKS)
- update_lease_failed(NULL, lease6, oldcb, newcb, file,
- line);
+ update_lease_failed(NULL, lease6, oldcb, newcb, file, line);
#endif
- /*
- * May not reach this: update_lease_failed calls
- * log_fatal.
- */
- return;
- }
- /* additional IPv6 specific checks may be added here */
-
- /* update the lease */
- lease6->ddns_cb = newcb;
-
- } else {
- /* should never get here */
- log_fatal("Impossible condition at %s:%d (called from %s:%d).",
- MDL, file, line);
+ /*
+ * May not reach this: update_lease_failed calls
+ * log_fatal.
+ */
+ return;
}
+ /* additional IPv6 specific checks may be added here */
+
+ /* update the lease */
+ lease6->ddns_cb = newcb;
}
/*
@@ -1042,7 +1063,7 @@ ddns_update_lease_ptr(struct lease *lease,
const char * file, int line)
{
char ddns_address[MAX_ADDRESS_STRING_LEN];
- sprintf(ddns_address, "uknown");
+ sprintf(ddns_address, "unknown");
if (ddns_cb) {
strncpy(ddns_address, piaddr(ddns_cb->address),
MAX_ADDRESS_STRING_LEN);
@@ -1052,14 +1073,23 @@ ddns_update_lease_ptr(struct lease *lease,
file, line, ddns_cb, ddns_address );
#endif
+ /*
+ * If the lease was static (for a fixed address)
+ * we don't need to do any work.
+ */
+ if (ddns_cb->flags & DDNS_STATIC_LEASE) {
+#if defined (DEBUG_DNS_UPDATES)
+ log_info("lease is static, returning");
+#endif
+ return (ISC_R_SUCCESS);
+ }
+
if (lease != NULL) {
- safe_lease_update(lease, NULL, ddns_cb, ddns_cb_set,
+ safe_lease_update(lease, ddns_cb, ddns_cb_set,
file, line);
- /* lease->ddns_cb = ddns_cb_set; */
} else if (lease6 != NULL) {
- safe_lease_update(NULL, lease6, ddns_cb, ddns_cb_set,
+ safe_lease6_update(lease6, ddns_cb, ddns_cb_set,
file, line);
- /* lease6->ddns_cb = ddns_cb_set; */
} else if (ddns_cb->address.len == 4) {
struct lease *find_lease = NULL;
if (find_lease_by_ip_addr(&find_lease,
@@ -1070,17 +1100,14 @@ ddns_update_lease_ptr(struct lease *lease,
find_lease);
#endif
- /* find_lease->ddns_cb = ddns_cb_set; */
- safe_lease_update(find_lease, NULL, ddns_cb,
+ safe_lease_update(find_lease, ddns_cb,
ddns_cb_set, file, line);
lease_dereference(&find_lease, MDL);
}
else {
-#if defined (DEBUG_DNS_UPDATES)
log_error("%s(%d): ddns_update_lease_ptr failed. "
- "Lease for %s not found. (Is it static lease?)",
+ "Lease for %s not found.",
file, line, piaddr(ddns_cb->address));
-#endif
#if defined (DNS_UPDATES_MEMORY_CHECKS)
update_lease_failed(NULL, NULL, ddns_cb, ddns_cb_set,
@@ -1119,7 +1146,7 @@ ddns_update_lease_ptr(struct lease *lease,
return(ISC_R_FAILURE);
}
- if (iasubopt_hash_lookup(&find_lease6, pool->leases,
+ if (iasubopt_hash_lookup(&find_lease6, pool->leases,
&addr, 16, MDL)) {
find_lease6->ddns_cb = ddns_cb_set;
iasubopt_dereference(&find_lease6, MDL);
@@ -1591,18 +1618,24 @@ ddns_removals(struct lease *lease,
} else if ((lease6 != NULL) && (lease6->ddns_cb != NULL)) {
ddns_cancel(lease6->ddns_cb);
lease6->ddns_cb = NULL;
- } else
- goto cleanup;
+ }
/* allocate our control block */
ddns_cb = ddns_cb_alloc(MDL);
if (ddns_cb == NULL) {
goto cleanup;
}
-
+
+ /*
+ * For v4 we flag static leases so we don't try
+ * and manipulate the lease later. For v6 we don't
+ * get static leases and don't need to flag them.
+ */
if (lease != NULL) {
scope = &(lease->scope);
ddns_cb->address = lease->ip_addr;
+ if (lease->flags & STATIC_LEASE)
+ ddns_cb->flags |= DDNS_STATIC_LEASE;
} else if (lease6 != NULL) {
scope = &(lease6->scope);
memcpy(&ddns_cb->address.iabuf, lease6->addr.s6_addr, 16);
@@ -1618,7 +1651,7 @@ ddns_removals(struct lease *lease,
goto cleanup;
/* Assume that we are removing both records */
- ddns_cb->flags = DDNS_UPDATE_ADDR | DDNS_UPDATE_PTR;
+ ddns_cb->flags |= DDNS_UPDATE_ADDR | DDNS_UPDATE_PTR;
/* and that we want to do the add call */
execute_add = ISC_R_SUCCESS;
diff --git a/server/dhcpd.conf.5 b/server/dhcpd.conf.5
index b6dc9f6..2da8d9e 100644
--- a/server/dhcpd.conf.5
+++ b/server/dhcpd.conf.5
@@ -27,7 +27,7 @@
.\" Support and other services are available for ISC products - see
.\" https://www.isc.org for more information or to learn more about ISC.
.\"
-.\" $Id: dhcpd.conf.5,v 1.106.18.6 2011-06-01 23:30:53 sar Exp $
+.\" $Id: dhcpd.conf.5,v 1.106.18.7 2011-09-21 20:43:10 sar Exp $
.\"
.TH dhcpd.conf 5
.SH NAME
@@ -1357,7 +1357,14 @@ zone 17.127.10.in-addr.arpa. {
.fi
.PP
The \fIprimary\fR statement specifies the IP address of the name
-server whose zone information is to be updated.
+server whose zone information is to be updated. In addition to
+the \fIprimary\fR statement there are also the \fIprimary6\fR ,
+\fIsecondary\fR and \fIsecondary6\fR statements. The \fIprimary6\fR
+statement specifies an IPv6 address for the name server. The
+secondaries provide for additional addresses for name servers
+to be used if the primary does not respond. The number of name
+servers the DDNS code will attempt to use before giving up
+is limited and is currently set to three.
.PP
Note that the zone declarations have to correspond to authority
records in your name server - in the above example, there must be an
diff --git a/server/dhcpd.leases.5 b/server/dhcpd.leases.5
index ba584b1..200556d 100644
--- a/server/dhcpd.leases.5
+++ b/server/dhcpd.leases.5
@@ -28,7 +28,7 @@
.\" see ``http://www.vix.com''. To learn more about Nominum, Inc., see
.\" ``http://www.nominum.com''.
.\"
-.\" $Id: dhcpd.leases.5,v 1.14.24.2 2011-04-22 13:30:14 tomasz Exp $
+.\" $Id: dhcpd.leases.5,v 1.14.24.3 2011-09-19 00:24:22 sar Exp $
.\"
.TH dhcpd.leases 5
.SH NAME
@@ -277,7 +277,9 @@ possible: \fBunknown-state\fR, \fBpartner-down\fR, \fBnormal\fR,
\fBcommunications-interrupted\fR, \fBresolution-interrupted\fR,
\fBpotential-conflict\fR, \fBrecover\fR, \fBrecover-done\fR,
\fBshutdown\fR, \fBpaused\fR, and \fBstartup\fR.
-.B DBDIR/dhcpd.leases
+.RE
+.SH FILES
+.B DBDIR/dhcpd.leases DBDIR/dhcpd.leases~
.SH SEE ALSO
dhcpd(8), dhcp-options(5), dhcp-eval(5), dhcpd.conf(5), RFC2132, RFC2131.
.SH AUTHOR
diff --git a/server/stables.c b/server/stables.c
index 8294527..7ac5994 100644
--- a/server/stables.c
+++ b/server/stables.c
@@ -3,7 +3,7 @@
Tables of information only used by server... */
/*
- * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any