From fenner@research.att.com  Wed Aug  7 21:12:31 2002
Return-Path: <fenner@research.att.com>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3EB7037B400
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  7 Aug 2002 21:12:31 -0700 (PDT)
Received: from nectar.attlabs.att.com (v2-adsl-diesel-sc.digisle.com [206.220.227.230])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0ADCA43E4A
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  7 Aug 2002 21:12:30 -0700 (PDT)
	(envelope-from fenner@research.att.com)
Received: from nectar.attlabs.att.com (localhost [127.0.0.1])
	by nectar.attlabs.att.com (8.12.3/8.11.6) with ESMTP id g784CPed002443
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 7 Aug 2002 21:12:26 -0700 (PDT)
	(envelope-from fenner@nectar.attlabs.att.com)
Received: (from fenner@localhost)
	by nectar.attlabs.att.com (8.12.3/8.12.3/Submit) id g784COuA002442;
	Wed, 7 Aug 2002 21:12:24 -0700 (PDT)
Message-Id: <200208080412.g784COuA002442@nectar.attlabs.att.com>
Date: Wed, 7 Aug 2002 21:12:24 -0700 (PDT)
From: Bill Fenner <fenner@research.att.com>
Reply-To: Bill Fenner <fenner@research.att.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: dhclient writes lease file that it can't read back
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         41435
>Category:       bin
>Synopsis:       dhclient writes lease file that it can't read back
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    brooks
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 07 21:20:01 PDT 2002
>Closed-Date:    Thu Nov 03 00:04:46 GMT 2005
>Last-Modified:  Thu Nov 03 00:04:46 GMT 2005
>Originator:     Bill Fenner
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
AT&T Labs - Research
>Environment:
System: FreeBSD nectar.attlabs.att.com 4.6-STABLE FreeBSD 4.6-STABLE #0: Sat Jun 22 11:58:01 PDT 2002 root@nectar.attlabs.att.com:/usr/obj/usr/src/sys/GENERIC i386


nectar% dhclient -v
Internet Software Consortium DHCP Client V3.0.1rc8

	
>Description:
	
When dhclient receives certain un-parsed options from the DHCP
server, it writes out a /var/db/dhclient.leases file that it can
then not read back in.  A sample buggy lease:

lease {
  interface "wi0";
  fixed-address 172.24.1.249;
  option subnet-mask 255.255.255.224;
  option dhcp-lease-time 14400;
  option routers 172.24.1.225;
  option #176 "MCIPADD=172.16.255.5MCPORT=1719TFTPSRVR=192.168.226.28";
  option dhcp-message-type 5;
  option domain-name-servers 192.168.153.80,192.168.226.169;
  option dhcp-server-identifier 192.168.153.80;
  option netbios-name-servers 192.168.153.75,192.168.153.33;
  option domain-name "example.com";
  option netbios-node-type 8;
  renew 4 2002/8/8 05:52:07;
  rebind 4 2002/8/8 07:32:13;
  expire 4 2002/8/8 08:02:13;
}

Note that the "#" in "option #176" is interpreted as a comment,
causing the rest of the line to be ignored and the line to be
interpreted as "option option dhcp-message-type 5;".  This causes
errors like:

Aug  7 21:01:35 nectar dhclient: /var/db/dhclient.leases line 38: no option named option
Aug  7 21:01:35 nectar dhclient:   option dhcp-message-type 
Aug  7 21:01:35 nectar dhclient:   ^


>How-To-Repeat:
	
Run dhclient in an environment that supplies an option like this one
that dhclient doesn't have a name for.  Examine /var/db/dhclient.leases .
Kill dhclient and run it again.  Observe error message.

>Fix:

	

A fairly lame workaround (it at least allows the dhclient.leases file
to be read in again successfully on the next instantiation):

cvs diff: Diffing .
Index: dhclient.c
===================================================================
RCS file: /home/ncvs/src/contrib/isc-dhcp/client/dhclient.c,v
retrieving revision 1.9.2.6
diff -u -r1.9.2.6 dhclient.c
--- dhclient.c	11 Apr 2002 10:16:45 -0000	1.9.2.6
+++ dhclient.c	8 Aug 2002 03:58:10 -0000
@@ -2175,6 +2175,8 @@
 	}
 	if (evaluate_option_cache (&ds, packet, lease, client_state,
 				   in_options, cfg_options, scope, oc, MDL)) {
+		if (*oc->option->name == '#')
+			fprintf(leaseFile, "# can't represent following option properly\n# ");
 		fprintf (leaseFile,
 			 "  option %s%s%s %s;\n",
 			 name, dot, oc -> option -> name,


Possible proper fix: save unknown options to the lease file in the
supported unknown option format, e.g.

  option unknown176 code 176 = string ;
  option unknown176 "MCIPADD=172.16.255.5MCPORT=1719TFTPSRVR=192.168.226.28";
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->murray 
Responsible-Changed-By: johan 
Responsible-Changed-When: Fri Aug 23 09:19:16 PDT 2002 
Responsible-Changed-Why:  
Over to DHCP maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41435 
Responsible-Changed-From-To: murray->mbr 
Responsible-Changed-By: mbr 
Responsible-Changed-When: Mon Feb 10 01:52:08 PST 2003 
Responsible-Changed-Why:  
Take this PR 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41435 

From: Bill Fenner <fenner@research.att.com>
To: freebsd-gnats-submit@FreeBSD.org, fenner@research.att.com
Cc:  
Subject: Re: bin/41435: dhclient writes lease file that it can't read back
Date: Fri, 14 Feb 2003 10:15:00 -0800

 The release notes for 3.0.1rc11 seem to imply that this bug is fixed, so 
 an MFC of 3.0.1rc11 to 4.8 would be peachy.
 
Responsible-Changed-From-To: mbr->brooks 
Responsible-Changed-By: rodrigc 
Responsible-Changed-When: Wed Aug 31 01:24:15 GMT 2005 
Responsible-Changed-Why:  
Brooks, does this PR still happen with latest dhclient? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41435 
State-Changed-From-To: open->closed 
State-Changed-By: brooks 
State-Changed-When: Thu Nov 3 00:03:12 GMT 2005 
State-Changed-Why:  
The OpenBSD dhclient writes unknown options as "option-176" so this isn't 
an issue there.  Additionally, 3.0.1rc11 was MFCd to 4.8 nearly 3 years 
ago. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41435 
>Unformatted:
