]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Move warning about dhcp-renewal-time to config parsing rather
authorShane Kerr <shane@isc.org>
Mon, 14 Jan 2008 14:26:10 +0000 (14:26 +0000)
committerShane Kerr <shane@isc.org>
Mon, 14 Jan 2008 14:26:10 +0000 (14:26 +0000)
than runtime.
See RT ticket #17382 for more.

RELNOTES
server/confpars.c
server/dhcp.c

index ae3bd6539b5e551ded2bf591ff87676d5ba51ddb..3f4225d1f34316c9cd2a8085bc0cb511d34bbb10 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -112,6 +112,12 @@ suggested fixes to <dhcp-users@isc.org>.
 
 - Fixes to allow code to compile on Mac OS X Leopard (10.5).
 
+- When server is configured with options that it overrides, a warning is
+  issued when the configuration file is read, rather than at the time the
+  option is overridden. This was important, because the warning was given
+  every time the option was overridden, which could create a lot of 
+  unnecessary logging.
+
                        Changes since 4.0.0b3
 
 - The reverse dns name for PTR updates on IPv6 addresses has been fixed to
index 7a0a3d21e0b084969ce13d9bde87274c9a20b4db..21322ef852e1e0ad75b625be9061c7426080d287 100644 (file)
@@ -687,6 +687,26 @@ int parse_statement (cfile, group, type, host_decl, declaration)
                                return declaration;
                        }
 
+                       /*
+                        * If the configuration attempts to define on option
+                        * that we ignore, then warn about it now.
+                        *
+                        * In DHCPv4 we do not use dhcp-renewal-time or
+                        * dhcp-rebinding-time, but we use these in DHCPv6.
+                        *
+                        * XXX: We may want to include a "blacklist" of 
+                        *      options we ignore in the future, as a table.
+                        */
+                       if ((option->code == DHO_DHCP_LEASE_TIME) ||
+                           ((local_family != AF_INET6) && 
+                            ((option->code == DHO_DHCP_RENEWAL_TIME) ||
+                             (option->code == DHO_DHCP_REBINDING_TIME))))
+                       {
+                               log_error("WARNING: server ignoring option %s "
+                                         "in configuration file.",
+                                          option->name);
+                       }
+
                      finish_option:
                        et = (struct executable_statement *)0;
                        if (!parse_option_statement
index 3b8d2cb4435bf59d5a323a209e9426dbc657d1c0..3050c8fa4282701d2e343fa02242b19470361b48 100644 (file)
@@ -2522,9 +2522,6 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
 
                putULong(state->expiry, (u_int32_t)offered_lease_time);
                i = DHO_DHCP_LEASE_TIME;
-               if (lookup_option (&dhcp_universe, state -> options, i))
-                       log_error ("dhcp-lease-time option for %s overridden.",
-                             inet_ntoa (state -> ciaddr));
                oc = (struct option_cache *)0;
                if (option_cache_allocate (&oc, MDL)) {
                        if (make_const_data(&oc->expression, state->expiry,
@@ -2542,9 +2539,6 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
                offered_lease_time /= 2;
                putULong(state->renewal, (u_int32_t)offered_lease_time);
                i = DHO_DHCP_RENEWAL_TIME;
-               if (lookup_option (&dhcp_universe, state -> options, i))
-                       log_error ("overriding dhcp-renewal-time for %s.",
-                                  inet_ntoa (state -> ciaddr));
                oc = (struct option_cache *)0;
                if (option_cache_allocate (&oc, MDL)) {
                        if (make_const_data(&oc->expression, state->renewal,
@@ -2563,9 +2557,6 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
                                       + offered_lease_time / 4);
                putULong(state->rebind, (u_int32_t)offered_lease_time);
                i = DHO_DHCP_REBINDING_TIME;
-               if (lookup_option (&dhcp_universe, state -> options, i))
-                       log_error ("overriding dhcp-rebinding-time for %s.",
-                             inet_ntoa (state -> ciaddr));
                oc = (struct option_cache *)0;
                if (option_cache_allocate (&oc, MDL)) {
                        if (make_const_data(&oc->expression, state->rebind,