Date: Wed, 7 Aug 2002 21:12:24 -0700 (PDT) From: Bill Fenner <fenner@research.att.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/41435: dhclient writes lease file that it can't read back Message-ID: <200208080412.g784COuA002442@nectar.attlabs.att.com>
next in thread | raw e-mail | index | archive | help
>Number: 41435
>Category: bin
>Synopsis: dhclient writes lease file that it can't read back
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Aug 07 21:20:01 PDT 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208080412.g784COuA002442>
