aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-sdp.c
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2014-03-06 17:20:48 -0500
committerEvan Huus <eapache@gmail.com>2014-03-12 17:59:51 +0000
commitc4c83502849ec2e0a2544e494647641d6c16dc4f (patch)
treea2b0dc165f37afcf6f7c8361b5bdbac903b4fc65 /epan/dissectors/packet-sdp.c
parent70ff7be1e6735cd9b00bfeb1c23bf19cf1250c01 (diff)
Fix bug 9021: 'RTP not decoded inside the conversation in v.1.10.1'
The behavior for SIP/SDP handling of RTP conversation tracking changed in v1.10, with some unintended consequences. The bugs did not show up at the time because wireshark makes 2 passes of the packet list, and so the problems auto-corrected themselves in most cases. Unfortunately, a change in r53641 modified how UDP behaves, making it always create conversations for UDP packets, and that exposed the bugs inherent in the SIP/SDP code changes. This commit reverts the behavior of SIP/SDP to its pre-1.10 model, but creates a new preference setting for "Delay SDP changes for tracking media", which if enabled, will turn on the new (but buggy) model introduced in 1.10. This preference is *disabled* by default, since for a majority of cases the new behavior is worse than the previous behavior. The preference, and this commit's fix, is not intended to last long. I intend to re-write the SIP/SDP/RTP interaction model for release 1.11 - I think it's too big a change for 1.10, however, which is why I submitted this commit. Change-Id: Ic5601749d6c2344e952ced8206dd9296bfdc4b90 Reviewed-on: https://code.wireshark.org/review/543 Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-sdp.c')
-rw-r--r--epan/dissectors/packet-sdp.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c
index 939b356ce1..d7cbaa62b2 100644
--- a/epan/dissectors/packet-sdp.c
+++ b/epan/dissectors/packet-sdp.c
@@ -1684,7 +1684,8 @@ convert_disposable_media(transport_info_t* transport_info, disposable_media_info
}
void
-setup_sdp_transport(tvbuff_t *tvb, packet_info *pinfo, enum sdp_exchange_type exchange_type, int request_frame)
+setup_sdp_transport(tvbuff_t *tvb, packet_info *pinfo, enum sdp_exchange_type exchange_type,
+ int request_frame, const gboolean delay)
{
gint offset = 0, next_offset, n;
int linelen;
@@ -1736,6 +1737,18 @@ setup_sdp_transport(tvbuff_t *tvb, packet_info *pinfo, enum sdp_exchange_type ex
if (transport_info->media_count > 0)
start_transport_info_count = transport_info->media_count;
+ /* if we don't delay, and this is an answer after a previous offer, then
+ we free'd the unused media rtp_dyn_payload last time while processing
+ the offer, so we need to re-create them this time in case we need them.
+ If they don't get used they'll get free'd again later */
+ if (!delay && (exchange_type == SDP_EXCHANGE_ANSWER_ACCEPT) &&
+ (transport_info->sdp_status == SDP_EXCHANGE_OFFER)) {
+ for (n = start_transport_info_count; n < SDP_MAX_RTP_CHANNELS; n++) {
+ if (!transport_info->media[n].rtp_dyn_payload)
+ transport_info->media[n].rtp_dyn_payload = g_hash_table_new(g_int_hash, g_int_equal);
+ }
+ }
+
/*
* Show the SDP message a line at a time.
*/
@@ -1815,8 +1828,8 @@ setup_sdp_transport(tvbuff_t *tvb, packet_info *pinfo, enum sdp_exchange_type ex
convert_disposable_media(transport_info, &media_info, start_transport_info_count);
/* We have a successful negotiation, apply data to their respective protocols */
- if ((exchange_type == SDP_EXCHANGE_ANSWER_ACCEPT) &&
- (transport_info->sdp_status == SDP_EXCHANGE_OFFER)) {
+ if (!delay || ((exchange_type == SDP_EXCHANGE_ANSWER_ACCEPT) &&
+ (transport_info->sdp_status == SDP_EXCHANGE_OFFER))) {
for (n = 0; n <= transport_info->media_count; n++) {
guint32 current_rtp_port = 0;
@@ -1920,7 +1933,7 @@ setup_sdp_transport(tvbuff_t *tvb, packet_info *pinfo, enum sdp_exchange_type ex
}
}
}
- transport_info->sdp_status = SDP_EXCHANGE_ANSWER_ACCEPT;
+ transport_info->sdp_status = exchange_type;
} else if ((exchange_type == SDP_EXCHANGE_ANSWER_REJECT) &&
(transport_info->sdp_status != SDP_EXCHANGE_ANSWER_REJECT)) {