aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb.c
AgeCommit message (Collapse)AuthorFilesLines
2015-03-11relay USB control messages without payload to protocol-specific dissectorsMartin Kaiser1-9/+5
at the moment, we don't forward such messages and therefore see lots of generic USB control messages that could be dissected further even if there's no data, a protocol-specific dissector may still set the columns based on conversation info Change-Id: If3fc0f0ce3bdec1f91b7e3cadc3affd56b8c8969 Reviewed-on: https://code.wireshark.org/review/7584 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2015-03-05USB: add support for alternate setting selectionPascal Quantin1-11/+52
With this, the traffic of a device implementing both NCM and MBIM protocols is properly identified as MBIM when selected by the host Bug: 11018 Change-Id: I438ab1917945d9c5ba13329d515abc7e2cd13896 Reviewed-on: https://code.wireshark.org/review/7519 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-03-01Use COPY_ADDRESS_SHALLOW instead of duplicating TVB_SET_ADDRESS and ↵Michael Mann1-2/+3
SET_ADDRESS calls for the same address. Change-Id: I0c9cc5d574fdd73ecf1f8b32dbbf0ddb2b885116 Reviewed-on: https://code.wireshark.org/review/7437 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-10USB: put back interface class when dissecting URB_CONTROLPascal Quantin1-23/+26
Also ensure that USB COM dissection is done with the parent tree and not setup one Change-Id: Iae9f933ff29b3854879375df320a23e623ea785f Reviewed-on: https://code.wireshark.org/review/7051 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2015-02-07remove the offset parameter from dissect_usb_standard_setup_request()Martin Kaiser1-3/+3
Change-Id: Iaf339310c3b606885e945d10cffc1956ce24578a Reviewed-on: https://code.wireshark.org/review/7008 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2015-02-07dissect a get descriptor request and response for the HID report descriptorMartin Kaiser1-24/+0
treat those two messages as class-specific control messages, handle them inside the USB HID dissector Change-Id: I42d201df4a8fdb94c947b6118c0b50945c306423 Reviewed-on: https://code.wireshark.org/review/7006 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2015-02-07refactor the dissection of USB setup requestsMartin Kaiser1-28/+47
pass the data only to one subsequent dissection function either we have a standard request or a non-standard request that can be handled by a class dissector (we used to do both at the same time, this makes the output difficult to read) Change-Id: Ia46239b2b9e121c9ca165cc56d0b271345d7962e Reviewed-on: https://code.wireshark.org/review/7005 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2015-02-07change try_dissect_next_protocol() such that its parameter is theMartin Kaiser1-15/+9
top-most tree on which it operates this gives callers more control over where things are displayed Change-Id: I8cdc07b4f3569bca728781fb709e2a2bb37c433b Reviewed-on: https://code.wireshark.org/review/7004 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2015-02-07new function is_usb_standard_setup_request() to check if a request is aMartin Kaiser1-3/+27
standard setup request it's not sufficient to look at the type bits in the request type field use the new function where we checked the type bits before Change-Id: I65b901dca91607a4dad4e4296b3f3a877aebf346 Reviewed-on: https://code.wireshark.org/review/7003 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2015-01-28Try dissecting some stuff even if we don't have conversation information.Guy Harris1-40/+71
Fill in a local transaction information structure, so we can pass data from the packet down. Skip stuff that depends on conversation information if we don't have any. Change-Id: I5a8bd21bdf632ada9013e616c5fc4e8bd14c9698 Reviewed-on: https://code.wireshark.org/review/6837 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-28Make the USB header information an enumerated type.Guy Harris1-43/+104
It's not really a bitset, it's a choice of one of four types of USB pseudo-header. Make it an enum. Change-Id: I4ea994e1606c23e0a0f08b1b61357eea40a2535e Reviewed-on: https://code.wireshark.org/review/6830 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-28Move tests out of try_dissect_linux_usb_pseudo_header_ext().Guy Harris1-24/+30
Do the tests in its callers; rename it to just dissect_linux_usb_pseudo_header_ext() and don't bother passing it the header_info flag. We can remove some of those tests as they're already done in the caller. Change-Id: I7c3cfefba833a84c834462307088f5c31612128e Reviewed-on: https://code.wireshark.org/review/6829 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-28Add documentation URLs for the Linux USB and USBPCAP pseudo-headers.Guy Harris1-0/+4
Change-Id: If5cecfeb66b3caca6478206f2fcb2f617ef02b46 Reviewed-on: https://code.wireshark.org/review/6828 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-21Remove some dead initializersBill Meier1-2/+2
Change-Id: I16c88b5e8f6e79a0d9b33b9c3c4d94f77ecfdfa2 Reviewed-on: https://code.wireshark.org/review/6723 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-01-16USB: do not put usb_address_t structure on stack and initialize it ↵Pascal Quantin1-16/+17
completely (including implicit padding for alignment) Bug: 10857 Change-Id: Ib8339a5dc1c9461e681e0015c3f851c642f300c9 Reviewed-on: https://code.wireshark.org/review/6560 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-01-13When allocating address structures, use wmem_new0().Guy Harris1-2/+2
For structures used as the data in an address, use wmem_new(), so that structure padding is zeroed out; the comparison code for addresses compares all bytes of the structure for addresses that are structures, and the hashing code for hash tables using addresses as keys hash all the bytes, so we have to make sure that, for addresses that are the same, *all* bytes are the same. Change-Id: I995fd26cc2f20edb5a599f95562b720561708e57 Reviewed-on: https://code.wireshark.org/review/6517 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-10USB: Fix Conversation/Endpoint filtersMichal Labedzki1-10/+44
There were not fields for that, so simple add them. Change-Id: I489bae24ac96ea0baf395add731f4d62ccf19352 Reviewed-on: https://code.wireshark.org/review/6401 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Michal Labedzki <michal.labedzki@tieto.com> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2015-01-09convert variables that were static just because of SET_ADDRESS macro to use ↵Michael Mann1-6/+7
the proper pinfo->pool instead. Change-Id: I914918d9629f654ead497dddac0f412b690e4409 Reviewed-on: https://code.wireshark.org/review/6430 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-07tvb_bytes_to_ep_str -> tvb_bytes_to_strMichael Mann1-1/+1
Change-Id: I79c613cbdd8dc939dd4c29ebc477fb6eefd5bfc4 Reviewed-on: https://code.wireshark.org/review/6371 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-02tshark: Add endpoints statisticsMichael Mann1-1/+1
"stat name" has been official changed to "endpoints" for all dissectors, rather than a mixture of "host"/"endpoints" based on dissector. Change-Id: If34bcb5165b493948e784ba038ab202803a59843 Reviewed-on: https://code.wireshark.org/review/6154 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-25Deleting unnecessary #includes from dissectors.Martin Mathieson1-3/+0
Fifth batch (packet-rtp.c -> end). Will look at cleaning up and committing script afterwards. Change-Id: I8ed61dc941d98d3f7259a9d1f74e214eb7b4bfa2 Reviewed-on: https://code.wireshark.org/review/6052 Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-21Cleanup use of #includes in non-generated epan/dissector/*.cBill Meier1-2/+0
Specifically: - Set packet.h to be the first wireshark #include after config.h and "system" #includes. packet.h added as an #include in some cases when missing. - Remove some #includes included (directly/indirectly) in packet.h. E.g., glib.h. (Done only for those files including packet.h). - As needed, move "system" #includes to be after config.h and before wireshark #includes. - Rework various #include file specifications for consistency. - Misc. Change-Id: Ifaa1a14b50b69fbad38ea4838a49dfe595c54c95 Reviewed-on: https://code.wireshark.org/review/5923 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-21Have a heur_dissector_list_t be an opaque handle.Guy Harris1-4/+4
This allows dissector lists to be looked up by name, so they can be shared by multiple dissectors. (This means that there's no "udplite" heuristic dissector list, but there shouldn't be one - protocols can run atop UDP or UDPLite equally well, and they share a port namespace and uint dissector table, so they should share a heuristic dissector table as well.) Change-Id: Ifb2d2c294938c06d348a159adea7a57db8d770a7 Reviewed-on: https://code.wireshark.org/review/5936 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18Bluetooth: Add generic Bluetooth dissectorMichal Labedzki1-3/+3
Bluetooth dissector is used to add ability to filter all bluetooth payload from capture files (there are many transport like: hci_h4, hci_h1, hci_usb, hci_mon, btle). Also it is used to placeholder for all data tree used to store additional informations like bd_addrs, names, etc. Finally it is used to be one point for Bluetooth Endpoints/Conversation filtering what is enabled now. Also add Master/Slave Role and Connection Mode tracking. Change-Id: I67048080fb8ee16fa0f4ec429c1257de81ddd737 Reviewed-on: https://code.wireshark.org/review/5771 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2014-12-13Use ENC_LITTLE_ENDIAN when fetching FT_U?INT8 fields ...Bill Meier1-2/+2
(for some dissectors which fetch all other integral fields using ENC_LITTLE_ENDIAN). Change-Id: Ica72a68ac560f2920d61e0769de83130557c46fd Reviewed-on: https://code.wireshark.org/review/5752 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-13dissector_try_uint(_new) and dissector_try_string now return the number of ↵Pascal Quantin1-1/+1
bytes consumed Change-Id: I528ad736caee1f29e2f0abfc0afcca6587d74eca Reviewed-on: https://code.wireshark.org/review/5743 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-11-10USB: consider the device class when we try to select the next dissectorMartin Kaiser1-1/+14
at the moment, we only use the interface class, even in situations where it's not applicable (e.g. control request that's not addressed to an interface or an endpoint) - this is a hack that works because some dissectors register for interface class "unknown", I'm trying to make this workaround obsolete Change-Id: I6bf4253a2f8bf5a75ea1a08c3e52d36f80abd7ab Reviewed-on: https://code.wireshark.org/review/5215 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Sean Stalley <seanstalley@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-11-08remove parent parameter from dissect_usb_setup_response()Martin Kaiser1-4/+7
Change-Id: Ib4a5cc3b783d3a4a1477624678964a9627d582e6 Reviewed-on: https://code.wireshark.org/review/5191 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-11-08remove parent parameter from dissect_usb_setup_request()Martin Kaiser1-3/+5
Change-Id: I5a24de9a12e301d472e701140299304e2cb4fcfc Reviewed-on: https://code.wireshark.org/review/5190 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-11-02remove parent parameter from try_dissect_next_protocol()Martin Kaiser1-4/+7
Change-Id: Ib05b67c8741f90444e773e7c9e1378f00f41dad7 Reviewed-on: https://code.wireshark.org/review/5083 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-10-20Get rid of unnecessary includes of ctype.h.Guy Harris1-2/+0
Change-Id: I2cf49f808558147ce77e7d086558966cfb2defca Reviewed-on: https://code.wireshark.org/review/4850 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-22Try to fix some buildbot warningsMichal Labedzki1-2/+2
Most interesting are: warning: cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations] warning: ISO C forbids zero-size array [-Wpedantic] warning: ISO C90 doesn't support unnamed structs/unions [-Wpedantic] warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual warning: initializer element is not computable at load time [enabled by default] Change-Id: I5573c6bdca856a304877d9bef643f8c0fa93cdaf Reviewed-on: https://code.wireshark.org/review/3174 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
2014-09-17Show endpoint direction based on EPHandle bitSean O. Stalley1-1/+1
Interpret the meaning of the endpoint handle direction bit, instead of just saying if it is set. Change-Id: I9fc0d6f95f6c3a94d6db90c8394fe3ca8fc83715 Reviewed-on: https://code.wireshark.org/review/4119 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-09-17Fixed dissection of 8-byte device descriptorsSean O. Stalley1-0/+7
during usb device enumeration, a host may attempt to only read the first 8 bytes of a device descriptor. Dissecting a partial device descriptor was throwing a bounds error. Change-Id: I09cdd356d15153afc93ee478fdd98329495a642a Reviewed-on: https://code.wireshark.org/review/4137 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-09-15USB feature selectors now per USB 3.1 specSean O. Stalley1-9/+92
previously per USB 2 spec. Change-Id: Ifb25614785bcaf80148c32938f966c8cdded6be2 Reviewed-on: https://code.wireshark.org/review/4087 Reviewed-by: Evan Huus <eapache@gmail.com> Petri-Dish: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-08-28set usb_dissector_table for control messages to "other" and "reserved"Martin Kaiser1-7/+6
add a comment to explain this Change-Id: I7aa04ab1653cd8e6ae82c230d93c4c8ead677ace Reviewed-on: https://code.wireshark.org/review/3910 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-08-28remove offset parameter from try_dissect_next_protocol()Martin Kaiser1-13/+10
Change-Id: I7452e6c5a9a24d44f83338aeb1dae389b87c8701 Reviewed-on: https://code.wireshark.org/review/3909 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-08-28handle standard and non-standard setup requests in the same functionMartin Kaiser1-40/+22
Change-Id: I5204a2fc1082e8a6b8082ad58fb252d4ba6c8bcb Reviewed-on: https://code.wireshark.org/review/3901 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-08-28simplify dissect_nonstandard_usb_setup_request()Martin Kaiser1-26/+19
create setup_tvb in the calling function Change-Id: Id34635afbd25817b09535fc52d1ba396b2597e5a Reviewed-on: https://code.wireshark.org/review/3900 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-08-28correct detection of USB header typeMartin Kaiser1-1/+2
this fixes a regression for linux USB headers without 64 bytes extension Change-Id: Icb79d983dac6dca25d04657d3324286c73d31f29 Reviewed-on: https://code.wireshark.org/review/3906 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-08-28remove unnecessary try_dissect_linux_usb_pseudo_header_ext() callMartin Kaiser1-1/+0
Change-Id: Iafe173d4625d7e57ee3bd9c2fe9a6e6176624dcc Reviewed-on: https://code.wireshark.org/review/3899 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-08-28merge dissect_linux_usb_pseudo_header_ext() andMartin Kaiser1-33/+14
try_dissect_linux_usb_pseudo_header_ext() Change-Id: Ica9e3089cc6bfde9b52158ef5e161dfcddeb716a Reviewed-on: https://code.wireshark.org/review/3898 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-08-28remove two obsolete commentsMartin Kaiser1-2/+0
Change-Id: I339655b699d998bd4194363df64d98543dcae624 Reviewed-on: https://code.wireshark.org/review/3897 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-08-28NULL check for usb_conv_infoMartin Kaiser1-3/+7
Change-Id: I6cb4347f73afcfe561d3dca846c846d481c1c3bd Reviewed-on: https://code.wireshark.org/review/3896 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-08-28req_type is the same as typeMartin Kaiser1-26/+12
Change-Id: Icdc94d65043feb5927aa0194cbef796e634bf3a9 Reviewed-on: https://code.wireshark.org/review/3895 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-08-28use proto_tree_add_subtree()Martin Kaiser1-3/+2
Change-Id: I0182397a7a208a2be8587fa4060a8497b54bb273 Reviewed-on: https://code.wireshark.org/review/3894 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-08-26USB: fix dissection of non standard USB setup requestsPascal Quantin1-50/+43
Otherwise captures like the one found in bug 8161 do not dissect properly anymore (sub dissector is called twice) While we are at it, reorganize functions order to void a forward declaration Change-Id: Id02ef835ba24981902a1702f976db099fa07b0fd Reviewed-on: https://code.wireshark.org/review/3858 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2014-08-26USB: get rid of the remaining proto_tree_add_text instancesPascal Quantin1-7/+20
Change-Id: I6acaa32745e32ec5728874549e420468499d9b24 Reviewed-on: https://code.wireshark.org/review/3860 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-08-26Have dissect_usb_setup_request handle non-standard requestsSean O. Stalley1-23/+28
Moved code for parsing non-standard setup requests from dissect_usb_common() to dissect_usb_setup_request(). Also added header_info flag USB_HEADER_IS_MAUSB & updated mausb dissector. Change-Id: Ifa8abccbd57bf4dd3965f582872952383e6f737d Reviewed-on: https://code.wireshark.org/review/3851 Petri-Dish: Anders Broman <a.broman58@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-08-26Non-standard USB control requests now handled in own functionSean O. Stalley1-29/+48
Change-Id: Icf56f3f5899d17908dac4783d2b3e30373186eba Reviewed-on: https://code.wireshark.org/review/3850 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com>