Subject: Re: dhclient crash
To: None <smb@research.att.com>
From: Havard Eidnes <he@netbsd.org>
List: netbsd-users
Date: 05/01/2003 19:08:05
----Next_Part(Thu_May__1_19:08:05_2003_971)--
Content-Type: Text/Plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

> The daily job found a dhclient core file in / -- gdb says =

>
>     Program terminated with signal 8, Floating point exception.
>     #0  0x80494fa in ?? ()
>     (gdb) bt
>     #0  0x80494fa in ?? ()
>     #1  0x8049b1b in ?? ()
>     #2  0x805df72 in ?? ()
>     #3  0x8050a5c in ?? ()
>     #4  0x807a946 in ?? ()
>     #5  0x804e7b4 in ?? ()
>     #6  0x8048f27 in ?? ()
>     #7  0x804825c in ?? ()
>
> Has anyone else seen anything like that?  (My dhclient is slightly =

> modified, to deal with the buggy dhcp server that I've encountered in=
 =

> some Marriott hotels, but I don't think that that code was exercised =

> here.)
>
> If folks are interested, I could rebuild dhclient not stripped, to ge=
t =

> a better traceback.  This is on a 1.6.1 system that I built from sour=
ce.

You could try the attached diff -- it fixes a "divide by zero" problem
in my dhclient.  I'm not sure what the server was, but the problem was
that client->new->renvewal turned out to be 0.

Regards,

- H=E5vard

----Next_Part(Thu_May__1_19:08:05_2003_971)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Index: dhclient.c
===================================================================
RCS file: /cvsroot/src/dist/dhcp/client/dhclient.c,v
retrieving revision 1.4
diff -u -r1.4 dhclient.c
--- dhclient.c	2002/04/03 03:32:50	1.4
+++ dhclient.c	2003/05/01 17:03:54
@@ -790,9 +790,11 @@
 			client -> new -> expiry / 2;
 
 	/* Now introduce some randomness to the renewal time: */
+	i = (client -> new -> renewal + 3) / 4;
+	if (i < 1) i = 1;
+
 	client -> new -> renewal = (((client -> new -> renewal + 3) * 3 / 4) +
-				    (random () % /* XXX NUMS */
-				     ((client -> new -> renewal + 3) / 4)));
+				    (random () % /* XXX NUMS */ i));
 
 	/* Same deal with the rebind time. */
 	oc = lookup_option (&dhcp_universe, client -> new -> options,

----Next_Part(Thu_May__1_19:08:05_2003_971)----