Subject: bin/15512: tcpdump dhcp printer has host/network byte ordering problem
To: None <gnats-bugs@gnats.netbsd.org>
From: None <gdt@bbn.com>
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
>Closed-Date:
>Last-Modified:
>Originator: Greg Troxel
>Release: NetBSD 1.5.3_ALPHA (2001-11-26)
>Organization:
BBN Technologies
>Environment:
System: NetBSD lab.q.bbn.com 1.5.3_ALPHA NetBSD 1.5.3_ALPHA (QUISTCVS) #2: Mon Jan 21 12:39:10 EST 2002 gdt@lab.q.bbn.com:/home/gdt/QUIST-current/netbsd/src/sys/arch/i386/compile/QUISTCVS i386
Architecture: i386
Machine: i386
>Description:
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).
>How-To-Repeat:
setup dhcp server and read the tcpdump output on an i386.
>Fix:
1) merge from -current the change to use more recent tcpdump.org
sources, which have already fixed this problem in a more pervasive
way.
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 1.1.1.1
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 1.1.1.1
+++ 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));
else
- printf("%u", ul);
+ printf("%u", ntohl(ul));
bp += sizeof(ul);
size -= sizeof(ul);
first = 0;
@@ -364,7 +364,7 @@
if (!first)
putchar(',');
memcpy((char *)&us, (char *)bp, sizeof(us));
- printf("%d", us);
+ printf("%d", ntohs(us));
bp += sizeof(us);
size -= sizeof(us);
first = 0;
>Release-Note:
>Audit-Trail:
>Unformatted: