From owner-freebsd-ports Thu Apr 22 11:42:33 1999 Delivered-To: freebsd-ports@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 7036F159EF for ; Thu, 22 Apr 1999 11:42:30 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.2/8.9.2) id LAA92042; Thu, 22 Apr 1999 11:40:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from postal.metaip.checkpoint.com (metaip.checkpoint.com [204.29.28.25]) by hub.freebsd.org (Postfix) with ESMTP id A1DF5151FD for ; 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 ; 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: Date: Thu, 22 Apr 1999 11:32:39 -0700 (PDT) From: Mark Atkinson Reply-To: marka@metaip.checkpoint.com To: FreeBSD-gnats-submit@freebsd.org Subject: ports/11282: isc-dhcp2 client port incorrectly reports lease time Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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