summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2017-05-31 14:00:27 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2017-05-31 14:46:53 +0000
commitae65b8f51ce082ddf76ad62c1392284f3a64e7a0 (patch)
tree1308ef03aebf9d7c4c84417b74bdf7793e17346e
parentdcba264a46f53e6f3be4d8f93fcf93d5d61668d1 (diff)
downloadwireshark-ae65b8f51ce082ddf76ad62c1392284f3a64e7a0.tar.gz
UMTS FP: backout part of g899fd42
The delay for p_add_proto_data() calls was not required and introduced several bugs (when the function returns before private info is attached). Change-Id: Id3a668e6776308b2ea758940e4260bfcbddc236a Reviewed-on: https://code.wireshark.org/review/21859 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rw-r--r--epan/dissectors/packet-umts_fp.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c
index 830da88eac..21daf35bb6 100644
--- a/epan/dissectors/packet-umts_fp.c
+++ b/epan/dissectors/packet-umts_fp.c
@@ -4921,8 +4921,8 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
int offset = 0, i=0, j=0, num_tbs, chan, tb_size, tb_bit_off;
gboolean is_control_frame;
gboolean is_known_dcch_tf,is_special_case_dch_24;
- umts_mac_info *macinf = NULL;
- rlc_info *rlcinf = NULL;
+ umts_mac_info *macinf;
+ rlc_info *rlcinf;
guint8 fake_lchid=0;
gint *cur_val=NULL;
guint32 user_identity;
@@ -4934,6 +4934,7 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
gboolean info_missing = FALSE;
fpi = wmem_new0(wmem_file_scope(), fp_info);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_fp, 0, fpi);
fpi->iface_type = p_conv_data->iface_type;
fpi->division = p_conv_data->division;
@@ -4976,12 +4977,14 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
info_missing = TRUE;
break;
}
- rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
- macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
fpi->hsdsch_entity = fp_hsdsch_channel_info->hsdsch_entity;
+ macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
fpi->hsdsch_macflowd_id = fp_hsdsch_channel_info->hsdsch_macdflow_id;
macinf->content[0] = hsdsch_macdflow_id_mac_content_map[fp_hsdsch_channel_info->hsdsch_macdflow_id]; /*MAC_CONTENT_PS_DTCH;*/
macinf->lchid[0] = fp_hsdsch_channel_info->hsdsch_macdflow_id;
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0, macinf);
+
+ rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
/*Figure out RLC_MODE based on MACd-flow-ID, basically MACd-flow-ID = 0 then it's SRB0 == UM else AM*/
rlcinf->mode[0] = hsdsch_macdflow_id_rlc_map[fp_hsdsch_channel_info->hsdsch_macdflow_id];
@@ -5022,6 +5025,8 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
rlcinf->li_size[0] = RLC_LI_7BITS;
rlcinf->ciphered[0] = FALSE;
rlcinf->deciphered[0] = FALSE;
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0, rlcinf);
+
return fpi;
@@ -5033,9 +5038,9 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
info_missing = TRUE;
break;
}
- rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
- macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
/*Most configuration is now done in the actual dissecting function*/
+ macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
+ rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
fpi->no_ddi_entries = fp_edch_channel_info->no_ddi_entries;
for (i=0; i<fpi->no_ddi_entries; i++) {
fpi->edch_ddi[i] = fp_edch_channel_info->edch_ddi[i]; /*Set the DDI value*/
@@ -5047,6 +5052,11 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
}
fpi->edch_type = fp_edch_channel_info->edch_type;
+ /* macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
+ macinf->content[0] = MAC_CONTENT_PS_DTCH;*/
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0, macinf);
+
+
/* For RLC re-assembly to work we need a urnti signaled from NBAP */
rlcinf->urnti[0] = fpi->com_context_id;
/* rlcinf->mode[0] = RLC_AM;*/
@@ -5054,6 +5064,8 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
rlcinf->ciphered[0] = FALSE;
rlcinf->deciphered[0] = FALSE;
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0, rlcinf);
+
return fpi;
case CHANNEL_PCH:
@@ -5084,9 +5096,9 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
/* control frame, we're done */
return fpi;
}
+
rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
-
offset = 2; /* To correctly read the TFI */
fakes = 5; /* Reset fake counter */
for (chan=0; chan < fpi->num_chans; chan++) { /* Iterate over the DCH channels in the flow (each given a TFI) */
@@ -5174,6 +5186,8 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
offset++;
}
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0, macinf);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0, rlcinf);
/* Set offset to point to first TFI
* the Number of TFI's = number of DCH's in the flow
*/
@@ -5199,10 +5213,12 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
*/
offset = 2;
/* Set MAC data */
+ macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
macinf->ctmux[0] = 1;
macinf->content[0] = MAC_CONTENT_DCCH;
-
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0, macinf);
/* Set RLC data */
+ rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
/* Make configurable ?(avaliable in NBAP?) */
/* For RLC re-assembly to work we need to fake urnti: using the conversation's ID and the prefix of 0xFFF */
rlcinf->urnti[0] = (p_conv->conv_index | 0xFFF00000);
@@ -5211,6 +5227,7 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
rlcinf->li_size[0] = RLC_LI_7BITS;
rlcinf->ciphered[0] = FALSE;
rlcinf->deciphered[0] = FALSE;
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0, rlcinf);
break;
case CHANNEL_RACH_FDD:
@@ -5233,15 +5250,21 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
*/
offset = 2;
/* set MAC data */
+ macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
+ rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
for ( chan = 0; chan < fpi->num_chans; chan++ ) {
macinf->ctmux[chan] = 1;
macinf->content[chan] = MAC_CONTENT_DCCH;
rlcinf->urnti[chan] = fpi->com_context_id; /*Note that MAC probably will change this*/
}
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0, macinf);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0, rlcinf);
break;
case CHANNEL_HSDSCH_COMMON:
rlcinf = wmem_new0(wmem_file_scope(), rlc_info);
macinf = wmem_new0(wmem_file_scope(), umts_mac_info);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0, macinf);
+ p_add_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0, rlcinf);
break;
default:
expert_add_info(pinfo, NULL, &ei_fp_transport_channel_type_unknown);
@@ -5251,20 +5274,11 @@ fp_set_per_packet_inf_from_conv(conversation_t *p_conv,
if(info_missing) {
/* Some information was missing in the conversation struct and the FP info isn't complete */
- wmem_free(wmem_file_scope(),fpi);
+ p_remove_proto_data(wmem_file_scope(), pinfo, proto_fp, 0);
+ wmem_free(wmem_file_scope(), fpi);
return NULL;
}
- // Attach FP info
- p_add_proto_data(wmem_file_scope(), pinfo, proto_fp, 0, fpi);
- // Attach MAC & RLC info only if created
- if(macinf) {
- p_add_proto_data(wmem_file_scope(), pinfo, proto_umts_mac, 0, macinf);
- }
- if(rlcinf) {
- p_add_proto_data(wmem_file_scope(), pinfo, proto_rlc, 0, rlcinf);
- }
-
/* Peek at the packet as the per packet info seems not to take the tfi into account */
for (i=0; i<fpi->num_chans; i++) {
tfi = tvb_get_guint8(tvb, offset);