Subject: bin/3084: dhcpd crashes when client with existing unknown lease boots
To: None <gnats-bugs@gnats.netbsd.org>
From: Daniel Carosone <dan@geek.com.au>
List: netbsd-bugs
Date: 01/06/1997 22:53:46
>Number:         3084
>Category:       bin
>Synopsis:       dhcpd crashes when client with existing unknown lease boots
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan  6 04:05:00 1997
>Last-Modified:
>Originator:     Daniel Carosone
>Organization:
geek (tm)
>Release:        late Nov 1996
>Environment:
	
System: NetBSD anarres 1.2B NetBSD 1.2B (_anarres_) #36: Sat Nov 30 00:54:57 EST 1996 dan@anarres:/fs/g/s/dan/NetBSD-current/src/sys/arch/i386/compile/_anarres_ i386


>Description:
	I run NT4 on my laptop, and carry it around to different
	networks quite a bit. I finally got around to setting up
	DHCP at home, to save myself a little reconfiguring, and
	it seemed to work fine. However, today I brought the laptop
	home from a network on which it had been given its IP
	address by DHCP, and the lease was still valid. The NT box
	asked for the same IP address again, and dhcpd left a core
	file, it seems because that IP address was not mentioned
	in my config file.
>How-To-Repeat:
	Boot an NT4 box as described above.
>Fix:
	This very-quickly done patch seems to have solved or hidden
	the problem for me. This may well not be the best fix, I
	barely even looked at the code, but it works.


*** confpars.c~	Thu Nov 28 15:11:21 1996
--- confpars.c	Mon Jan  6 22:28:21 1997
***************
*** 957,962 ****
--- 957,964 ----
  		if (!name)
  			return (struct tree *)0;
  		rv = tree_host_lookup (name);
+ 		if (!rv)
+ 			return (struct tree *)0;
  		if (!uniform)
  			rv = tree_limit (rv, 4);
  	} else if (token == NUMBER) {
*** memory.c~	Thu Nov 28 15:12:30 1996
--- memory.c	Mon Jan  6 22:36:04 1997
***************
*** 338,343 ****
--- 338,346 ----
  {
  	struct subnet *rv;
  
+ 	if (!share)
+ 		return (struct subnet *)0;
+ 
  	for (rv = share -> subnets; rv; rv = rv -> next_sibling) {
  		if (addr_eq (subnet_number (addr, rv -> netmask), rv -> net))
  			return rv;
>Audit-Trail:
>Unformatted: