aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rtps.c
diff options
context:
space:
mode:
authorIsmael Mendez Matamoros <ismael@rti.com>2018-06-25 13:44:55 +0200
committerAnders Broman <a.broman58@gmail.com>2018-06-28 06:11:56 +0000
commita78026d33f9bb91b5fcbba3848419c0a07a9875b (patch)
tree5aa9924dc9db11058c483562aa758b3accb39b69 /epan/dissectors/packet-rtps.c
parentca423314373b0a4ce7d6bc1cf94c4995e1263ea2 (diff)
rtps: Fixed multichannel locator fields order
Change-Id: Ib84b659022f9dfb64f5869410c85c64193a3c3f8 Reviewed-on: https://code.wireshark.org/review/28425 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-rtps.c')
-rw-r--r--epan/dissectors/packet-rtps.c68
1 files changed, 67 insertions, 1 deletions
diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c
index e7cd4d613d..17b8312307 100644
--- a/epan/dissectors/packet-rtps.c
+++ b/epan/dissectors/packet-rtps.c
@@ -1932,6 +1932,72 @@ int rtps_util_add_locator_list(proto_tree *tree, packet_info *pinfo, tvbuff_t *t
return offset;
}
+/* ------------------------------------------------------------------------- */
+/* Insert in the protocol tree the next bytes interpreted as a list of
+* multichannel Locators:
+* - unsigned long numLocators
+* - locator 1
+* - locator 2
+* - ...
+* - locator n
+* Returns the new offset after parsing the locator list
+*/
+int rtps_util_add_multichannel_locator_list(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
+ gint offset, const guint8 *label, const guint encoding) {
+
+ proto_tree *locator_tree;
+ guint32 num_locators;
+
+ num_locators = tvb_get_guint32(tvb, offset, encoding);
+ locator_tree = proto_tree_add_subtree_format(tree, tvb, offset, 4,
+ ett_rtps_locator_udp_v4, NULL, "%s: %d Locators", label, num_locators);
+
+ offset += 4;
+ if (num_locators > 0) {
+ guint32 i;
+ for (i = 0; i < num_locators; ++i) {
+ proto_tree *ti, *locator_item_tree;
+ guint32 kind;
+ gint32 port;
+ gchar *channel_address;
+ locator_item_tree = proto_tree_add_subtree(locator_tree, tvb, offset, 24, ett_rtps_locator,
+ NULL, label);
+ proto_tree_add_item_ret_uint(locator_item_tree, hf_rtps_locator_kind, tvb, offset, 4, encoding, &kind);
+ switch (kind) {
+ case LOCATOR_KIND_UDPV4:
+ case LOCATOR_KIND_TUDPV4: {
+ proto_tree_add_item(locator_item_tree, hf_rtps_locator_ipv4, tvb, offset + 16, 4,
+ ENC_BIG_ENDIAN);
+ channel_address = tvb_ip_to_str(tvb, offset + 16);
+ break;
+ }
+ case LOCATOR_KIND_UDPV6: {
+ proto_tree_add_item(locator_tree, hf_rtps_locator_ipv6, tvb, offset + 4, 16, ENC_NA);
+ channel_address = tvb_ip6_to_str(tvb, offset + 4);
+ proto_item_append_text(tree, " (%s, %s)",
+ val_to_str(kind, rtps_locator_kind_vals, "%02x"),
+ tvb_ip6_to_str(tvb, offset + 4));
+ break;
+ }
+ /* Default case, Multichannel locators only should be present in UDPv4 and UDPv6 transports
+ * Unknown address format.
+ * */
+ default:
+ offset += 24;
+ continue;
+ break;
+ }
+ ti = proto_tree_add_item_ret_int(locator_item_tree, hf_rtps_locator_port, tvb, offset + 20, 4, encoding, &port);
+ if (port == 0)
+ expert_add_info(pinfo, ti, &ei_rtps_locator_port);
+ proto_item_append_text(tree, " (%s, %s:%d)",
+ val_to_str(kind, rtps_locator_kind_vals, "%02x"),
+ channel_address, port);
+ offset += 24;
+ }
+ }
+ return offset;
+}
/* ------------------------------------------------------------------------- */
/* Insert in the protocol tree the next 4 bytes interpreted as IPV4Address_t
@@ -4708,7 +4774,7 @@ static gboolean dissect_parameter_sequence_rti_dds(proto_tree *rtps_parameter_tr
old_offset = off;
channel_tree = proto_tree_add_subtree_format(rtps_parameter_tree, tvb, off, 0, ett_rtps_locator_filter_channel, &ti_channel, "Channel[%u]", ch);
- off = rtps_util_add_locator_list(channel_tree, pinfo, tvb, off, temp_buff, encoding);
+ off = rtps_util_add_multichannel_locator_list(channel_tree, pinfo, tvb, off, temp_buff, encoding);
/* Filter expression */
off = rtps_util_add_string(rtps_parameter_tree, tvb, off, hf_rtps_locator_filter_list_filter_exp, encoding);