ua3g: moved setup of rtp/rtcp conversations from packet-ua to packet-ua3g, where the start-rtp message is actually decoded.

Change-Id: Id0dc39107f43680f082d5e6a1d8a1d4940640a13
Reviewed-on: https://code.wireshark.org/review/27792
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Nicolas BERTIN 2018-05-24 22:26:27 +02:00 committed by Anders Broman
parent 9830c5f7f9
commit 31663c4056
2 changed files with 38 additions and 70 deletions

View File

@ -12,10 +12,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/prefs.h>
#include "packet-rtp.h"
#include "packet-rtcp.h"
#include "packet-uaudp.h"
void proto_register_ua_msg(void);
@ -31,8 +28,6 @@ static dissector_table_t ua_opcode_dissector_table;
static int proto_ua_msg = -1;
static gint ett_ua_msg = -1;
static gboolean setup_conversations_enabled = TRUE;
static dissector_handle_t noe_handle;
static dissector_handle_t ua3g_handle;
@ -167,57 +162,8 @@ static void _dissect_ua_msg(tvbuff_t *tvb,
while (tvb_offset_exists(tvb, offset))
{
gint length;
gint opcode;
length = tvb_get_letohs(tvb, offset) + 2;
opcode = tvb_get_guint8(tvb, offset+2);
/* RTP/RTCP conversation setup */
if (setup_conversations_enabled && (opcode==0x13) && (tvb_get_guint8(tvb, offset+3)==0x01))
{
address remote_rtp_addr;
guint32 remote_rtp_port;
gint suboffset;
remote_rtp_addr.data = NULL;
remote_rtp_port = 0;
/* StartRTP */
suboffset = offset + 5;
while (suboffset < offset+length)
{
switch (tvb_get_guint8(tvb, suboffset))
{
case 0x00: /* local port */
{
/*local_rtp_port = tvb_get_ntohs(tvb, suboffset+2);*/
break;
}
case 0x01: /* remote IP */
{
set_address_tvb(&remote_rtp_addr, AT_IPv4, 4, tvb, suboffset+2);
break;
}
case 0x02: /* remote port */
{
remote_rtp_port = tvb_get_ntohs(tvb, suboffset+2);
break;
}
}
suboffset += tvb_get_guint8(tvb, suboffset+1) + 2;
}
if ((remote_rtp_addr.data != NULL) && (remote_rtp_port != 0))
{
rtp_add_address(pinfo, PT_UDP, &remote_rtp_addr, remote_rtp_port, 0,
"UA", pinfo->num, 0, NULL);
rtcp_add_address(pinfo, &remote_rtp_addr, remote_rtp_port+1, 0,
"UA", pinfo->num);
}
}
gint length = tvb_get_letohs(tvb, offset) + 2;
gint opcode = tvb_get_guint8(tvb, offset+2);
uadecode(direction, ua_msg_tree, pinfo, tvb, offset, opcode, length);
@ -245,8 +191,6 @@ static int dissect_ua_term_to_sys(tvbuff_t *tvb, packet_info *pinfo, proto_tree
void proto_register_ua_msg(void)
{
module_t *ua_msg_module;
static gint *ett[] =
{
&ett_ua_msg,
@ -260,14 +204,6 @@ void proto_register_ua_msg(void)
/* Common subtree array registration */
proto_register_subtree_array(ett, array_length(ett));
/* Register preferences */
ua_msg_module = prefs_register_protocol(proto_ua_msg, NULL);
prefs_register_bool_preference(ua_msg_module, "setup_conversations",
"Setup RTP/RTCP conversations on Start RTP",
"Setup RTP/RTCP conversations when parsing Start RTP messages",
&setup_conversations_enabled);
}
void proto_reg_handoff_ua_msg(void)

View File

@ -12,7 +12,12 @@
#include "config.h"
#include "epan/packet.h"
#include <epan/packet.h>
#include <epan/prefs.h>
#include "packet-rtp.h"
#include "packet-rtcp.h"
#include "packet-uaudp.h"
void proto_register_ua3g(void);
@ -25,7 +30,6 @@ void proto_reg_handoff_ua3g(void);
static dissector_table_t ua3g_opcode_dissector_table;
#endif
static int proto_ua3g = -1;
static gint ett_ua3g = -1;
static gint ett_ua3g_body = -1;
@ -35,6 +39,8 @@ static gint ett_ua3g_option = -1;
static gint ett_ua3g_beep_beep_destination = -1;
static gint ett_ua3g_note = -1;
static gboolean setup_conversations_enabled = TRUE;
static int hf_ua3g_length = -1;
static int hf_ua3g_opcode_sys = -1;
static int hf_ua3g_opcode_term = -1;
@ -1201,6 +1207,9 @@ decode_ip_device_routing(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
}
case 0x01: /* START RTP */
{
address remote_rtp_addr = ADDRESS_INIT_NONE;
guint32 remote_rtp_port = 0;
proto_tree_add_item(ua3g_body_tree, hf_ua3g_ip_device_routing_start_rtp_direction, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
length--;
@ -1227,8 +1236,10 @@ decode_ip_device_routing(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
case 0x01: /* Remote IP Address */
case 0x11: /* Destination For RTCP Sender Reports - IP Address */
case 0x13: /* Destination For RTCP Receiver Reports - IP Address */
proto_tree_add_item(ua3g_param_tree, hf_ua3g_ip_device_routing_start_rtp_parameter_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
break;
if (parameter_id == 0x01)
set_address_tvb(&remote_rtp_addr, AT_IPv4, 4, tvb, offset);
proto_tree_add_item(ua3g_param_tree, hf_ua3g_ip_device_routing_start_rtp_parameter_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
break;
case 0x04: /* Compressor */
if (parameter_length <= 8) {
proto_tree_add_item(ua3g_param_tree, hf_ua3g_ip_device_routing_start_rtp_parameter_compressor, tvb, offset, parameter_length, ENC_BIG_ENDIAN);
@ -1279,6 +1290,8 @@ decode_ip_device_routing(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
break;
case 0x00: /* Local UDP Port */
case 0x02: /* Remote UDP Port */
if (parameter_id == 0x02)
remote_rtp_port = tvb_get_ntohs(tvb, offset);
case 0x03: /* Type Of Service */
case 0x05: /* Payload Concatenation */
case 0x08: /* 802.1 Q User Priority */
@ -1311,6 +1324,15 @@ decode_ip_device_routing(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
length -= parameter_length;
}
}
if (setup_conversations_enabled)
{
if ((remote_rtp_addr.data != NULL) && (remote_rtp_port != 0))
{
rtp_add_address(pinfo, PT_UDP, &remote_rtp_addr, remote_rtp_port, 0, "UA3G", pinfo->num, 0, NULL);
rtcp_add_address(pinfo, &remote_rtp_addr, remote_rtp_port+1, 0, "UA3G", pinfo->num);
}
}
break;
}
case 0x02: /* STOP_RTP */
@ -4742,9 +4764,19 @@ proto_register_ua3g(void)
&ett_ua3g_note,
};
module_t *ua3g_module;
/* UA3G dissector registration */
proto_ua3g = proto_register_protocol("UA3G Message", "UA3G", "ua3g");
/* Register preferences */
ua3g_module = prefs_register_protocol(proto_ua3g, NULL);
prefs_register_bool_preference(ua3g_module, "setup_conversations",
"Setup RTP/RTCP conversations on Start RTP",
"Setup RTP/RTCP conversations when parsing Start RTP messages",
&setup_conversations_enabled);
proto_register_field_array(proto_ua3g, hf, array_length(hf));
register_dissector("ua3g", dissect_ua3g, proto_ua3g);