aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2015-01-22 09:54:30 +0100
committerMichal Labedzki <michal.labedzki@tieto.com>2015-02-02 10:48:09 +0000
commitef6f6f0eb152eacd7e41c6ccb7fc52dcbd78c268 (patch)
tree440b0f08af2ff3bdffef0014c5ec16ad7ee0917a /epan
parentc4f08ec0f92c3d97bf398f27cd3196e8e7713a2a (diff)
Bluetooth: AVCTP: Improve IPID handling
If profile is invalid (IPID=1) then add expert info. Change-Id: Id102e51eefe7e5e6314c3677468cb66573e5a893 Reviewed-on: https://code.wireshark.org/review/6900 Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-btavctp.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/epan/dissectors/packet-btavctp.c b/epan/dissectors/packet-btavctp.c
index 0f614d8707..1c0f9ead02 100644
--- a/epan/dissectors/packet-btavctp.c
+++ b/epan/dissectors/packet-btavctp.c
@@ -52,6 +52,7 @@ static int hf_btavctp_number_of_packets = -1;
static gint ett_btavctp = -1;
static expert_field ei_btavctp_unexpected_frame = EI_INIT;
+static expert_field ei_btavctp_invalid_profile = EI_INIT;
static dissector_table_t avctp_service_dissector_table;
@@ -131,6 +132,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
proto_item *ti;
proto_tree *btavctp_tree;
proto_item *pitem;
+ proto_item *ipid_item;
btavctp_data_t *avctp_data;
btl2cap_data_t *l2cap_data;
tvbuff_t *next_tvb;
@@ -142,6 +144,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
guint number_of_packets = 0;
guint length;
guint i_frame;
+ gboolean ipid = FALSE;
/* Reject the packet if data is NULL */
if (data == NULL)
@@ -174,10 +177,12 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
packet_type = (tvb_get_guint8(tvb, offset) & 0x0C) >> 2;
cr = (tvb_get_guint8(tvb, offset) & 0x02) >> 1 ;
- if (packet_type == PACKET_TYPE_SINGLE || packet_type == PACKET_TYPE_START)
- proto_tree_add_item(btavctp_tree, hf_btavctp_ipid, tvb, offset, 1, ENC_BIG_ENDIAN);
- else
+ if (packet_type == PACKET_TYPE_SINGLE || packet_type == PACKET_TYPE_START) {
+ ipid_item = proto_tree_add_item(btavctp_tree, hf_btavctp_ipid, tvb, offset, 1, ENC_BIG_ENDIAN);
+ ipid = tvb_get_guint8(tvb, offset) & 0x01;
+ } else {
proto_tree_add_item(btavctp_tree, hf_btavctp_rfa, tvb, offset, 1, ENC_BIG_ENDIAN);
+ }
offset++;
if (packet_type == PACKET_TYPE_START) {
@@ -200,6 +205,17 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
offset +=2;
}
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s - Transaction: %u, PacketType: %s",
+ val_to_str_const(cr, cr_vals, "unknown CR"), transaction,
+ val_to_str_const(packet_type, packet_type_vals, "unknown packet type"));
+
+ if (ipid) {
+ expert_add_info(pinfo, ipid_item, &ei_btavctp_invalid_profile);
+ col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "Invalid profile");
+ if (tvb_captured_length_remaining(tvb, offset) == 0)
+ return offset;
+ }
+
avctp_data = wmem_new(wmem_packet_scope(), btavctp_data_t);
avctp_data->cr = cr;
avctp_data->interface_id = l2cap_data->interface_id;
@@ -207,10 +223,6 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
avctp_data->chandle = l2cap_data->chandle;
avctp_data->psm = l2cap_data->psm;
- col_append_fstr(pinfo->cinfo, COL_INFO, "%s - Transaction: %u, PacketType: %s",
- val_to_str_const(cr, cr_vals, "unknown CR"), transaction,
- val_to_str_const(packet_type, packet_type_vals, "unknown packet type"));
-
length = tvb_ensure_length_remaining(tvb, offset);
/* reassembling */
@@ -471,6 +483,7 @@ proto_register_btavctp(void)
static ei_register_info ei[] = {
{ &ei_btavctp_unexpected_frame, { "btavctp.unexpected_frame", PI_PROTOCOL, PI_WARN, "Unexpected frame", EXPFILL }},
+ { &ei_btavctp_invalid_profile, { "btavctp.invalid_profile", PI_PROTOCOL, PI_NOTE, "Invalid Profile", EXPFILL }},
};
/* Decode As handling */