today I have found some bug on pcap-usb-linux.c

now i can try to tell you which are


transfer direction in "text mode" is broken...
in accordance with usbmon.txt transfer direction is in endpoint_number rather than transfer type

ther'is premature stop when capture traffic on linux with "text mode" due to incorrect check of urb data length.

i.e. with this log

d641c3a0 3906920058 S Ci:001:00 s a3 00 0000 0001 0004 4 <
d641c3a0 3906920128 C Ci:001:00 0 4 = 01030100
d641c3a0 3906920139 S Ci:001:00 s a3 00 0000 0002 0004 4 <
d641c3a0 3906920142 C Ci:001:00 0 4 = 00030000
d6344ca0 3906920147 S Ii:001:01 -115 2 <
d641c3a0 3906920179 S Ci:001:00 s a3 00 0000 0001 0004 4 <
d641c3a0 3906920183 C Ci:001:00 0 4 = 01030100
d641c3a0 3906920187 S Co:001:00 s 23 01 0010 0001 0000 0
d641c3a0 3906920191 C Co:001:00 0 0
d641c3a0 3906920196 S Ci:001:00 s a3 00 0000 0001 0004 4 <
d641c3a0 3906920199 C Ci:001:00 0 4 = 01030000
[CUT]

"text mode" capture only 7 packets

the "d641c3a0 3906920187 S Co:001:00 s 23 01 0010 0001 0000 0" stop capture of traffic.


Index: pcap-usb-linux.c
===================================================================
RCS file: /home/jean-louis/cvsroot/libpcap/pcap-usb-linux.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** pcap-usb-linux.c	23 Oct 2008 15:52:55 -0000	1.1
--- pcap-usb-linux.c	29 Oct 2008 14:17:44 -0000	1.2
***************
*** 351,357 ****
  		return -1;
  	}
  	uhdr->id = tag;
- 	uhdr->endpoint_number = ep_num;
  	uhdr->device_address = dev_addr;
  	uhdr->bus_id = handle->md.ifindex;
  	uhdr->status = 0;
--- 351,356 ----
***************
*** 378,384 ****
  	else if (pipeid1 == 'B')
  		urb_transfer = URB_BULK;
  	if (pipeid2 == 'i') {
! 		urb_transfer |= URB_TRANSFER_IN;
  		incoming = 1;
  	}
  	if (etype == 'C')
--- 377,383 ----
  	else if (pipeid1 == 'B')
  		urb_transfer = URB_BULK;
  	if (pipeid2 == 'i') {
! 		ep_num |= URB_TRANSFER_IN;
  		incoming = 1;
  	}
  	if (etype == 'C')
***************
*** 395,400 ****
--- 394,400 ----
  			return 0;
  	uhdr->event_type = etype;
  	uhdr->transfer_type = urb_transfer;
+ 	uhdr->endpoint_number = ep_num;
  	pkth.caplen = sizeof(pcap_usb_header);
  	rawdata += sizeof(pcap_usb_header);
  
***************
*** 447,453 ****
  	uhdr->urb_len = urb_len;
  	uhdr->data_flag = 1;
  	data_len = 0;
! 	if (uhdr->urb_len == pkth.caplen)
  		goto got;
  
  	/* check for data presence; data is present if and only if urb tag is '=' */
--- 447,453 ----
  	uhdr->urb_len = urb_len;
  	uhdr->data_flag = 1;
  	data_len = 0;
! 	if (uhdr->urb_len == 0)
  		goto got;
  
  	/* check for data presence; data is present if and only if urb tag is '=' */
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.

Reply via email to