diff options
-rw-r--r-- | RELNOTES | 9 | ||||
-rw-r--r-- | includes/dhcpd.h | 3 | ||||
-rw-r--r-- | includes/site.h | 12 | ||||
-rw-r--r-- | server/ddns.c | 42 | ||||
-rw-r--r-- | server/dhcpd.c | 3 |
5 files changed, 62 insertions, 7 deletions
@@ -66,7 +66,14 @@ work on other platforms. Please report any problems and suggested fixes to - Add some debugging output for use with the DDNS code. [ISC-Bugs #20916] - Fix the trace code to handle timing events better and to truncate a file - before using instead of overwriting it. [ISC-Bugs 20969] + before using instead of overwriting it. [ISC-Bugs #20969] + +- Modify the determination of the default TTL to use for DDNS updates. + The user may still configure the ttl via ddns-ttl. The default for + both v4 and v6 is now 1/2 the (preferred) lease time with a limit. The + previous defaults (1/2 lease time without a limit for v4 and a default + value for v6) may be used by defining USE_OLD_DDNS_TTL in site.h + [ISC-Bugs #21126] Changes since 4.2.0a2 diff --git a/includes/dhcpd.h b/includes/dhcpd.h index 015f22ea..cd7d962e 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h @@ -750,6 +750,9 @@ struct lease_state { #if !defined (DEFAULT_DDNS_TTL) # define DEFAULT_DDNS_TTL 3600 #endif +#if !defined (MAX_DEFAULT_DDNS_TTL) +# define MAX_DEFAULT_DDNS_TTL 3600 +#endif /* Client option names */ diff --git a/includes/site.h b/includes/site.h index 2238fe7a..91a5d98f 100644 --- a/includes/site.h +++ b/includes/site.h @@ -200,3 +200,15 @@ traces. */ /* #define TRACING */ + +/* Define this if you want the server to use the previous behavior + when determining the DDNS TTL. If the user has specified a ddns-ttl + option that is used to detemine the ttl. (If the user specifies + an option that references the lease structure it is only usable + for v4. In that case v6 will use the default.) Otherwise when + defined the defaults are: v4 - 1/2 the lease time, + v6 - DEFAULT_DDNS_TTL. When undefined the defaults are 1/2 the + (preferred) lease time for both but with a cap on the maximum. */ + +/* #define USE_OLD_DDNS_TTL */ + diff --git a/server/ddns.c b/server/ddns.c index b196147e..10a2c03c 100644 --- a/server/ddns.c +++ b/server/ddns.c @@ -3,7 +3,9 @@ Dynamic DNS updates. */ /* - * Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC") + * + * Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2000-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -328,18 +330,50 @@ ddns_updates(struct packet *packet, struct lease *lease, struct lease *old, /* * Compute the RR TTL. + * + * We have two ways of computing the TTL. + * The old behavior was to allow for the customer to set up + * the option or to default things. For v4 this was 1/2 + * of the lease time, for v6 this was DEFAULT_DDNS_TTL. + * The new behavior continues to allow the customer to set + * up an option but the defaults are a little different. + * We now use 1/2 of the (preferred) lease time for both + * v4 and v6 and cap them at a maximum value. + * If the customer chooses to use an experession that references + * part of the lease the v6 value will be the default as there + * isn't a lease available for v6. */ + ddns_ttl = DEFAULT_DDNS_TTL; + if (lease != NULL) { + if (lease->ends <= cur_time) { + ddns_ttl = 0; + } else { + ddns_ttl = (lease->ends - cur_time)/2; + } + } +#ifndef USE_OLD_DDNS_TTL + else if (lease6 != NULL) { + ddns_ttl = lease6->prefer/2; + } + + if (ddns_ttl > MAX_DEFAULT_DDNS_TTL) { + ddns_ttl = MAX_DEFAULT_DDNS_TTL; + } +#endif + if ((oc = lookup_option(&server_universe, options, SV_DDNS_TTL))) { if (evaluate_option_cache(&d1, packet, lease, NULL, - packet->options, options, scope, - oc, MDL)) { + packet->options, options, + scope, oc, MDL)) { if (d1.len == sizeof (u_int32_t)) - ddns_cb->ttl = getULong (d1.data); + ddns_ttl = getULong (d1.data); data_string_forget (&d1, MDL); } } + ddns_cb->ttl = ddns_ttl; + /* * Compute the reverse IP name, starting with the domain name. */ diff --git a/server/dhcpd.c b/server/dhcpd.c index f29e431b..43d9efaa 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c @@ -3,7 +3,7 @@ DHCP Server Daemon. */ /* - * Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -72,7 +72,6 @@ char std_nsupdate [] = " \n\ option server.ddns-hostname = \n\ pick (option fqdn.hostname, option host-name); \n\ option server.ddns-domainname = config-option domain-name; \n\ -option server.ddns-ttl = encode-int(lease-time / 2, 32); \n\ option server.ddns-rev-domainname = \"in-addr.arpa.\";"; /* This is the old-style name service updater that is executed |