]> The Tcpdump Group git mirrors - libpcap/commitdiff
Update CHANGES for USB fixes.
authorguy <guy>
Tue, 23 Dec 2008 20:14:12 +0000 (20:14 +0000)
committerguy <guy>
Tue, 23 Dec 2008 20:14:12 +0000 (20:14 +0000)
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.

CHANGES
CREDITS
gencode.c
pcap-usb-linux.c
pcap.c
pcap/bpf.h
pcap/usb.h
savefile.c

diff --git a/CHANGES b/CHANGES
index 9dc067f1b0947f9cb97a4b1c2ca49eda1af7086f..d5480ddb6139dda91e044808a0cacf54a20d396e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,6 @@
-@(#) $Header: /tcpdump/master/libpcap/CHANGES,v 1.67.2.8 2008-12-15 00:28:29 guy Exp $ (LBL)
+@(#) $Header: /tcpdump/master/libpcap/CHANGES,v 1.67.2.9 2008-12-23 20:14:12 guy Exp $ (LBL)
 
-Mon.    December 15, 2008.  [email protected].  Summary for 1.0.1 libpcap release
+Tue.    December 23, 2008.  [email protected].  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.  [email protected].  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
diff --git a/CREDITS b/CREDITS
index e9407314cd9436b4959f8d0273f9a81e23ada8bb..f19de4d6ce932c14adb2e9c975113a182a018d7e 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -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>
index a918dd36fb7f6cd4577e192a6b939d6bdcdbf580..5548e6fd1f0c4dadfdff9b0778a0f6dde3e0daa6 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -21,7 +21,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.290.2.18 2008-12-23 18:04:28 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.290.2.19 2008-12-23 20:14:12 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:
index ea64d69c9aa7d48e6f2705fc79d491c570c96e27..257df7ad10952f843f6199fafcef4b79528fd927 100644 (file)
@@ -34,7 +34,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-usb-linux.c,v 1.16.2.13 2008-12-23 19:05:48 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/pcap-usb-linux.c,v 1.16.2.14 2008-12-23 20:14:13 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;
 
diff --git a/pcap.c b/pcap.c
index e8213212004e3ab8918a3c5f990bdc4d34a3d07e..30ade8dd404800997fe4aa4beebeb3919dac32c3 100644 (file)
--- a/pcap.c
+++ b/pcap.c
@@ -33,7 +33,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.112.2.15 2008-12-23 18:04:29 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.112.2.16 2008-12-23 20:14:13 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
 };
 
index f744fc96c8a04c8f3d30c07e81edc37722c12c32..6bcf7d4261b7630c35312cc271b030c876199609 100644 (file)
@@ -37,7 +37,7 @@
  *
  *      @(#)bpf.h       7.1 (Berkeley) 5/7/91
  *
- * @(#) $Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.19.2.12 2008-12-23 18:04:29 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.19.2.13 2008-12-23 20:14:13 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
 
 
 /*
index 18c4ec7725212b0c8c438477e9d5033e2bb0a987..a848e0dbb3c6605fd287c7b1372f4072a5950667 100644 (file)
@@ -30,7 +30,7 @@
  * Basic USB data struct
  * By Paolo Abeni <[email protected]>
  *
- * @(#) $Header: /tcpdump/master/libpcap/pcap/usb.h,v 1.6.2.2 2008-12-23 18:13:02 guy Exp $
+ * @(#) $Header: /tcpdump/master/libpcap/pcap/usb.h,v 1.6.2.3 2008-12-23 20:14:13 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
index a4a7b7928d3337a2c1993608ed9a425f7f234720..a01761acb205e360918e13532f4ad0f0ea1eaf35 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.168.2.14 2008-12-23 18:04:29 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.168.2.15 2008-12-23 20:14:13 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