u3v: use interface class and subclass in heuristic checks

don't access the class-specific conversation structure before we know
that the packet is a U3V packet

the USB dissector should fill interfaceClass and interfaceSubclass with
correct values - if it doesn't that's another bug to be fixed

Bug:12194
Change-Id: Ic9e73e7cb05c8887fee794e4735936caad1b7f49
Reviewed-on: https://code.wireshark.org/review/14224
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Martin Kaiser 2016-02-28 15:43:24 +01:00 committed by Michael Mann
parent df7c21bed2
commit 0165e679d6
3 changed files with 7 additions and 10 deletions

View File

@ -1685,11 +1685,6 @@ dissect_u3v(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
usb_conv_info->class_data = u3v_conv_info;
}
/* it should be possible to also match on
* usb_conv_info->interfaceSubclass and usb_conv_info->interfaceProtocol
* but it seems that this information is not correctly setup during
* descriptor parsing
*/
prefix = tvb_get_letohl(tvb, 0);
if ((tvb_reported_length(tvb) >= 4) && ( ( U3V_CONTROL_PREFIX == prefix ) || ( U3V_EVENT_PREFIX == prefix ) ) ) {
control_detected = TRUE;
@ -1883,7 +1878,6 @@ dissect_u3v_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
{
guint32 prefix;
usb_conv_info_t *usb_conv_info;
u3v_conv_info_t *u3v_conv_info;
/* all control and meta data packets of U3V contain at least the prefix */
if (tvb_reported_length(tvb) < 4)
@ -1894,12 +1888,13 @@ dissect_u3v_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
usb_conv_info = (usb_conv_info_t *)data;
if (!usb_conv_info)
return FALSE;
u3v_conv_info = (u3v_conv_info_t *)usb_conv_info->class_data;
/* either right prefix or the endpoint of the current transfer has been recognized as stream endpoint already */
/* either right prefix or the endpoint of the interface descriptor
set the correct class and subclass */
if ((U3V_STREAM_LEADER_PREFIX == prefix) || (U3V_STREAM_TRAILER_PREFIX == prefix) ||
(U3V_CONTROL_PREFIX == prefix) || (U3V_EVENT_PREFIX == prefix) ||
( u3v_conv_info && (usb_conv_info->endpoint == u3v_conv_info->ep_stream))) {
((usb_conv_info->interfaceClass == IF_CLASS_MISCELLANEOUS &&
usb_conv_info->interfaceSubclass == IF_SUBCLASS_MISC_U3V))) {
dissect_u3v(tvb, pinfo, tree, data);
return TRUE;
}

View File

@ -1217,7 +1217,7 @@ static value_string_ext usb_hid_boot_protocol_vals_ext = VALUE_STRING_EXT_INIT(u
static const value_string usb_misc_subclass_vals[] = {
{0x03, "Cable Based Association Framework"},
{0x04, "RNDIS"},
{0x05, "USB3 Vision"},
{IF_SUBCLASS_MISC_U3V, "USB3 Vision"},
{0x06, "Stream Transport Efficient Protocol"},
{0, NULL}
};

View File

@ -184,6 +184,8 @@ typedef struct _usb_tap_data_t {
#define DEV_VENDOR_UNKNOWN 0x0000 /* this id is unassigned */
#define DEV_PRODUCT_UNKNOWN 0xfffffff /* 0x0000 and 0xffff are used values by vendors, so MSBs encode unknown */
#define IF_SUBCLASS_MISC_U3V 0x05
/* bmRequestType values */
#define USB_DIR_OUT 0 /* to device */
#define USB_DIR_IN 0x80 /* to host */