ping-timeout patch

Stephens, Bill {PBSG} Bill.Stephens at pbsg.com
Tue Feb 4 12:54:46 UTC 2003


Oops I saw the attachment was stripped.  Here are the contents:

---- Begin patch attachment ----

--- dhcp-3.0.1rc11/server/stables.c	Tue Jan 14 17:20:35 2003
+++ dhcp-3.0.1rc11/server/stables.c.new	Fri Jan 31 12:39:37 2003
@@ -491,7 +491,7 @@
 	{ "update-static-leases", "f",			&server_universe, 43
},
 	{ "log-facility", "Nsyslog-facilities.",	&server_universe, 44
},
 	{ "do-forward-updates", "f",			&server_universe, 45
},
-	{ "unknown-46", "X",				&server_universe, 46
},
+	{ "ping-timeout", "T",				&server_universe, 46
},
 	{ "unknown-47", "X",				&server_universe, 47
},
 	{ "unknown-48", "X",				&server_universe, 48
},
 	{ "unknown-49", "X",				&server_universe, 49
},


--- dhcp-3.0.1rc11/includes/dhcpd.h	Sun Aug 25 23:07:41 2002
+++ dhcp-3.0.1rc11/includes/dhcpd.h.new	Mon Feb  3 10:41:35 2003
@@ -420,6 +420,11 @@
 #define SV_UPDATE_STATIC_LEASES		43
 #define SV_LOG_FACILITY			44
 #define SV_DO_FORWARD_UPDATES		45
+#define SV_PING_TIMEOUT         46
+
+#if !defined (DEFAULT_PING_TIMEOUT)
+# define DEFAULT_PING_TIMEOUT 1
+#endif
 
 #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
 # define DEFAULT_DEFAULT_LEASE_TIME 43200
 

--- dhcp-3.0.1rc11/server/dhcp.c	Sat Nov 16 20:29:30 2002
+++ dhcp-3.0.1rc11/server/dhcp.c.new	Mon Feb  3 11:05:05 2003
@@ -1472,6 +1472,7 @@
 	int status;
 	isc_result_t result;
 	int did_ping = 0;
+        TIME ping_timeout;
 
 	unsigned i, j;
 	int s1, s2;
@@ -2617,8 +2618,38 @@
 					    state -> options,
 					    &lease -> scope, oc, MDL))) {
 		lease -> timestamp = cur_time;
-		icmp_echorequest (&lease -> ip_addr);
-		add_timeout (cur_time + 1, lease_ping_timeout, lease,
+		icmp_echorequest (&lease-> ip_addr);
+                
+
/***************************************************************************
*****
+                 * This code checks for a new server configuration
parameter called ping-timeout *
+                 * If there is a value coded in ping-timeout, use it,
otherwise set it to        *
+                 * the default of 1 second.  In a large environment with
routers and slow links, *
+                 * The previously hard coded value of 1 second is often
times too short.  The    *
+                 * result is sometimes DHCP hands out an IP address before
a positive response   *
+                 * is received, which means there is a real potential for
duplicate addresses.   *
+                 * You could keep re-compiling the code with longer
timeouts, but this makes     *
+                 * life easier for the administrator.  -Bill Stephens
bill at stephens-family.com   *
+
****************************************************************************
****/
+                
+                if ((oc = lookup_option (&server_universe, state ->
options,
+					 SV_PING_TIMEOUT))) {
+			if (evaluate_option_cache (&d1, packet, lease,
+						   (struct client_state *)0,
+						   packet -> options,
+						   state -> options,
+						   &lease -> scope, oc,
MDL)) {
+				if (d1.len == sizeof (u_int32_t))
+					ping_timeout =
+						getULong (d1.data);
+				data_string_forget (&d1, MDL);
+			}
+		} else {
+                 ping_timeout = DEFAULT_PING_TIMEOUT;
+                }
+                
+                log_debug ("Ping Timeout: %d", ping_timeout);
+
+		add_timeout (cur_time + ping_timeout, lease_ping_timeout,
lease,
 			     (tvref_t)lease_reference,
 			     (tvunref_t)lease_dereference);
 		++outstanding_pings;

--- dhcp-3.0.1rc11/server/dhcpd.conf.5	Sat Nov 16 20:29:31 2002
+++ dhcp-3.0.1rc11/server/dhcpd.conf.5.new	Mon Feb  3 11:36:32 2003
@@ -2127,10 +2127,29 @@
 response \fIis\fR heard, the lease is abandoned, and the server does
 not respond to the client.
 .PP
-This \fIping check\fR introduces a one-second delay in responding to
-DHCPDISCOVER messages, which can be a problem for some clients.   The
-ping-check configuration parameter can be used to control checking -
-if its value is false, no ping check is done.
+This \fIping check\fR introduces a default one-second delay in responding 
+to DHCPDISCOVER messages, which can be a problem for some clients.   The 
+default delay of one-second may be configured using the ping-timeout
+parameter.  The ping-check configuration parameter can be used to control 
+checking - if its value is false, no ping check is done.
+.RE
+.PP
+The
+.I ping-timeout
+statement
+.RS 0.25i
+.PP
+.B ping-timeout
+.I seconds\fR\fB;\fR
+.PP
+If the DHCP server determined it shoud send an ICMP echo request (a
\fIping\fR)
+because the ping-check statement is true, ping-timeout allows you 
+to configure how many seconds the DHCP server should wait for an
+ICMP Echo response to be heard, if no ICMP Echo response has been
+received before the timeout expires, it assigns the address.   If a
+response \fIis\fR heard, the lease is abandoned, and the server does
+not respond to the client.  If no value is set, ping-timeout defaults
+to 1 second.
 .RE
 .PP
 The
----- End Patch ----


 
 

Bill Stephens
PepsiCo Business Solutions Group
Bill.Stephens at pbsg.com
972.376.7155      fax: 972.376.6019
 
 

-----Original Message-----
From: Stephens, Bill {PBSG} 
Sent: Monday, February 03, 2003 2:35 PM
To: 'dhcp-hackers at isc.org'
Subject: ping-timeout patch

I'd like to submit a patch for dhcp-3.0.1 to add a dhcpd.conf configuration
parameter called ping-timeout.  

1. What does it do?

This new ping-timeout parameter allows the dhcp administrator to easily
configure how long to have dhcp wait for a ping response before handing out
a lease.  I'm a simpleton, so the patch is fairly straightforward; I even
included the documentation update.

2. How much of a risk to stability does it present?

It's a low risk patch, it just allows the administrator to configure how
long to wait for the ping response.  If no value is set, it defaults to 1
second so that the server will react the same as before the parameter was
available.

3. Is it nicely or badly implemented?

I tried to do the best job, following existing code samples.  It doesn't do
anything fancy, so IMHO it's a fairly clean patch.

4. Does the change apply without anyone needing to hand-edit it?

I am able to apply it against 3.0.1rc11.

5. Is it The Right Thing To Do?

Absolutely.  A one second delay is too short for us.  I am implementing the
ISC DHCP server to support over 600 remote locations, sometimes over slow
56k links.  Periodically I receive problem calls from our help desk that
there are duplicate IP addresses being reported by clients.  Recompiling the
code every time I want to try a longer timeout is unnecessarily cumbersome.
The new parameter makes an administrators life much easier, change the
parameter restart the server and off you go.

6. Is it important?

It is to me, I receive fewer helpdesk calls because I can easily change how
long to wait for the ping to timeout.  The longer ping-timeout has decreased
the number of duplicate IP address problem tickets I receive.

Not one of yours, but I thought I'd throw it in: 
7.  Is it a high priority?

No, not really, it just makes the administrator's job easier by not having
to re-compile every time they want to change the delay.  Hey I'm lazy, with
over 600 subnets to manage anything I can do to make my life easier, I'm all
for.
 
 

Bill Stephens
PepsiCo Business Solutions Group
Bill.Stephens at pbsg.com
972.376.7155      fax: 972.376.6019
 




-- Binary/unsupported file stripped by Ecartis --
-- Type: application/octet-stream
-- File: dhcp-pingtimeout.patch




More information about the dhcp-hackers mailing list