Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Dec 1996 12:50:02 -0800 (PST)
From:      Bill Fenner <fenner@parc.xerox.com>
To:        freebsd-bugs
Subject:   Re: bin/2212: libpcap after 0.2.0 does not work properly with tun devices
Message-ID:  <199612162050.MAA01542@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/2212; it has been noted by GNATS.

From: Bill Fenner <fenner@parc.xerox.com>
To: freebsd-gnats-submit@freebsd.org, graphix@iastate.edu
Cc:  Subject: Re: bin/2212: libpcap after 0.2.0 does not work properly with tun devices
Date: Mon, 16 Dec 1996 12:46:16 PST

 This appears to be confusion over whether the address family is in
 host or network byte order.  The BPF program created by an older libpcap
 to perform "tcpdump -i lo0 icmp" is:
 
 (000) ld       [0]
 (001) jeq      #0x2000000       jt 2    jf 5
 (002) ldb      [13]
 (003) jeq      #0x1             jt 4    jf 5
 (004) ret      #68
 (005) ret      #0
 
 and the new libpcap creates:
 
 (000) ld       [0]
 (001) jeq      #0x2             jt 2    jf 5
 (002) ldb      [13]
 (003) jeq      #0x1             jt 4    jf 5
 (004) ret      #68
 (005) ret      #0
 
 Note the difference in byte-order of the constant 2 (==AF_INET) in
 instruction #1.
 
 The BPF filter performs all loads in network byte order, so instruction
 0 loads 0x02000000 into A, since the value is in host byte order.
 
 I will check with the LBL folks before doing anything but I think it's a
 straightforward fix to libpcap/gencode.c .
 
   Bill



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612162050.MAA01542>