Subject: bin/15512: tcpdump dhcp printer has host/network byte ordering problem
To: None <>
From: None <>
List: netbsd-bugs
Date: 02/06/2002 15:34:56
>Number:         15512
>Category:       bin
>Synopsis:       tcpdump dhcp printer has host/network byte ordering problem
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 06 12:36:01 PST 2002
>Originator:     Greg Troxel
>Release:        NetBSD 1.5.3_ALPHA (2001-11-26)
BBN Technologies
System: NetBSD 1.5.3_ALPHA NetBSD 1.5.3_ALPHA (QUISTCVS) #2: Mon Jan 21 12:39:10 EST 2002 i386
Architecture: i386
Machine: i386

Running tcpdump -s1500 -vvv and watching replies, I see leasetimes
that are preposterous: dhcp-leasetime:2152792320.  This is 
80510100 hex, which when ntohl()'d is 86400 decimal, which is what I configured in the dhcpd config file (in-tree dchp).

setup dhcp server and read the tcpdump output on an i386.

1) merge from -current the change to use more recent
sources, which have already fixed this problem in a more pervasive

2) Or, apply the following patch:

cvs diff: Diffing src/usr.sbin/tcpdump
Index: src/usr.sbin/tcpdump/print-bootp.c
RCS file: /QUIST-CVS/netbsd/src/usr.sbin/tcpdump/print-bootp.c,v
retrieving revision
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- src/usr.sbin/tcpdump/print-bootp.c	2000/10/27 15:17:00
+++ src/usr.sbin/tcpdump/print-bootp.c	2002/02/06 20:13:48	1.2
@@ -351,7 +351,7 @@
 				if (c == 'i')
 					printf("%s", ipaddr_string(&ul));
-					printf("%u", ul);
+					printf("%u", ntohl(ul));
 				bp += sizeof(ul);
 				size -= sizeof(ul);
 				first = 0;
@@ -364,7 +364,7 @@
 				if (!first)
 				memcpy((char *)&us, (char *)bp, sizeof(us));
-				printf("%d", us);
+				printf("%d", ntohs(us));
 				bp += sizeof(us);
 				size -= sizeof(us);
 				first = 0;