From owner-freebsd-bugs Wed Aug 7 21:20:14 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BBFB337B400 for ; Wed, 7 Aug 2002 21:20:03 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 12EFD43E6A for ; Wed, 7 Aug 2002 21:20:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g784K1JU035589 for ; Wed, 7 Aug 2002 21:20:01 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g784K1RO035588; Wed, 7 Aug 2002 21:20:01 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3EB7037B400 for ; 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 ; 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 ; 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 Reply-To: Bill Fenner To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/41435: dhclient writes lease file that it can't read back Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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