From marka@metaip.checkpoint.com Thu Apr 22 11:35:15 1999
Return-Path: <marka@metaip.checkpoint.com>
Received: from postal.metaip.checkpoint.com (metaip.checkpoint.com [204.29.28.25])
	by hub.freebsd.org (Postfix) with ESMTP id A1DF5151FD
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Apr 1999 11:35:08 -0700 (PDT)
	(envelope-from marka@metaip.checkpoint.com)
Received: from cartman.metainfo.com (cartman.metainfo.com [204.29.28.145])
	by postal.metaip.checkpoint.com (8.8.7/8.8.7) with ESMTP id KAA02861
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Apr 1999 10:50:09 -0700
Received: from moby.dev.metainfo.com (sneakers.metainfo.com [204.29.28.213]) by cartman.metainfo.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2448.0)
	id 25DWP15Z; Thu, 22 Apr 1999 11:14:20 -0700
Message-Id: <Pine.BSF.4.10.9904221131090.1668-100000@moby.dev.metainfo.com>
Date: Thu, 22 Apr 1999 11:32:39 -0700 (PDT)
From: Mark Atkinson <marka@metaip.checkpoint.com>
Reply-To: marka@metaip.checkpoint.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: isc-dhcp2 client port incorrectly reports lease time

>Number:         11282
>Category:       ports
>Synopsis:       isc-dhcp2 client port incorrectly reports lease time
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 22 11:40:01 PDT 1999
>Closed-Date:    Sun May 2 18:13:23 PDT 1999
>Last-Modified:  Sun May  2 18:15:26 PDT 1999
>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:

From: "Jasper O'Malley" <jooji@webnology.com>
To: Mark Atkinson <marka@metaip.checkpoint.com>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: ports/11282: isc-dhcp2 client port incorrectly reports lease
 time
Date: Thu, 22 Apr 1999 22:37:49 -0500 (CDT)

 I'd suggest sending a bug report to the author of the software, Ted Lemon
 <mellon@hoffman.vix.com>.
 
 Cheers,
 Mick
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Sun May 2 18:13:23 PDT 1999 
State-Changed-Why:  
Please submit a bug report with the dhcp2's maintainer, Ted Lemon.  If 
you'd like to supply us with a patch we'd be happy to fixup the port 
until Mr. Lemon has a chance to create a new distribution.  Thanks. 
>Unformatted:
