Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Apr 1999 11:32:39 -0700 (PDT)
From:      Mark Atkinson <marka@metaip.checkpoint.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/11282: isc-dhcp2 client port incorrectly reports lease time
Message-ID:  <Pine.BSF.4.10.9904221131090.1668-100000@moby.dev.metainfo.com>

next in thread | raw e-mail | index | archive | help

>Number:         11282
>Category:       ports
>Synopsis:       isc-dhcp2 client port incorrectly reports lease time
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 22 11:40:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Mark Atkinson
>Release:        FreeBSD 3.0-19981226-SNAP i386
>Organization:
Checkpoint Technologies
>Environment:
	FreeBSD 3.0-19981226-SNAP #0: Thu Feb 18 08:17:12 PST 1999

	gcc --version
	> 2.7.2.1

	dhcp-2.0b1pl18

>Description:

	in client/dchlient.c during the ack sequence of events, the
	lease time is converted from the packet structure to the 
	new lease structure by calling getULong() (in convert.c)
	
	getULong() takes the string value from the packet passed to it,
	and uses memcpy to copy the bytes from the string into a
	unsigned long integer.

	the unsigned long integer is then passed to ntohl() to get the
	correct network byte order.  Unfortunately this is a time value
	in seconds, not a network number.  The call to ntohl() completely
	mangles the intended value of the lease time on freebsd.

	although this is the primary problem, either the value from the
	memcpy() (unlikely since all the rest of the network address
	calls of 4 bytes work) or the actual value read from the packet
	in packet option[51] is wrong earlier on.  ie the value in ibuf
	after the memcpy in getULong() is not the same as the one being
	served and correctly sent by the server (If i remember right it
	seems shifted). 

>How-To-Repeat:

	- Use a dhcp server with a known lease time
	- compile dhclient
	- run dhclient
	- observe the lease time from the console output and the lease time
	  calculated in /var/db/dhclient.leases
>Fix:

	(partial)	
	- use a straight memcpy in dhcpack() to set
	  ip -> client -> new -> expiry instead of calling getULong().


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9904221131090.1668-100000>