aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-sdp.c
diff options
context:
space:
mode:
authorRobert Jongbloed <robertj@voxlucida.com.au>2018-01-23 10:38:44 +0000
committerAnders Broman <a.broman58@gmail.com>2018-01-24 05:09:31 +0000
commitcde023c3c5a08131495eb2574c00ff1f34cdce55 (patch)
treece3c204e4be9e7b8193691167b9035e22d9653c3 /epan/dissectors/packet-sdp.c
parent99b7776d5f4ec28120cb3d3fd77220c8707b405d (diff)
SDP: Added support for "a=rtcp" and "a=rtcp-mux".
Modern SIP endpoints often use non adjacent, or the same, port for the RTCP protocol as the RTP protocol. This is indicated via attributes in the SDP, which should be used to set up the correct dissector for the correct port on this SIP session. Change-Id: I37bf30b71541b6f924fbda5ac1cb29f3ba171515 Reviewed-on: https://code.wireshark.org/review/25430 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-sdp.c')
-rw-r--r--epan/dissectors/packet-sdp.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c
index 00b6ee15e0..1a3e2cc1eb 100644
--- a/epan/dissectors/packet-sdp.c
+++ b/epan/dissectors/packet-sdp.c
@@ -250,6 +250,7 @@ typedef struct {
transport_proto_t proto; /**< Protocol, parsed from "m=" line. */
gboolean is_video; /**< Whether "m=video" */
guint16 media_port; /**< Port number, parsed from "m=" line. */
+ guint16 control_port; /**< Port number, parsed from "a=rtcp" or "a=rtcp-mux" line. */
address conn_addr; /**< The address from the "c=" line (default
from session level, possibly overridden at
the media level). */
@@ -1541,6 +1542,8 @@ typedef struct {
#define SDP_ED137_TYPE 8
#define SDP_ED137_TXRXMODE 9
#define SDP_ED137_FID 10
+#define SDP_RTCP 11
+#define SDP_RTCP_MUX 12
static const sdp_names_t sdp_media_attribute_names[] = {
{ "Unknown-name"}, /* 0 Pad so that the real headers start at index 1 */
@@ -1554,6 +1557,8 @@ static const sdp_names_t sdp_media_attribute_names[] = {
{ "type" }, /* 8 */
{ "txrxmode" }, /* 9 */
{ "fid" }, /* 10 */
+ { "rtcp" }, /* 11 */
+ { "rtcp-mux" }, /* 12 */
};
static gint find_sdp_media_attribute_names(tvbuff_t *tvb, int offset, guint len)
@@ -2036,6 +2041,13 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto
proto_tree_add_item(sdp_media_attribute_tree, hf_media_attribute_value,
tvb, offset, -1, ENC_UTF_8|ENC_NA);
break;
+ case SDP_RTCP :
+ if (!ws_strtou16(attribute_value, NULL, &media_desc->control_port))
+ media_desc->control_port = 0; /* Just use default, if not legal port */
+ break;
+ case SDP_RTCP_MUX :
+ media_desc->control_port = media_desc->media_port;
+ break;
default:
/* No special treatment for values of this attribute type, just add as one item. */
proto_tree_add_item(sdp_media_attribute_tree, hf_media_attribute_value,
@@ -2096,6 +2108,9 @@ complete_descriptions(transport_info_t *transport_info, guint answer_offset)
for (guint i = answer_offset; i < media_count; i++) {
media_description_t *media_desc = &media_descs[i];
+ if (media_desc->control_port == 0)
+ media_desc->control_port = media_desc->media_port + 1;
+
/* If this is an answer to a previous offer... */
if (answer_offset > 0) {
/* A zero port removes the media stream (RFC 3264, Section 8.2) */
@@ -2197,18 +2212,18 @@ apply_sdp_transport(packet_info *pinfo, transport_info_t *transport_info, int re
/* SPRT might use the same port... */
current_rtp_port = media_desc->media_port;
- if (rtcp_handle) {
+ if (rtcp_handle && media_desc->media_port != media_desc->control_port) {
if (media_desc->proto == SDP_PROTO_SRTP) {
DPRINT(("calling rtcp_add_address, channel=%d, media_port=%d",
- i, media_desc->media_port+1));
+ i, media_desc->control_port));
DINDENT();
- srtcp_add_address(pinfo, &media_desc->conn_addr, media_desc->media_port+1, 0, "SDP", establish_frame, srtp_info);
+ srtcp_add_address(pinfo, &media_desc->conn_addr, media_desc->control_port, 0, "SDP", establish_frame, srtp_info);
DENDENT();
} else {
DPRINT(("calling rtcp_add_address, channel=%d, media_port=%d",
- i, media_desc->media_port+1));
+ i, media_desc->control_port));
DINDENT();
- rtcp_add_address(pinfo, &media_desc->conn_addr, media_desc->media_port+1, 0, "SDP", establish_frame);
+ rtcp_add_address(pinfo, &media_desc->conn_addr, media_desc->control_port, 0, "SDP", establish_frame);
DENDENT();
}
}