diff options
author | Michal Labedzki <michal.labedzki@tieto.com> | 2014-04-10 17:46:25 +0200 |
---|---|---|
committer | Michal Labedzki <michal.labedzki@tieto.com> | 2014-05-30 11:25:35 +0000 |
commit | e3473c921fe1780b23cb0f046d0c2a7558743518 (patch) | |
tree | 8e39d888465ad603b82cd10aa24270c342dfd6e3 /epan/dissectors/packet-btavdtp.c | |
parent | 2abc54158dd6c7c66680ddddb9927501d9e12d50 (diff) |
Bluetooth: AVDTP: Upgrade session logic
To correctly resolve connections single "ID" value
like L2CAP PSM, is not enough, because next connection may use
the same PSM value. Solution is save frame number of frame that
make disconnection.
Conclusion:
Any session key values should be updated to pair:
{ID_1, disconnect_in_frame}, {ID_2, disconnect_in_frame}...
then we should check if "disconnect_in_frame" is greater then
current frame number, otherwise it is not valid session.
Change-Id: I3d760112b6e53358a93c994f4aae455ac1bf5de6
Reviewed-on: https://code.wireshark.org/review/1878
Tested-by: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'epan/dissectors/packet-btavdtp.c')
-rw-r--r-- | epan/dissectors/packet-btavdtp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/epan/dissectors/packet-btavdtp.c b/epan/dissectors/packet-btavdtp.c index d6471930dd..ce68ae3165 100644 --- a/epan/dissectors/packet-btavdtp.c +++ b/epan/dissectors/packet-btavdtp.c @@ -509,6 +509,7 @@ typedef struct _channels_info_t { gboolean media_is_local_psm; wmem_tree_t *stream_numbers; guint32 disconnect_in_frame; + guint32 *l2cap_disconnect_in_frame; sep_entry_t *sep; } channels_info_t; @@ -1136,7 +1137,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) subtree = (wmem_tree_t *) wmem_tree_lookup32_array(channels, key); channels_info = (subtree) ? (channels_info_t *) wmem_tree_lookup32_le(subtree, frame_number) : NULL; - if (!(channels_info && channels_info->disconnect_in_frame >= pinfo->fd->num)) { + if (!(channels_info && *channels_info->l2cap_disconnect_in_frame >= pinfo->fd->num && channels_info->disconnect_in_frame >= pinfo->fd->num)) { channels_info = (channels_info_t *) wmem_new (wmem_file_scope(), channels_info_t); channels_info->control_scid = l2cap_data->scid; @@ -1144,6 +1145,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) channels_info->media_scid = -1; channels_info->media_dcid = -1; channels_info->disconnect_in_frame = G_MAXUINT32; + channels_info->l2cap_disconnect_in_frame = l2cap_data->disconnect_in_frame; channels_info->sep = NULL; if (!pinfo->fd->flags.visited) { @@ -1582,7 +1584,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) break; } if (!pinfo->fd->flags.visited && message_type == MESSAGE_TYPE_ACCEPT && - channels_info->disconnect_in_frame == G_MAXUINT32) { + channels_info->disconnect_in_frame > pinfo->fd->num) { channels_info->disconnect_in_frame = pinfo->fd->num; } break; @@ -1619,7 +1621,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) break; } if (!pinfo->fd->flags.visited && message_type == MESSAGE_TYPE_ACCEPT && - channels_info->disconnect_in_frame == G_MAXUINT32) { + channels_info->disconnect_in_frame > pinfo->fd->num) { channels_info->disconnect_in_frame = pinfo->fd->num; } break; |