About timeouts

Leandro Rzezak leandror at teletec.com.ar
Fri Feb 6 20:15:44 UTC 2004


In a cable network, you could have 2000 cable modems connected to the same
CMTS. If the cmts goes down and up again, the same happens with all the
cable modems.

So you have 2000 clients (plus their PCs) asking for an IP address, please
let me know what do you think about the following interpretation:

- MODEM "A" asks for an IP
	- DHCP starts processing the LEASE
- MODEM "B" asks for an IP (it's queued)
	- DHCP finishes with modem A and start processing the req for MODEM
B
- MODEM "C" asks for an IP (it's queued)
- MODEM "B" timeouts and request an IP again (goes to the queue)
	- DHCP finishes processing first req of MODEM B, but the packet is
not accepted by modem B since that request timed out. So MODEM B is still
expecting the new lease.
	- DHCP goes with packet from MODEM "C"
- MODEM "B" timeouts again

Is this really happening this way? Or modem B will definitively accept the
first request, no matter it has already sent the second request?

If this is correct, before starting to process every request the server
should check the arrival time and drop the packet if (now - arrival) > modem
timeout.

Is there this kind of timeout calculation? If not, please help me pointing
me where to look in, so we can write a patch.

Thank you,

Leandro 

-----Original Message-----
From: dhcp-hackers-bounce at isc.org [mailto:dhcp-hackers-bounce at isc.org] On
Behalf Of Mark Dominus
Sent: Friday, February 06, 2004 3:49 PM
To: dhcp-hackers at isc.org
Cc: dhcp-bugs at isc.org
Subject: dhcpctl timeout feature


The 'timeout' (asynchronous operation) feature of dhcpctl appears not
to work at all.    The enclosed patch makes it work at least somewhat.

There are two essential changes here.

First, in the dhcpctl_set_callback function, we need to allocate a
properly-initialized dhcpctl_callback object, and not just a buffer of
the right size.  

Second, in the distributed versions of the software, the presence of a
dhcpctl callback would intercept the signal from the OMAPI library,
preventing this signal from reaching other handlers in the same
object.  The patch makes the dhcpctl_callback_signal_handler propagate
the signal to the subobject, whether or not there is a dhcpctl
callback installed.

Comments and questions are welcome.

--- /tmp/T0fCaOKS	Fri Feb  6 13:41:28 2004
+++ dhcpctl/callback.c	Fri Feb  6 13:03:11 2004
@@ -65,8 +65,10 @@
 	omapi_object_t *inner;
 	isc_result_t status;
 
-	callback = dmalloc (sizeof *callback, MDL);
-	if (!callback)
+	/* MJD 20040205 */
+	status = omapi_object_allocate((omapi_object_t **)&callback,
+				       dhcpctl_callback_type, 0, MDL);
+	if (status != ISC_R_SUCCESS || !callback)
 		return ISC_R_NOMEMORY;
 
 	/* Tie the callback object to the innermost object in the chain. */
@@ -119,7 +121,7 @@
 					      const char *name, va_list ap)
 {
 	dhcpctl_callback_object_t *p;
-	isc_result_t waitstatus;
+	isc_result_t waitstatus, result = ISC_R_NOTFOUND;
 
 	if (o -> type != dhcpctl_callback_type)
 		return ISC_R_INVALIDARG;
@@ -126,24 +128,25 @@
 	p = (dhcpctl_callback_object_t *)o;
 
 	/* Not a signal we recognize? */
-	if (strcmp (name, "ready")) {
-		if (p -> inner && p -> inner -> type -> signal_handler)
-			return (*(p -> inner -> type -> signal_handler))
-				(p -> inner, name, ap);
-		return ISC_R_NOTFOUND;
+	if (strcmp (name, "ready") == 0) {
+		if (p -> object -> type == dhcpctl_remote_type) {
+			waitstatus = (((dhcpctl_remote_object_t *)
+				       (p -> object)) -> waitstatus);
+		} else
+			waitstatus = ISC_R_SUCCESS;
+
+		/* Do the callback. */
+		if (p -> callback)
+			(*(p -> callback)) (p -> object, waitstatus, p ->
data);
+		result = ISC_R_SUCCESS;
 	}
 
-	if (p -> object -> type == dhcpctl_remote_type) {
-		waitstatus = (((dhcpctl_remote_object_t *)
-			       (p -> object)) -> waitstatus);
-	} else
-		waitstatus = ISC_R_SUCCESS;
+	/* Now invoke the callback for the sub-object, if there is one. */
+	if (p -> inner && p -> inner -> type -> signal_handler)
+		return (*(p -> inner -> type -> signal_handler))
+			(p -> inner, name, ap);
 
-	/* Do the callback. */
-	if (p -> callback)
-		(*(p -> callback)) (p -> object, waitstatus, p -> data);
-
-	return ISC_R_SUCCESS;
+	return result;
 }
 
 isc_result_t dhcpctl_callback_destroy (omapi_object_t *h,





More information about the dhcp-hackers mailing list