dect
/
libpcap
Archived
13
0
Fork 0

Update CHANGES for USB fixes.

Update CREDITS to give Jon Smirl credit for some of the USB fixes.

Rename DLT_USB_LINUX_MMAP to DLT_USB_LINUX_MMAPPED, and declare a
structure for the header of packets in DLT_USB_LINUX_MMAPPED captures.
This commit is contained in:
guy 2008-12-23 20:13:29 +00:00
parent 687233847f
commit b908482137
8 changed files with 42 additions and 24 deletions

View File

@ -1,6 +1,6 @@
@(#) $Header: /tcpdump/master/libpcap/CHANGES,v 1.71 2008-12-15 00:27:54 guy Exp $ (LBL)
@(#) $Header: /tcpdump/master/libpcap/CHANGES,v 1.72 2008-12-23 20:13:29 guy Exp $ (LBL)
Mon. December 15, 2008. ken@netfunctional.ca. Summary for 1.0.1 libpcap release
Tue. December 23, 2008. ken@netfunctional.ca. Summary for 1.0.1 libpcap release
Install headers unconditionally, and include vlan.h/bluetooth.h if enabled
Autoconf fixes+cleanup
Support enabling/disabling bluetooth (--{en,dis}able-bluetooth)
@ -10,6 +10,7 @@ Mon. December 15, 2008. ken@netfunctional.ca. Summary for 1.0.1 libpcap rel
attempt to open it in Monitor mode
Add support for snapshot length for USB Memory-Mapped Interface
Fix configure and build on recent Linux kernels
Fixes for Linux USB capture
DLT: Add DLT_LINUX_EVDEV
DLT: Add DLT_GSMTAP_UM
DLT: Add DLT_GSMTAP_ABIS

View File

@ -58,6 +58,7 @@ Additional people who have contributed patches:
Joerg Mayer <jmayer at loplof dot de>
John Bankier <jbankier at rainfinity dot com>
Jon Lindgren <jonl at yubyub dot net>
Jon Smirl <jonsmirl at gmail dot com>
Juergen Schoenwaelder <schoenw at ibr dot cs dot tu-bs dot de>
Jung-uk Kim <jkim at FreeBSD dot org>
Kazushi Sugyo <sugyo at pb dot jp dot nec dot com>

View File

@ -21,7 +21,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.308 2008-12-23 18:03:22 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.309 2008-12-23 20:13:29 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -1508,7 +1508,7 @@ init_linktype(p)
off_nl_nosnap = -1;
return;
case DLT_USB_LINUX_MMAP:
case DLT_USB_LINUX_MMAPPED:
/*
* Currently, only raw "link[N:M]" filtering is supported.
*/
@ -3370,7 +3370,7 @@ gen_linktype(proto)
case DLT_USB:
case DLT_USB_LINUX:
case DLT_USB_LINUX_MMAP:
case DLT_USB_LINUX_MMAPPED:
bpf_error("USB link-layer type filtering not implemented");
case DLT_BLUETOOTH_HCI_H4:

View File

@ -34,7 +34,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/libpcap/pcap-usb-linux.c,v 1.29 2008-12-23 19:05:26 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/libpcap/pcap-usb-linux.c,v 1.30 2008-12-23 20:13:29 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -255,7 +255,7 @@ usb_activate(pcap_t* handle)
/* binary api is available, try to use fast mmap access */
if (usb_mmap(handle)) {
handle->linktype = DLT_USB_LINUX_MMAP;
handle->linktype = DLT_USB_LINUX_MMAPPED;
handle->stats_op = usb_stats_linux_bin;
handle->read_op = usb_read_linux_mmap;
handle->cleanup_op = usb_cleanup_linux_mmap;
@ -733,8 +733,8 @@ usb_read_linux_mmap(pcap_t *handle, int max_packets, pcap_handler callback, u_ch
clen = hdr->data_len;
/* get packet info from header*/
pkth.caplen = clen + MMAPPED_USB_HEADER_SIZE;
pkth.len = hdr->data_len + MMAPPED_USB_HEADER_SIZE;
pkth.caplen = clen + sizeof(pcap_usb_header_mmapped);
pkth.len = hdr->data_len + sizeof(pcap_usb_header_mmapped);
pkth.ts.tv_sec = hdr->ts_sec;
pkth.ts.tv_usec = hdr->ts_usec;

4
pcap.c
View File

@ -33,7 +33,7 @@
#ifndef lint
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.127 2008-12-23 18:03:22 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.128 2008-12-23 20:13:29 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -624,7 +624,7 @@ static struct dlt_choice dlt_choices[] = {
DLT_CHOICE(DLT_AX25_KISS, "AX.25 with KISS header"),
DLT_CHOICE(DLT_IEEE802_15_4_NONASK_PHY, "IEEE 802.15.4 with non-ASK PHY data"),
DLT_CHOICE(DLT_MPLS, "MPLS with label as link-layer header"),
DLT_CHOICE(DLT_USB_LINUX_MMAP, "USB with padded Linux header"),
DLT_CHOICE(DLT_USB_LINUX_MMAPPED, "USB with padded Linux header"),
DLT_CHOICE_SENTINEL
};

View File

@ -37,7 +37,7 @@
*
* @(#)bpf.h 7.1 (Berkeley) 5/7/91
*
* @(#) $Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.31 2008-12-23 18:03:22 guy Exp $ (LBL)
* @(#) $Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.32 2008-12-23 20:13:29 guy Exp $ (LBL)
*/
/*
@ -848,7 +848,7 @@ struct bpf_version {
* USB packets, beginning with a Linux USB header, with the USB header
* padded to 64 bytes; required for memory-mapped access.
*/
#define DLT_USB_LINUX_MMAP 220
#define DLT_USB_LINUX_MMAPPED 220
/*

View File

@ -30,7 +30,7 @@
* Basic USB data struct
* By Paolo Abeni <paolo.abeni@email.it>
*
* @(#) $Header: /tcpdump/master/libpcap/pcap/usb.h,v 1.8 2008-12-23 18:12:46 guy Exp $
* @(#) $Header: /tcpdump/master/libpcap/pcap/usb.h,v 1.9 2008-12-23 20:13:29 guy Exp $
*/
#ifndef _PCAP_USB_STRUCTS_H__
@ -68,8 +68,6 @@ typedef struct _usb_setup {
/*
* Header prepended by linux kernel to each event.
* Appears at the front of each packet in DLT_USB_LINUX captures.
* Appears at the front of each packet, followed by padding to a multiple
* of 64 bytes, in DLT_USB_LINUX_MMAP captures.
*/
typedef struct _usb_header {
u_int64_t id;
@ -89,8 +87,26 @@ typedef struct _usb_header {
} pcap_usb_header;
/*
* In DLT_USB_LINUX_MMAP captures, the header is padded to 64 bytes.
* Header prepended by linux kernel to each event, plus padding in the
* internal buffer.
* Appears at the front of each packet in DLT_USB_LINUX_MMAPPED captures.
*/
#define MMAPPED_USB_HEADER_SIZE ((sizeof (pcap_usb_header) + 63) & ~63)
typedef struct _usb_header_mmapped {
u_int64_t id;
u_int8_t event_type;
u_int8_t transfer_type;
u_int8_t endpoint_number;
u_int8_t device_address;
u_int16_t bus_id;
char setup_flag;/*if !=0 the urb setup header is not present*/
char data_flag; /*if !=0 no urb data is present*/
int64_t ts_sec;
int32_t ts_usec;
int32_t status;
u_int32_t urb_len;
u_int32_t data_len; /* amount of urb data really present in this event*/
pcap_usb_setup setup;
u_int8_t padding[16];
} pcap_usb_header_mmapped;
#endif

View File

@ -30,7 +30,7 @@
#ifndef lint
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.182 2008-12-23 18:03:22 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.183 2008-12-23 20:13:29 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -674,7 +674,7 @@ static const char rcsid[] _U_ =
* USB packets, beginning with a Linux USB header, with the USB header
* padded to 64 bytes; required for memory-mapped access.
*/
#define LINKTYPE_USB_LINUX_MMAP 220
#define LINKTYPE_USB_LINUX_MMAPPED 220
static struct linktype_map {
@ -992,7 +992,7 @@ static struct linktype_map {
{ DLT_MPLS, LINKTYPE_MPLS },
/* USB with padded Linux header */
{ DLT_USB_LINUX_MMAP, LINKTYPE_USB_LINUX_MMAP },
{ DLT_USB_LINUX_MMAPPED, LINKTYPE_USB_LINUX_MMAPPED },
{ -1, -1 }
};
@ -1564,16 +1564,16 @@ sf_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char *buf, u_int buflen)
}
/*
* The DLT_USB_LINUX and DLT_USB_LINUX_MMAP headers are in host
* The DLT_USB_LINUX and DLT_USB_LINUX_MMAPPED headers are in host
* byte order when capturing (it's supplied directly from a
* memory-mapped buffer shared by the kernel).
*
* When reading a DLT_USB_LINUX or DLT_USB_LINUX_MMAP capture file,
* When reading a DLT_USB_LINUX or DLT_USB_LINUX_MMAPPED capture file,
* we need to convert it from the capturing host's byte order to
* the reading host's byte order.
*/
if (p->sf.swapped &&
(p->linktype == DLT_USB_LINUX || p->linktype == DLT_USB_LINUX_MMAP)) {
(p->linktype == DLT_USB_LINUX || p->linktype == DLT_USB_LINUX_MMAPPED)) {
pcap_usb_header* uhdr = (pcap_usb_header*) buf;
/*
* The URB id is a totally opaque value; do we really need to