diff options
author | David Ameiss <netshark@ameissnet.com> | 2014-04-22 11:30:54 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-04-23 15:22:53 +0000 |
commit | 1a1abf952373e4b6ce2ca6513e05c61904b563c9 (patch) | |
tree | 9ca3a7d8b8d943b02627b0ad7c3d166b7e58be26 /epan/dissectors | |
parent | abbcaabccc111041c79e8e18314c93aef0f98483 (diff) |
Conversation/memory scope fixes for LBM dissectors. See bug 9718.
Change-Id: I58aa249d73ab44f5f56b1559b38b216cdb542ecb
Reviewed-on: https://code.wireshark.org/review/1280
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-lbm.c | 15 | ||||
-rw-r--r-- | epan/dissectors/packet-lbm.h | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-lbmc.c | 19 | ||||
-rw-r--r-- | epan/dissectors/packet-lbmr.c | 44 | ||||
-rw-r--r-- | epan/dissectors/packet-lbtrm.c | 116 | ||||
-rw-r--r-- | epan/dissectors/packet-lbtru.c | 106 | ||||
-rw-r--r-- | epan/dissectors/packet-lbttcp.c | 6 |
7 files changed, 154 insertions, 164 deletions
diff --git a/epan/dissectors/packet-lbm.c b/epan/dissectors/packet-lbm.c index 9a4fe604f6..347a09be1f 100644 --- a/epan/dissectors/packet-lbm.c +++ b/epan/dissectors/packet-lbm.c @@ -29,9 +29,6 @@ void proto_register_lbm(void); -/* Protocol handle */ -static int lbm_protocol_handle = -1; - /*----------------------------------------------------------------------------*/ /* Value translation tables. */ /*----------------------------------------------------------------------------*/ @@ -68,8 +65,6 @@ static void lbm_init(void) /* Register all the bits needed with the filtering engine */ void proto_register_lbm(void) { - lbm_protocol_handle = proto_register_protocol("LBM Protocol", "LBM", "lbm"); /* XXX: not used/needed ? */ - register_init_routine(lbm_init); } @@ -209,16 +204,6 @@ gboolean lbm_channel_is_known(guint64 channel) return (!lbm_channel_is_unknown_transport_lbttcp(channel) && !lbm_channel_is_unknown_stream_tcp(channel)); } -#if 0 /* XXX:not used ?? */ -guint64 lbm_channel_id(guint64 channel) -{ - guint64 id; - - id = (channel & LBM_CHANNEL_VALUE_MASK) >> LBM_CHANNEL_VALUE_SHIFT_COUNT; - return (id); -} -#endif - /*----------------------------------------------------------------------------*/ /* Frame/SQN interface. */ /*----------------------------------------------------------------------------*/ diff --git a/epan/dissectors/packet-lbm.h b/epan/dissectors/packet-lbm.h index 6229fd7792..d1d6bf2f6f 100644 --- a/epan/dissectors/packet-lbm.h +++ b/epan/dissectors/packet-lbm.h @@ -219,6 +219,18 @@ typedef struct #define LBTRU_PACKET_TYPE_CREQ 0x06 #define LBTRU_PACKET_TYPE_RST 0x07 +/* LBT-RU NCF reason types */ +#define LBTRU_NCF_REASON_NO_RETRY 0x0 +#define LBTRU_NCF_REASON_IGNORED 0x1 +#define LBTRU_NCF_REASON_RX_DELAY 0x2 +#define LBTRU_NCF_REASON_SHED 0x3 + +/* LBT-RU CREQ types */ +#define LBTRU_CREQ_REQUEST_SYN 0x0 + +/* LBT-RU RST reasons */ +#define LBTRU_RST_REASON_DEFAULT 0x0 + gboolean lbmc_test_lbmc_header(tvbuff_t * tvb, int offset); int lbmc_dissect_lbmc_packet(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, const char * tag_name, guint64 channel); int lbmc_get_minimum_length(void); diff --git a/epan/dissectors/packet-lbmc.c b/epan/dissectors/packet-lbmc.c index c9eb41a3bd..100a908f23 100644 --- a/epan/dissectors/packet-lbmc.c +++ b/epan/dissectors/packet-lbmc.c @@ -10556,9 +10556,10 @@ static const gchar * lbmc_determine_msg_type(const guint8 * header_array) static lbm_uim_stream_info_t * lbmc_dup_stream_info(const lbm_uim_stream_info_t * info) { + /* Returns a packet-scoped copy. */ lbm_uim_stream_info_t * ptr = NULL; - ptr = wmem_new(wmem_file_scope(), lbm_uim_stream_info_t); + ptr = wmem_new(wmem_packet_scope(), lbm_uim_stream_info_t); ptr->channel = info->channel; ptr->sqn = info->sqn; ptr->endpoint_a.type = info->endpoint_a.type; @@ -10579,7 +10580,7 @@ static lbm_uim_stream_info_t * lbmc_dup_stream_info(const lbm_uim_stream_info_t { ptr->endpoint_b.stream_info.dest = info->endpoint_b.stream_info.dest; } - ptr->description = wmem_strdup(wmem_file_scope(), info->description); + ptr->description = wmem_strdup(wmem_packet_scope(), info->description); return (ptr); } @@ -11272,15 +11273,15 @@ int lbmc_dissect_lbmc_packet(tvbuff_t * tvb, int offset, packet_info * pinfo, pr PROTO_ITEM_SET_GENERATED(pi); proto_tree_move_item(subtree, last_initial_item, stream_item); - stream_tap_info = wmem_new(wmem_file_scope(), lbm_uim_stream_tap_info_t); + stream_tap_info = wmem_new0(wmem_packet_scope(), lbm_uim_stream_tap_info_t); stream_tap_info->channel = inst_stream->channel; stream_tap_info->substream_id = inst_substream->substream_id; stream_tap_info->bytes = msglen; stream_tap_info->endpoint_a.type = lbm_uim_instance_stream; - memcpy((void *)stream_tap_info->endpoint_a.stream_info.ctxinst.ctxinst, (void *)stream_info.ctxinst, LBM_CONTEXT_INSTANCE_BLOCK_SZ); + memcpy((void *) stream_tap_info->endpoint_a.stream_info.ctxinst.ctxinst, (void *)stream_info.ctxinst, LBM_CONTEXT_INSTANCE_BLOCK_SZ); stream_tap_info->endpoint_b.type = lbm_uim_instance_stream; - memcpy((void *)stream_tap_info->endpoint_b.stream_info.ctxinst.ctxinst, (void *)ctxinstd_info.ctxinst, LBM_CONTEXT_INSTANCE_BLOCK_SZ); - tap_queue_packet(lbmc_stream_tap_handle, pinfo, (void *)stream_tap_info); + memcpy((void *) stream_tap_info->endpoint_b.stream_info.ctxinst.ctxinst, (void *)ctxinstd_info.ctxinst, LBM_CONTEXT_INSTANCE_BLOCK_SZ); + tap_queue_packet(lbmc_stream_tap_handle, pinfo, (void *) stream_tap_info); } uim_stream_info.channel = inst_stream->channel; uim_stream_info.sqn = stream_info.sqn; @@ -11322,7 +11323,7 @@ int lbmc_dissect_lbmc_packet(tvbuff_t * tvb, int offset, packet_info * pinfo, pr PROTO_ITEM_SET_GENERATED(pi); proto_tree_move_item(subtree, last_initial_item, stream_item); - stream_tap_info = wmem_new(wmem_file_scope(), lbm_uim_stream_tap_info_t); + stream_tap_info = wmem_new0(wmem_packet_scope(), lbm_uim_stream_tap_info_t); stream_tap_info->channel = dom_stream->channel; stream_tap_info->substream_id = dom_substream->substream_id; stream_tap_info->bytes = msglen; @@ -11330,7 +11331,7 @@ int lbmc_dissect_lbmc_packet(tvbuff_t * tvb, int offset, packet_info * pinfo, pr stream_tap_info->endpoint_a.stream_info.dest = destination_info.endpoint_a; stream_tap_info->endpoint_b.type = lbm_uim_domain_stream; stream_tap_info->endpoint_b.stream_info.dest = destination_info.endpoint_b; - tap_queue_packet(lbmc_stream_tap_handle, pinfo, (void *)stream_tap_info); + tap_queue_packet(lbmc_stream_tap_handle, pinfo, (void *) stream_tap_info); } uim_stream_info.channel = dom_stream->channel; uim_stream_info.sqn = stream_info.sqn; @@ -11597,6 +11598,7 @@ int lbmc_dissect_lbmc_packet(tvbuff_t * tvb, int offset, packet_info * pinfo, pr { puim_stream_info->description = "DATA"; } + /* The dup is needed since there may be multiple stream infos per packet. */ msg_info = lbmc_dup_stream_info(puim_stream_info); tap_queue_packet(lbmc_uim_tap_handle, pinfo, (void *)msg_info); } @@ -11616,6 +11618,7 @@ int lbmc_dissect_lbmc_packet(tvbuff_t * tvb, int offset, packet_info * pinfo, pr lbm_uim_stream_info_t * msg_info; puim_stream_info->description = msg_type; + /* The dup is needed since there may be multiple stream infos per packet. */ msg_info = lbmc_dup_stream_info(puim_stream_info); tap_queue_packet(lbmc_uim_tap_handle, pinfo, (void *)msg_info); } diff --git a/epan/dissectors/packet-lbmr.c b/epan/dissectors/packet-lbmr.c index 0bbcd509c9..398c3c01b1 100644 --- a/epan/dissectors/packet-lbmr.c +++ b/epan/dissectors/packet-lbmr.c @@ -38,6 +38,8 @@ #include <epan/stats_tree.h> #include <epan/expert.h> #include <epan/uat.h> +#include <epan/value_string.h> +#include <epan/wmem/wmem.h> #include <epan/to_str.h> #include <wsutil/inet_aton.h> #include <wsutil/pint.h> @@ -1820,13 +1822,6 @@ static const value_string lbmr_pser_dependent_type[] = { 0x0, NULL } }; -#if 0 -static const value_string lbmr_unknown_dependent_type[] = -{ - { 0x0, NULL } -}; -#endif - static const value_string lbmr_option_type[] = { { LBMR_LBMR_OPT_LEN_TYPE, "Option length" }, @@ -2787,8 +2782,8 @@ static void add_contents_tqr(lbmr_contents_t * contents, const char * topic) { tqr_node_t * node = NULL; - node = wmem_new(wmem_file_scope(), tqr_node_t); - node->topic = wmem_strdup(wmem_file_scope(), topic); + node = wmem_new(wmem_packet_scope(), tqr_node_t); + node->topic = wmem_strdup(wmem_packet_scope(), topic); node->next = contents->contents.topic.tqr; contents->contents.topic.tqr = node; contents->contents.topic.tqr_count++; @@ -2798,8 +2793,8 @@ static void add_contents_wctqr(lbmr_contents_t * contents, unsigned char type, c { tqr_node_t * node = NULL; - node = wmem_new(wmem_file_scope(), tqr_node_t); - node->topic = wmem_strdup_printf(wmem_file_scope(), "%s (%s)", + node = wmem_new(wmem_packet_scope(), tqr_node_t); + node->topic = wmem_strdup_printf(wmem_packet_scope(), "%s (%s)", pattern, val_to_str(type, lbm_wildcard_pattern_type_short, "UNKN[0x%02x]")); node->next = contents->contents.topic.wctqr; @@ -2811,8 +2806,8 @@ static void add_contents_tir(lbmr_contents_t * contents, const char * topic, cha { tir_node_t * node = NULL; - node = wmem_new(wmem_file_scope(), tir_node_t); - node->topic = wmem_strdup(wmem_file_scope(), topic); + node = wmem_new(wmem_packet_scope(), tir_node_t); + node->topic = wmem_strdup(wmem_packet_scope(), topic); node->source_string = source; node->index = topic_index; node->next = contents->contents.topic.tir; @@ -2824,8 +2819,8 @@ static void add_contents_qqr(lbmr_contents_t * contents, const char * queue) { qqr_node_t * node = NULL; - node = wmem_new(wmem_file_scope(), qqr_node_t); - node->queue = wmem_strdup(wmem_file_scope(), queue); + node = wmem_new(wmem_packet_scope(), qqr_node_t); + node->queue = wmem_strdup(wmem_packet_scope(), queue); node->next = contents->contents.queue.qqr; contents->contents.queue.qqr = node; contents->contents.queue.qqr_count++; @@ -2835,9 +2830,9 @@ static void add_contents_qir(lbmr_contents_t * contents, const char * queue, con { qir_node_t * node = NULL; - node = wmem_new(wmem_file_scope(), qir_node_t); - node->queue = wmem_strdup(wmem_file_scope(), queue); - node->topic = wmem_strdup(wmem_file_scope(), topic); + node = wmem_new(wmem_packet_scope(), qir_node_t); + node->queue = wmem_strdup(wmem_packet_scope(), queue); + node->topic = wmem_strdup(wmem_packet_scope(), topic); node->port = port; node->next = contents->contents.queue.qir; contents->contents.queue.qir = node; @@ -4084,7 +4079,7 @@ static int dissect_lbmr_tir_transport(tvbuff_t * tvb, int offset, lbm_uint8_t tr session_id = 0; len += L_LBMR_TIR_TCP_T; } - lbttcp_transport = lbttcp_transport_add(&(pinfo->src), port, session_id, 0); + lbttcp_transport = lbttcp_transport_add(&(pinfo->src), port, session_id, pinfo->fd->num); channel = lbttcp_transport->channel; add_contents_tir(contents, topic_name, lbttcp_transport_source_string(&(pinfo->src), port, session_id), topic_index); } @@ -4110,7 +4105,7 @@ static int dissect_lbmr_tir_transport(tvbuff_t * tvb, int offset, lbm_uint8_t tr proto_tree_add_item(lbtrm_tree, hf_lbmr_tir_lbtrm_session_id, tvb, offset + O_LBMR_TIR_LBTRM_T_SESSION_ID, L_LBMR_TIR_LBTRM_T_SESSION_ID, ENC_BIG_ENDIAN); proto_tree_add_item(lbtrm_tree, hf_lbmr_tir_lbtrm_udp_dest_port, tvb, offset + O_LBMR_TIR_LBTRM_T_UDP_DEST_PORT, L_LBMR_TIR_LBTRM_T_UDP_DEST_PORT, ENC_BIG_ENDIAN); proto_tree_add_item(lbtrm_tree, hf_lbmr_tir_lbtrm_src_ucast_port, tvb, offset + O_LBMR_TIR_LBTRM_T_SRC_UCAST_PORT, L_LBMR_TIR_LBTRM_T_SRC_UCAST_PORT, ENC_BIG_ENDIAN); - lbtrm_transport = lbtrm_transport_add(&(pinfo->src), src_ucast_port, session_id, &multicast_group, udp_dest_port, 0); + lbtrm_transport = lbtrm_transport_add(&(pinfo->src), src_ucast_port, session_id, &multicast_group, udp_dest_port, pinfo->fd->num); channel = lbtrm_transport->channel; add_contents_tir(contents, topic_name, lbtrm_transport_source_string(&(pinfo->src), src_ucast_port, session_id, &multicast_group, udp_dest_port), topic_index); len += L_LBMR_TIR_LBTRM_T; @@ -4152,7 +4147,7 @@ static int dissect_lbmr_tir_transport(tvbuff_t * tvb, int offset, lbm_uint8_t tr proto_tree_add_item(lbtru_tree, hf_lbmr_tir_lbtru_port, tvb, offset + O_LBMR_TIR_LBTRU_T_PORT, L_LBMR_TIR_LBTRU_T_PORT, ENC_BIG_ENDIAN); len += L_LBMR_TIR_LBTRU_T; } - lbtru_transport = lbtru_transport_add(&(pinfo->src), port, session_id, 0); + lbtru_transport = lbtru_transport_add(&(pinfo->src), port, session_id, pinfo->fd->num); channel = lbtru_transport->channel; add_contents_tir(contents, topic_name, lbtru_transport_source_string(&(pinfo->src), port, session_id), topic_index); } @@ -4341,7 +4336,6 @@ static int dissect_lbmr_qqr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, name = tvb_get_stringz_enc(wmem_packet_scope(), tvb, offset, &namelen, ENC_ASCII); reclen += namelen; add_contents_qqr(contents, name); - proto_tree_add_item(tree, hf_lbmr_qqr_name, tvb, offset, namelen, ENC_ASCII|ENC_NA); return (reclen); } @@ -5504,7 +5498,7 @@ static int dissect_lbmr(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, offset = L_LBMR_HDR_T; total_len_dissected = L_LBMR_HDR_T; - contents = wmem_new0(wmem_file_scope(), lbmr_contents_t); + contents = wmem_new0(wmem_packet_scope(), lbmr_contents_t); switch (type) { case LBMR_HDR_TYPE_QUEUE_RES: @@ -5521,7 +5515,7 @@ static int dissect_lbmr(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, total_len_dissected += len_dissected; offset += len_dissected; } - tap_queue_packet(lbmr_tap_handle, pinfo, contents); + tap_queue_packet(lbmr_tap_handle, pinfo, (void *) contents); break; case LBMR_HDR_TYPE_NORMAL: case LBMR_HDR_TYPE_WC_TQRS: @@ -5546,7 +5540,7 @@ static int dissect_lbmr(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, total_len_dissected += len_dissected; offset += len_dissected; } - tap_queue_packet(lbmr_tap_handle, pinfo, contents); + tap_queue_packet(lbmr_tap_handle, pinfo, (void *) contents); } break; case LBMR_HDR_TYPE_TOPIC_MGMT: diff --git a/epan/dissectors/packet-lbtrm.c b/epan/dissectors/packet-lbtrm.c index a48d400ea9..f956147643 100644 --- a/epan/dissectors/packet-lbtrm.c +++ b/epan/dissectors/packet-lbtrm.c @@ -67,19 +67,12 @@ static lbtrm_transport_t * lbtrm_transport_unicast_find(const address * source_a conversation_t * conv = NULL; wmem_tree_t * session_tree = NULL; - conv = find_conversation(0, source_address, &lbtrm_null_address, PT_UDP, source_port, 0, 0); + conv = find_conversation(frame, source_address, &lbtrm_null_address, PT_UDP, source_port, 0, 0); if (conv != NULL) { - if (frame != 0) + if (frame > conv->last_frame) { - if (conv->setup_frame == 0) - { - conv->setup_frame = frame; - } - if (frame > conv->last_frame) - { - conv->last_frame = frame; - } + conv->last_frame = frame; } session_tree = (wmem_tree_t *) conversation_get_proto_data(conv, proto_lbtrm); if (session_tree != NULL) @@ -90,16 +83,16 @@ static lbtrm_transport_t * lbtrm_transport_unicast_find(const address * source_a return (transport); } -static void lbtrm_transport_unicast_add(const address * source_address, guint16 source_port, guint32 session_id, lbtrm_transport_t * transport) +static void lbtrm_transport_unicast_add(const address * source_address, guint16 source_port, guint32 session_id, guint32 frame, lbtrm_transport_t * transport) { conversation_t * conv = NULL; wmem_tree_t * session_tree = NULL; lbtrm_transport_t * transport_entry = NULL; - conv = find_conversation(0, source_address, &lbtrm_null_address, PT_UDP, source_port, 0, 0); + conv = find_conversation(frame, source_address, &lbtrm_null_address, PT_UDP, source_port, 0, 0); if (conv == NULL) { - conv = conversation_new(0, source_address, &lbtrm_null_address, PT_UDP, source_port, 0, 0); + conv = conversation_new(frame, source_address, &lbtrm_null_address, PT_UDP, source_port, 0, 0); } session_tree = (wmem_tree_t *) conversation_get_proto_data(conv, proto_lbtrm); if (session_tree == NULL) @@ -123,16 +116,9 @@ static lbtrm_transport_t * lbtrm_transport_find(const address * source_address, conv = find_conversation(frame, source_address, multicast_group, PT_UDP, source_port, dest_port, 0); if (conv != NULL) { - if (frame != 0) + if (frame > conv->last_frame) { - if (conv->setup_frame == 0) - { - conv->setup_frame = frame; - } - if (frame > conv->last_frame) - { - conv->last_frame = frame; - } + conv->last_frame = frame; } session_tree = (wmem_tree_t *) conversation_get_proto_data(conv, proto_lbtrm); if (session_tree != NULL) @@ -154,16 +140,9 @@ lbtrm_transport_t * lbtrm_transport_add(const address * source_address, guint16 { conv = conversation_new(frame, source_address, multicast_group, PT_UDP, source_port, dest_port, 0); } - if (frame != 0) + if (frame > conv->last_frame) { - if (conv->setup_frame == 0) - { - conv->setup_frame = frame; - } - if (frame > conv->last_frame) - { - conv->last_frame = frame; - } + conv->last_frame = frame; } session_tree = (wmem_tree_t *) conversation_get_proto_data(conv, proto_lbtrm); if (session_tree == NULL) @@ -194,7 +173,7 @@ lbtrm_transport_t * lbtrm_transport_add(const address * source_address, guint16 entry->data_high_sqn = 0; entry->sm_high_sqn = 0; wmem_tree_insert32(session_tree, session_id, (void *) entry); - lbtrm_transport_unicast_add(source_address, source_port, session_id, entry); + lbtrm_transport_unicast_add(source_address, source_port, session_id, frame, entry); return (entry); } @@ -366,15 +345,23 @@ static lbm_transport_frame_t * lbtrm_transport_frame_add(lbtrm_transport_t * tra return (frame_entry); } -char * lbtrm_transport_source_string(const address * source_address, guint16 source_port, guint32 session_id, const address * multicast_group, guint16 dest_port) +static char * lbtrm_transport_source_string_format(const address * source_address, guint16 source_port, guint32 session_id, const address * multicast_group, guint16 dest_port) { - return (wmem_strdup_printf(wmem_file_scope(), "LBTRM:%s:%" G_GUINT16_FORMAT ":%08x:%s:%" G_GUINT16_FORMAT, address_to_str(wmem_packet_scope(), source_address), source_port, session_id, + /* Returns a packet-scoped string. */ + return (wmem_strdup_printf(wmem_packet_scope(), "LBTRM:%s:%" G_GUINT16_FORMAT ":%08x:%s:%" G_GUINT16_FORMAT, address_to_str(wmem_packet_scope(), source_address), source_port, session_id, address_to_str(wmem_packet_scope(), multicast_group), dest_port)); } +char * lbtrm_transport_source_string(const address * source_address, guint16 source_port, guint32 session_id, const address * multicast_group, guint16 dest_port) +{ + /* Returns a file-scoped string. */ + return (wmem_strdup(wmem_file_scope(), lbtrm_transport_source_string_format(source_address, source_port, session_id, multicast_group, dest_port))); +} + static char * lbtrm_transport_source_string_transport(lbtrm_transport_t * transport) { - return (lbtrm_transport_source_string(&(transport->source_address), transport->source_port, transport->session_id, &(transport->multicast_group), transport->dest_port)); + /* Returns a packet-scoped string. */ + return (lbtrm_transport_source_string_format(&(transport->source_address), transport->source_port, transport->session_id, &(transport->multicast_group), transport->dest_port)); } /*----------------------------------------------------------------------------*/ @@ -927,10 +914,7 @@ static int dissect_lbtrm_ncf_list(tvbuff_t * tvb, int offset, packet_info * pinf { expert_add_info_format(pinfo, sep_ncf_item, &ei_lbtrm_analysis_ncf_ncf, "NCF 0x%08x %s", ncf, val_to_str(reason, lbtrm_ncf_reason, "Unknown (0x%02x)")); } - if (tap_info != NULL) - { - tap_info->sqns[idx] = ncf; - } + tap_info->sqns[idx] = ncf; len += 4; } return (len); @@ -965,12 +949,9 @@ static int dissect_lbtrm_ncf(tvbuff_t * tvb, int offset, packet_info * pinfo, pr { expert_add_info_format(pinfo, reason_item, &ei_lbtrm_analysis_ncf, "NCF %s", val_to_str(LBTRM_NCF_HDR_REASON(reason), lbtrm_ncf_reason, "Unknown (0x%02x)")); } - if (tap_info != NULL) - { - tap_info->ncf_reason = LBTRM_NCF_HDR_REASON(reason); - tap_info->num_sqns = num_ncfs; - tap_info->sqns = wmem_alloc_array(wmem_file_scope(), guint32, num_ncfs); - } + tap_info->ncf_reason = LBTRM_NCF_HDR_REASON(reason); + tap_info->num_sqns = num_ncfs; + tap_info->sqns = wmem_alloc_array(wmem_packet_scope(), guint32, num_ncfs); len += dissect_lbtrm_ncf_list(tvb, offset + len, pinfo, ncf_tree, num_ncfs, LBTRM_NCF_HDR_REASON(reason), tap_info); proto_item_set_len(ncf_item, len); return (len); @@ -1000,10 +981,7 @@ static int dissect_lbtrm_nak_list(tvbuff_t * tvb, int offset, packet_info * pinf { expert_add_info_format(pinfo, sep_nak_item, &ei_lbtrm_analysis_nak_nak, "NAK 0x%08x", nak); } - if (tap_info != NULL) - { - tap_info->sqns[idx] = nak; - } + tap_info->sqns[idx] = nak; len += 4; } return (len); @@ -1026,11 +1004,8 @@ static int dissect_lbtrm_nak(tvbuff_t * tvb, int offset, packet_info * pinfo, pr { expert_add_info(pinfo, nak_item, &ei_lbtrm_analysis_nak); } - if (tap_info != NULL) - { - tap_info->num_sqns = num_naks; - tap_info->sqns = wmem_alloc_array(wmem_file_scope(), guint32, num_naks); - } + tap_info->num_sqns = num_naks; + tap_info->sqns = wmem_alloc_array(wmem_packet_scope(), guint32, num_naks); len += dissect_lbtrm_nak_list(tvb, offset + len, pinfo, nak_tree, num_naks, tap_info); proto_item_set_len(nak_item, len); return (len); @@ -1067,10 +1042,7 @@ static int dissect_lbtrm_sm(tvbuff_t * tvb, int offset, packet_info * pinfo, pro { *sequence = sqn; } - if (tap_info != NULL) - { - tap_info->sqn = sqn; - } + tap_info->sqn = sqn; return (L_LBTRM_SM_HDR_T); } @@ -1086,6 +1058,7 @@ static int dissect_lbtrm_data(tvbuff_t * tvb, int offset, packet_info * pinfo, p proto_item * sqn_item = NULL; guint8 flags; guint32 sqn; + gboolean is_retransmission = FALSE; data_item = proto_tree_add_item(tree, hf_lbtrm_data, tvb, offset, L_LBTRM_DATA_HDR_T, ENC_NA); data_tree = proto_item_add_subtree(data_item, ett_lbtrm_data); @@ -1104,26 +1077,17 @@ static int dissect_lbtrm_data(tvbuff_t * tvb, int offset, packet_info * pinfo, p { *sequence = sqn; } - if (retransmission != NULL) - { - *retransmission = FALSE; - } if ((flags & LBTRM_DATA_RETRANSMISSION_FLAG) != 0) { + is_retransmission = TRUE; expert_add_info_format(pinfo, sqn_item, &ei_lbtrm_analysis_rx, "RX 0x%08x", sqn); - if (retransmission != NULL) - { - *retransmission = TRUE; - } - if (tap_info != NULL) - { - tap_info->retransmission = TRUE; - } } - if (tap_info != NULL) + if (retransmission != NULL) { - tap_info->sqn = sqn; + *retransmission = is_retransmission; } + tap_info->retransmission = is_retransmission; + tap_info->sqn = sqn; return (L_LBTRM_DATA_HDR_T); } @@ -1261,12 +1225,12 @@ static int dissect_lbtrm(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, item = proto_tree_add_string(lbtrm_tree, hf_lbtrm_tag, tvb, 0, 0, tag_name); PROTO_ITEM_SET_GENERATED(item); } + tapinfo = wmem_new0(wmem_packet_scope(), lbm_lbtrm_tap_info_t); if (transport != NULL) { - tapinfo = wmem_new0(wmem_file_scope(), lbm_lbtrm_tap_info_t); tapinfo->transport = lbtrm_transport_source_string_transport(transport); - tapinfo->type = packet_type; } + tapinfo->type = packet_type; hdr_item = proto_tree_add_item(lbtrm_tree, hf_lbtrm_hdr, tvb, O_LBTRM_HDR_T_VER_TYPE, L_LBTRM_HDR_T, ENC_NA); hdr_tree = proto_item_add_subtree(hdr_item, ett_lbtrm_hdr); @@ -1520,9 +1484,9 @@ static int dissect_lbtrm(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, { total_dissected_len += dissect_lbtrm_data_contents(tvb, offset, pinfo, tree, tag_name, channel); } - if (tapinfo != NULL) + if (tapinfo->transport != NULL) { - tap_queue_packet(lbtrm_tap_handle, pinfo, (void *)tapinfo); + tap_queue_packet(lbtrm_tap_handle, pinfo, (void *) tapinfo); } return (total_dissected_len); } diff --git a/epan/dissectors/packet-lbtru.c b/epan/dissectors/packet-lbtru.c index c0d06dc7bb..64a87d8d7e 100644 --- a/epan/dissectors/packet-lbtru.c +++ b/epan/dissectors/packet-lbtru.c @@ -31,6 +31,7 @@ #include <epan/wmem/wmem.h> #include <epan/conversation.h> #include <epan/to_str.h> +#include <epan/tap.h> #include "packet-lbm.h" #include "packet-lbtru.h" @@ -43,6 +44,9 @@ static int proto_lbtru = -1; /* Dissector handle */ static dissector_handle_t lbtru_dissector_handle; +/* Tap handle */ +static int lbtru_tap_handle = -1; + /*----------------------------------------------------------------------------*/ /* LBT-RU transport management. */ /*----------------------------------------------------------------------------*/ @@ -401,21 +405,34 @@ static lbm_transport_frame_t * lbtru_client_transport_frame_add(lbtru_client_tra return (frame_entry); } -char * lbtru_transport_source_string(const address * source_address, guint16 source_port, guint32 session_id) +static char * lbtru_transport_source_string_format(const address * source_address, guint16 source_port, guint32 session_id) { + /* Returns a packet-scoped string. */ char * bufptr = NULL; if (session_id == 0) { - bufptr = wmem_strdup_printf(wmem_file_scope(), "LBT-RU:%s:%" G_GUINT16_FORMAT, address_to_str(wmem_packet_scope(), source_address), source_port); + bufptr = wmem_strdup_printf(wmem_packet_scope(), "LBT-RU:%s:%" G_GUINT16_FORMAT, address_to_str(wmem_packet_scope(), source_address), source_port); } else { - bufptr = wmem_strdup_printf(wmem_file_scope(), "LBT-RU:%s:%" G_GUINT16_FORMAT ":%08x", address_to_str(wmem_packet_scope(), source_address), source_port, session_id); + bufptr = wmem_strdup_printf(wmem_packet_scope(), "LBT-RU:%s:%" G_GUINT16_FORMAT ":%08x", address_to_str(wmem_packet_scope(), source_address), source_port, session_id); } return (bufptr); } +char * lbtru_transport_source_string(const address * source_address, guint16 source_port, guint32 session_id) +{ + /* Returns a file-scoped string. */ + return (wmem_strdup(wmem_file_scope(), lbtru_transport_source_string_format(source_address, source_port, session_id))); +} + +static char * lbtru_transport_source_string_transport(lbtru_transport_t * transport) +{ + /* Returns a packet-scoped string. */ + return (lbtru_transport_source_string(&(transport->source_address), transport->source_port, transport->session_id)); +} + /*----------------------------------------------------------------------------*/ /* Packet layouts. */ /*----------------------------------------------------------------------------*/ @@ -507,10 +524,6 @@ typedef struct #define L_LBTRU_NCF_HDR_T (gint) (sizeof(lbtru_ncf_hdr_t)) #define LBTRU_NCF_SELECTIVE_FORMAT 0x0 -#define LBTRU_NCF_REASON_NO_RETRY 0x0 -#define LBTRU_NCF_REASON_IGNORED 0x1 -#define LBTRU_NCF_REASON_RX_DELAY 0x2 -#define LBTRU_NCF_REASON_SHED 0x3 #define LBTRU_NCF_HDR_REASON(x) ((x & 0xF0) >> 4) #define LBTRU_NCF_HDR_FORMAT(x) (x & 0xF) #define LBTRU_NCF_HDR_REASON_MASK 0xF0 @@ -564,11 +577,6 @@ typedef struct #define LBTRU_NHDR_SID 0x01 #define LBTRU_NHDR_CID 0x02 -/* CREQ and RST use the normal header */ -#define LBTRU_CREQ_REQUEST_SYN 0x0 - -#define LBTRU_RST_REASON_DEFAULT 0x0 - /*----------------------------------------------------------------------------*/ /* Value translation tables. */ /*----------------------------------------------------------------------------*/ @@ -902,7 +910,7 @@ static int dissect_lbtru_data_contents(tvbuff_t * tvb, int offset, packet_info * /*----------------------------------------------------------------------------*/ /* LBT-RU ACK packet dissection functions. */ /*----------------------------------------------------------------------------*/ -static int dissect_lbtru_ack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree) +static int dissect_lbtru_ack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, lbm_lbtru_tap_info_t * tap_info) { proto_tree * ack_tree = NULL; proto_item * ack_item = NULL; @@ -912,13 +920,14 @@ static int dissect_lbtru_ack(tvbuff_t * tvb, int offset, packet_info * pinfo, pr ack_tree = proto_item_add_subtree(ack_item, ett_lbtru_ack); ack = proto_tree_add_item(ack_tree, hf_lbtru_ack_sqn, tvb, offset + O_LBTRU_ACK_HDR_T_ACK_SQN, L_LBTRU_ACK_HDR_T_ACK_SQN, ENC_BIG_ENDIAN); expert_add_info(pinfo, ack, &ei_lbtru_analysis_ack); + tap_info->sqn = tvb_get_ntohl(tvb, offset + O_LBTRU_ACK_HDR_T_ACK_SQN); return (L_LBTRU_ACK_HDR_T); } /*----------------------------------------------------------------------------*/ /* LBT-RU NAK confirmation packet dissection functions. */ /*----------------------------------------------------------------------------*/ -static int dissect_lbtru_ncf_list(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, int ncf_count, int reason) +static int dissect_lbtru_ncf_list(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, int ncf_count, int reason, lbm_lbtru_tap_info_t * tap_info) { proto_tree * ncf_tree = NULL; proto_item * ncf_item = NULL; @@ -939,24 +948,27 @@ static int dissect_lbtru_ncf_list(tvbuff_t * tvb, int offset, packet_info * pinf { expert_add_info_format(pinfo, sep_ncf_item, &ei_lbtru_analysis_ncf_ncf, "NCF 0x%08x %s", ncf, val_to_str(reason, lbtru_ncf_reason, "Unknown (0x%02x)")); } + tap_info->sqns[idx] = ncf; len += (int)sizeof(lbm_uint32_t); } proto_item_set_len(ncf_item, len); return (len); } -static int dissect_lbtru_ncf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree) +static int dissect_lbtru_ncf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, lbm_lbtru_tap_info_t * tap_info) { int len_dissected; - guint16 num_ncfs; guint8 reason_format; proto_tree * ncf_tree = NULL; proto_item * ncf_item = NULL; proto_tree * rf_tree = NULL; proto_item * rf_item = NULL; + guint16 num_ncfs = 0; ncf_item = proto_tree_add_item(tree, hf_lbtru_ncf, tvb, offset, -1, ENC_NA); ncf_tree = proto_item_add_subtree(ncf_item, ett_lbtru_ncf); + reason_format = tvb_get_guint8(tvb, offset + O_LBTRU_NCF_HDR_T_REASON_FORMAT); + num_ncfs = tvb_get_ntohs(tvb, offset + O_LBTRU_NCF_HDR_T_NUM_NCFS); proto_tree_add_item(ncf_tree, hf_lbtru_ncf_trail_sqn, tvb, offset + O_LBTRU_NCF_HDR_T_TRAIL_SQN, L_LBTRU_NCF_HDR_T_TRAIL_SQN, ENC_BIG_ENDIAN); proto_tree_add_item(ncf_tree, hf_lbtru_ncf_num, tvb, offset + O_LBTRU_NCF_HDR_T_NUM_NCFS, L_LBTRU_NCF_HDR_T_NUM_NCFS, ENC_BIG_ENDIAN); proto_tree_add_item(ncf_tree, hf_lbtru_ncf_reserved, tvb, offset + O_LBTRU_NCF_HDR_T_RESERVED, L_LBTRU_NCF_HDR_T_RESERVED, ENC_BIG_ENDIAN); @@ -965,13 +977,14 @@ static int dissect_lbtru_ncf(tvbuff_t * tvb, int offset, packet_info * pinfo, pr proto_tree_add_item(rf_tree, hf_lbtru_ncf_reason, tvb, offset + O_LBTRU_NCF_HDR_T_REASON_FORMAT, L_LBTRU_NCF_HDR_T_REASON_FORMAT, ENC_BIG_ENDIAN); proto_tree_add_item(rf_tree, hf_lbtru_ncf_format, tvb, offset + O_LBTRU_NCF_HDR_T_REASON_FORMAT, L_LBTRU_NCF_HDR_T_REASON_FORMAT, ENC_BIG_ENDIAN); len_dissected = L_LBTRU_NCF_HDR_T; - num_ncfs = tvb_get_ntohs(tvb, offset + O_LBTRU_NCF_HDR_T_NUM_NCFS); - reason_format = tvb_get_guint8(tvb, offset + O_LBTRU_NCF_HDR_T_REASON_FORMAT); - len_dissected += dissect_lbtru_ncf_list(tvb, offset + L_LBTRU_NCF_HDR_T, pinfo, ncf_tree, num_ncfs, LBTRU_NCF_HDR_REASON(reason_format)); if (!lbtru_expert_separate_ncfs) { expert_add_info_format(pinfo, ncf_item, &ei_lbtru_analysis_ncf, "NCF %s", val_to_str(LBTRU_NCF_HDR_REASON(reason_format), lbtru_ncf_reason, "Unknown (0x%02x)")); } + tap_info->ncf_reason = LBTRU_NCF_HDR_REASON(reason_format);; + tap_info->num_sqns = num_ncfs; + tap_info->sqns = wmem_alloc_array(wmem_packet_scope(), guint32, num_ncfs); + len_dissected += dissect_lbtru_ncf_list(tvb, offset + L_LBTRU_NCF_HDR_T, pinfo, ncf_tree, num_ncfs, LBTRU_NCF_HDR_REASON(reason_format), tap_info); proto_item_set_len(ncf_item, len_dissected); return (len_dissected); } @@ -979,7 +992,7 @@ static int dissect_lbtru_ncf(tvbuff_t * tvb, int offset, packet_info * pinfo, pr /*----------------------------------------------------------------------------*/ /* LBT-RU NAK packet dissection functions. */ /*----------------------------------------------------------------------------*/ -static int dissect_lbtru_nak_list(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, int nak_count) +static int dissect_lbtru_nak_list(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, int nak_count, lbm_lbtru_tap_info_t * tap_info) { proto_tree * nak_tree = NULL; proto_item * nak_item = NULL; @@ -1000,34 +1013,37 @@ static int dissect_lbtru_nak_list(tvbuff_t * tvb, int offset, packet_info * pinf { expert_add_info_format(pinfo, sep_nak_item, &ei_lbtru_analysis_nak_nak, "NAK 0x%08x", nak); } + tap_info->sqns[idx] = nak; len += (int)sizeof(lbm_uint32_t); } proto_item_set_len(nak_item, len); return (len); } -static int dissect_lbtru_nak(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree) +static int dissect_lbtru_nak(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, lbm_lbtru_tap_info_t * tap_info) { int len_dissected; - guint16 num_naks; proto_tree * nak_tree = NULL; proto_item * nak_item = NULL; proto_tree * format_tree = NULL; proto_item * format_item = NULL; + guint16 num_naks = 0; nak_item = proto_tree_add_item(tree, hf_lbtru_nak, tvb, offset, -1, ENC_NA); nak_tree = proto_item_add_subtree(nak_item, ett_lbtru_nak); + num_naks = tvb_get_ntohs(tvb, offset + O_LBTRU_NAK_HDR_T_NUM_NAKS); proto_tree_add_item(nak_tree, hf_lbtru_nak_num, tvb, offset + O_LBTRU_NAK_HDR_T_NUM_NAKS, L_LBTRU_NAK_HDR_T_NUM_NAKS, ENC_BIG_ENDIAN); format_item = proto_tree_add_item(nak_tree, hf_lbtru_nak_format, tvb, offset + O_LBTRU_NAK_HDR_T_FORMAT, L_LBTRU_NAK_HDR_T_FORMAT, ENC_NA); format_tree = proto_item_add_subtree(format_item, ett_lbtru_nak_format); proto_tree_add_item(format_tree, hf_lbtru_nak_format_format, tvb, offset + O_LBTRU_NAK_HDR_T_FORMAT, L_LBTRU_NAK_HDR_T_FORMAT, ENC_BIG_ENDIAN); len_dissected = L_LBTRU_NAK_HDR_T; - num_naks = tvb_get_ntohs(tvb, offset + O_LBTRU_NAK_HDR_T_NUM_NAKS); - len_dissected += dissect_lbtru_nak_list(tvb, offset + L_LBTRU_NAK_HDR_T, pinfo, nak_tree, num_naks); if (!lbtru_expert_separate_naks) { expert_add_info(pinfo, nak_item, &ei_lbtru_analysis_nak); } + tap_info->num_sqns = num_naks; + tap_info->sqns = wmem_alloc_array(wmem_packet_scope(), guint32, num_naks); + len_dissected += dissect_lbtru_nak_list(tvb, offset + L_LBTRU_NAK_HDR_T, pinfo, nak_tree, num_naks, tap_info); proto_item_set_len(nak_item, len_dissected); return (len_dissected); } @@ -1035,7 +1051,7 @@ static int dissect_lbtru_nak(tvbuff_t * tvb, int offset, packet_info * pinfo, pr /*----------------------------------------------------------------------------*/ /* LBT-RU session message packet dissection function. */ /*----------------------------------------------------------------------------*/ -static int dissect_lbtru_sm(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, int syn) +static int dissect_lbtru_sm(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree, int syn, lbm_lbtru_tap_info_t * tap_info) { proto_tree * sm_tree = NULL; proto_item * sm_item = NULL; @@ -1054,13 +1070,14 @@ static int dissect_lbtru_sm(tvbuff_t * tvb, int offset, packet_info * pinfo, pro { expert_add_info(pinfo, sm_sqn, &ei_lbtru_analysis_sm); } + tap_info->sqn = tvb_get_ntohl(tvb, offset + O_LBTRU_SM_HDR_T_SM_SQN); return (L_LBTRU_SM_HDR_T); } /*----------------------------------------------------------------------------*/ /* LBT-RU data packet dissection functions. */ /*----------------------------------------------------------------------------*/ -static int dissect_lbtru_data(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree) +static int dissect_lbtru_data(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree, lbm_lbtru_tap_info_t * tap_info) { proto_tree * data_tree = NULL; proto_item * data_item = NULL; @@ -1069,6 +1086,7 @@ static int dissect_lbtru_data(tvbuff_t * tvb, int offset, packet_info * pinfo _U data_tree = proto_item_add_subtree(data_item, ett_lbtru_data); proto_tree_add_item(data_tree, hf_lbtru_data_sqn, tvb, offset + O_LBTRU_DATA_HDR_T_SQN, L_LBTRU_DATA_HDR_T_SQN, ENC_BIG_ENDIAN); proto_tree_add_item(data_tree, hf_lbtru_data_trail_sqn, tvb, offset + O_LBTRU_DATA_HDR_T_TRAIL_SQN, L_LBTRU_DATA_HDR_T_TRAIL_SQN, ENC_BIG_ENDIAN); + tap_info->sqn = tvb_get_ntohl(tvb, offset + O_LBTRU_DATA_HDR_T_SQN); return (L_LBTRU_DATA_HDR_T); } @@ -1142,6 +1160,7 @@ static int dissect_lbtru(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, proto_item * ei_item = NULL; proto_item * type_item = NULL; proto_item * next_hdr_item = NULL; + lbm_lbtru_tap_info_t * tapinfo = NULL; col_add_str(pinfo->cinfo, COL_PROTOCOL, "LBT-RU"); if (lbtru_use_tag) @@ -1180,6 +1199,9 @@ static int dissect_lbtru(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, PROTO_ITEM_SET_GENERATED(channel_item); channel_tree = proto_item_add_subtree(channel_item, ett_lbtru_channel); + tapinfo = wmem_new0(wmem_packet_scope(), lbm_lbtru_tap_info_t); + tapinfo->type = packet_type; + header_item = proto_tree_add_item(lbtru_tree, hf_lbtru_hdr, tvb, 0, -1, ENC_NA); header_tree = proto_item_add_subtree(header_item, ett_lbtru_hdr); ver_type_item = proto_tree_add_none_format(header_tree, hf_lbtru_hdr_ver_type, tvb, O_LBTRU_HDR_T_VER_TYPE, L_LBTRU_HDR_T_VER_TYPE, "Version/Type: Version %u, Type %s", @@ -1198,6 +1220,7 @@ static int dissect_lbtru(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, if ((flags_or_res & LBTRU_RETRANSMISSION_FLAG) != 0) { retransmission = TRUE; + tapinfo->retransmission = TRUE; } if (retransmission) { @@ -1247,7 +1270,7 @@ static int dissect_lbtru(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, default: col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "Unknown (0x%02x)", LBTRU_HDR_TYPE(ver_type)); expert_add_info_format(pinfo, type_item, &ei_lbtru_analysis_unknown_type, "Unrecognized type 0x%02x", LBTRU_HDR_TYPE(ver_type)); - return (0); + return (total_dissected_len); break; } @@ -1290,22 +1313,30 @@ static int dissect_lbtru(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, } /* Handle the packet-specific data */ - switch (LBTRU_HDR_TYPE(ver_type)) + switch (packet_type) { case LBTRU_PACKET_TYPE_DATA: - dissected_len = dissect_lbtru_data(tvb, L_LBTRU_HDR_T, pinfo, lbtru_tree); + dissected_len = dissect_lbtru_data(tvb, L_LBTRU_HDR_T, pinfo, lbtru_tree, tapinfo); break; case LBTRU_PACKET_TYPE_SM: - dissected_len = dissect_lbtru_sm(tvb, L_LBTRU_HDR_T, pinfo, lbtru_tree, (flags_or_res & LBTRU_SM_SYN_FLAG)); + dissected_len = dissect_lbtru_sm(tvb, L_LBTRU_HDR_T, pinfo, lbtru_tree, (flags_or_res & LBTRU_SM_SYN_FLAG), tapinfo); break; case LBTRU_PACKET_TYPE_NAK: - dissected_len = dissect_lbtru_nak(tvb, ofs, pinfo, lbtru_tree); + dissected_len = dissect_lbtru_nak(tvb, ofs, pinfo, lbtru_tree, tapinfo); break; case LBTRU_PACKET_TYPE_NCF: - dissected_len = dissect_lbtru_ncf(tvb, ofs, pinfo, lbtru_tree); + dissected_len = dissect_lbtru_ncf(tvb, ofs, pinfo, lbtru_tree, tapinfo); break; case LBTRU_PACKET_TYPE_ACK: - dissected_len = dissect_lbtru_ack(tvb, ofs, pinfo, lbtru_tree); + dissected_len = dissect_lbtru_ack(tvb, ofs, pinfo, lbtru_tree, tapinfo); + break; + case LBTRU_PACKET_TYPE_CREQ: + dissected_len = 0; + tapinfo->creq_type = flags_or_res; + break; + case LBTRU_PACKET_TYPE_RST: + dissected_len = 0; + tapinfo->rst_type = flags_or_res; break; default: dissected_len = 0; @@ -1422,10 +1453,7 @@ static int dissect_lbtru(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, { client = lbtru_client_transport_find(transport, &receiver_address, receiver_port, pinfo->fd->num); } - } - - if (transport != NULL) - { + tapinfo->transport = lbtru_transport_source_string_transport(transport); channel = transport->channel; fld_item = proto_tree_add_uint64(channel_tree, hf_lbtru_channel_id, tvb, 0, 0, channel); PROTO_ITEM_SET_GENERATED(fld_item); @@ -1634,6 +1662,10 @@ static int dissect_lbtru(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, } } } + if (tapinfo->transport != NULL) + { + tap_queue_packet(lbtru_tap_handle, pinfo, (void *) tapinfo); + } return (total_dissected_len); } diff --git a/epan/dissectors/packet-lbttcp.c b/epan/dissectors/packet-lbttcp.c index 085a10e8ab..ed8c85360d 100644 --- a/epan/dissectors/packet-lbttcp.c +++ b/epan/dissectors/packet-lbttcp.c @@ -203,7 +203,7 @@ gboolean lbttcp_transport_sid_find(const address * source_address, guint16 sourc lbttcp_transport_conv_data_t * conv_data = NULL; lbttcp_transport_t * transport = NULL; - conv = find_conversation(0, source_address, &lbttcp_null_address, PT_TCP, source_port, 0, 0); + conv = find_conversation(frame, source_address, &lbttcp_null_address, PT_TCP, source_port, 0, 0); if (conv == NULL) { return (FALSE); @@ -232,10 +232,10 @@ void lbttcp_transport_sid_add(const address * source_address, guint16 source_por lbttcp_transport_conv_data_t * conv_data = NULL; lbttcp_transport_t * transport = NULL; - conv = find_conversation(0, source_address, &lbttcp_null_address, PT_TCP, source_port, 0, 0); + conv = find_conversation(frame, source_address, &lbttcp_null_address, PT_TCP, source_port, 0, 0); if (conv == NULL) { - conv = conversation_new(0, source_address, &lbttcp_null_address, PT_TCP, source_port, 0, 0); + conv = conversation_new(frame, source_address, &lbttcp_null_address, PT_TCP, source_port, 0, 0); } conv_data = (lbttcp_transport_conv_data_t *) conversation_get_proto_data(conv, proto_lbttcp); if (conv_data == NULL) |