aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2016-02-28 15:43:24 +0100
committerMichael Mann <mmann78@netscape.net>2016-02-28 20:49:14 +0000
commit0165e679d62162dcf3e7f334237f9416a21310a6 (patch)
tree9bf1b8066e91d6800d776028ac3121c8208fad61 /epan
parentdf7c21bed2d06c57126ade187a02e77dd357b6f5 (diff)
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>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-u3v.c13
-rw-r--r--epan/dissectors/packet-usb.c2
-rw-r--r--epan/dissectors/packet-usb.h2
3 files changed, 7 insertions, 10 deletions
diff --git a/epan/dissectors/packet-u3v.c b/epan/dissectors/packet-u3v.c
index 3918da4b85..8e85a0965e 100644
--- a/epan/dissectors/packet-u3v.c
+++ b/epan/dissectors/packet-u3v.c
@@ -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;
}
diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c
index 0235060f24..1e092a9b13 100644
--- a/epan/dissectors/packet-usb.c
+++ b/epan/dissectors/packet-usb.c
@@ -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}
};
diff --git a/epan/dissectors/packet-usb.h b/epan/dissectors/packet-usb.h
index c12d5d0e03..20ecc80b04 100644
--- a/epan/dissectors/packet-usb.h
+++ b/epan/dissectors/packet-usb.h
@@ -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 */