diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-07-18 07:45:19 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-07-18 07:45:19 +0000 |
commit | fccbea67023e20b02a526856698d507b77e160ae (patch) | |
tree | f0b61bf08487bdfc5943bf3f63313f899d3854fc /asn1 | |
parent | 9d470cceb9a34fa4c5a90169a075e10c576c4e65 (diff) | |
download | wireshark-fccbea67023e20b02a526856698d507b77e160ae.tar.gz |
Merge the rest of Jacob Nordgren and Rishie Sharmas work on
Updateing conversation handling to dissect FP/MAC/RLC
(Work in progress).
svn path=/trunk/; revision=43781
Diffstat (limited to 'asn1')
-rw-r--r-- | asn1/nbap/nbap.cnf | 89 | ||||
-rw-r--r-- | asn1/nbap/packet-nbap-template.c | 75 | ||||
-rw-r--r-- | asn1/rrc/packet-rrc-template.c | 2 | ||||
-rw-r--r-- | asn1/rrc/rrc.cnf | 2 |
4 files changed, 149 insertions, 19 deletions
diff --git a/asn1/nbap/nbap.cnf b/asn1/nbap/nbap.cnf index d1362ae09e..b3361b69da 100644 --- a/asn1/nbap/nbap.cnf +++ b/asn1/nbap/nbap.cnf @@ -4,8 +4,8 @@ # Modified 2012 by Jacob Nordgren <jacob.nordgren@ericsson.com> and # Rishie Sharma <rishie.sharma@ericsson.com> # $Id$ - #.OPT + PER ALIGNED #.END @@ -1073,6 +1073,12 @@ dch_id = 0xFFFFFFFF; { return offset; } + + /*RBS might sometimes send a nonses bind, to indicate that no DCH is present*/ + if(BindingID_port == NBAP_IGNORE_PORT){ + return offset; + } + SET_ADDRESS(&null_addr, AT_NONE, 0, NULL); dst_addr.type=AT_IPv4; @@ -1093,7 +1099,7 @@ dch_id = 0xFFFFFFFF; conversation_set_dissector(conversation, fp_handle); if(actx->pinfo->link_dir==P2P_DIR_DL){ umts_fp_conversation_info = se_new0(umts_fp_conversation_info_t); - + /* Fill in the data */ umts_fp_conversation_info->iface_type = IuB_Interface; umts_fp_conversation_info->division = Division_FDD; @@ -1146,6 +1152,7 @@ dch_id = 0xFFFFFFFF; umts_fp_conversation_info->fp_dch_channel_info[umts_fp_conversation_info->num_dch_in_flow].dl_chan_tf_size[j] = nbap_dch_chnl_info[i].dl_chan_tf_size[j]; umts_fp_conversation_info->fp_dch_channel_info[umts_fp_conversation_info->num_dch_in_flow].dl_chan_num_tbs[j] = nbap_dch_chnl_info[i].dl_chan_num_tbs[j]; } + } umts_fp_conversation_info->num_dch_in_flow++; umts_fp_conversation_info->dchs_in_flow_list[umts_fp_conversation_info->num_dch_in_flow] = i; @@ -1181,7 +1188,13 @@ BindingID_port = 0; &null_addr, PT_UDP, BindingID_port, 0, NO_ADDR_B|NO_PORT_B); - if (conversation == NULL) { + /* We must also check if this port is about to be overriden, if thats the case we + * might already have a DCH entry on this port which should be overwritten + */ + if (conversation == NULL || ((umts_fp_conversation_info_t*)conversation_get_proto_data(conversation, proto_fp))->channel == CHANNEL_DCH) { + + + /* It's not part of any conversation - create a new one. */ conversation = conversation_new(actx->pinfo->fd->num, &dst_addr, &null_addr, PT_UDP,BindingID_port , @@ -1206,10 +1219,12 @@ BindingID_port = 0; COPY_ADDRESS(&(nbap_edch_channel_info[e_dch_macdflow_id].crnc_address),&dst_addr); nbap_edch_channel_info[e_dch_macdflow_id].crnc_port = BindingID_port; + /*Figure out if this is a reconfiguration. then we must steal DDI entries from previous*/ + /* Can we always use old entries? they will be overwritten later? */ set_umts_fp_conv_data(conversation, umts_fp_conversation_info); } - - } + } + #.FN_BODY E-DCH-MACdFlow-Specific-InfoItem umts_fp_conversation_info_t *p_conv_data = NULL; @@ -1218,12 +1233,11 @@ conversation_t *p_conv; guint32 no_ddi_entries, i; %(DEFAULT_BODY)s - if (actx->pinfo->fd->flags.visited) { return offset; } - /* Check if we have converstaion info */ + /* Check if we have conversation info */ SET_ADDRESS(&null_addr, AT_NONE, 0, NULL); p_conv = find_conversation(actx->pinfo->fd->num, &nbap_edch_channel_info[e_dch_macdflow_id].crnc_address, &null_addr, PT_UDP, @@ -1326,23 +1340,48 @@ guint32 no_ddi_entries, i; nbap_hsdsch_channel_info[hsdsch_macdflow_id].hsdsch_physical_layer_category = hsdsch_physical_layer_category; #.FN_BODY HSDSCH-MACdFlows-Information + + int protocol_ie_id; + guint32 i; num_items = 0; - + protocol_ie_id = ProtocolIE_ID; + + + /*Handle special cases, when the tree is weird, ie. no useful message appears in the tree, like HSDHSCH-Information-FDD */ + switch(protocol_ie_id){ + /*This flow must also be added*/ + case id_HSDSCH_MACdFlows_to_Add: + if (!actx->pinfo->fd->flags.visited){ + /* Set port to zero use that as an indication of wether we have data or not */ + for (i = 0; i < maxNrOfMACdFlows; i++) { + nbap_hsdsch_channel_info[i].crnc_port = 0; + nbap_hsdsch_channel_info[i].rlc_mode = FP_RLC_MODE_UNKNOWN; + /*XXX: Added 29 jun*/ + nbap_hsdsch_channel_info[i].entity = entity_not_specified; /* Maybe this should default to entity = hs*/ + } + } %(DEFAULT_BODY)s - + add_hsdsch_bind(actx->pinfo,tree); + + break; + default: +%(DEFAULT_BODY)s + break; + } #.FN_BODY HSDSCH-MACdFlow-Specific-InfoItem + address dst_addr; transportLayerAddress_ipv4 = 0; BindingID_port = 0; num_items++; %(DEFAULT_BODY)s + if (actx->pinfo->fd->flags.visited||transportLayerAddress_ipv4==0||BindingID_port == 0) { return offset; } - dst_addr.type=AT_IPv4; dst_addr.len=4; dst_addr.data=(guint8 *)&transportLayerAddress_ipv4; @@ -1350,22 +1389,30 @@ guint32 no_ddi_entries, i; /* Set address for collection of HSDSCH entries */ COPY_ADDRESS(&(nbap_hsdsch_channel_info[hsdsch_macdflow_id].crnc_address),&dst_addr); nbap_hsdsch_channel_info[hsdsch_macdflow_id].crnc_port = BindingID_port; + + +#.FN_BODY MAC-PDU-SizeExtended + +%(DEFAULT_BODY)s + if(nbap_hsdsch_channel_info[hsdsch_macdflow_id].crnc_port != 0){ + nbap_hsdsch_channel_info[hsdsch_macdflow_id].entity = ehs; + } #.FN_BODY HSDSCH-MACdPDUSizeFormat /* - * Set the channel entity i.e the type of the hsdch channels (if this is present entity = ehs) + * Set the channel entity i.e the type of the hsdsch channels (if this is present entity = ehs) */ int i; %(DEFAULT_BODY)s - /* */ for (i = 0; i < maxNrOfMACdFlows; i++) { if (nbap_hsdsch_channel_info[i].crnc_port != 0){ nbap_hsdsch_channel_info[i].entity = ehs; - nbap_debug1("Setting entity = ehs for HSDSCH channel: %%d\n",i); } + } + #.FN_BODY HSDSCH-FDD-Information @@ -1392,6 +1439,7 @@ int i; if (actx->pinfo->fd->flags.visited){ return offset; } + /* Set port to zero use that as an indication of wether we have data or not */ SET_ADDRESS(&null_addr, AT_NONE, 0, NULL); for (i = 0; i < maxNrOfMACdFlows; i++) { @@ -1404,7 +1452,7 @@ int i; PT_UDP, nbap_hsdsch_channel_info[i].crnc_port, 0, NO_ADDR_B); - + if (conversation == NULL) { /* It's not part of any conversation - create a new one. */ nbap_debug1("HSDSCH-MACdFlows-Information:Set up conv on Port %%u",nbap_hsdsch_channel_info[i].crnc_port); @@ -1414,7 +1462,7 @@ int i; /* Set dissector */ conversation_set_dissector(conversation, fp_handle); - + if(actx->pinfo->link_dir==P2P_DIR_DL){ umts_fp_conversation_info = se_new0(umts_fp_conversation_info_t); /* Fill in the HSDSCH relevant data */ @@ -1520,6 +1568,7 @@ int i; umts_fp_conversation_info = se_new0(umts_fp_conversation_info_t); umts_fp_conversation_info->channel = CHANNEL_HSDSCH_COMMON; + umts_fp_conversation_info->division = Division_FDD; set_umts_fp_conv_data(conversation, umts_fp_conversation_info); } @@ -1530,7 +1579,15 @@ int i; } } - +# +#Routines for figuring out a unique UE identification number (to track flows over changing channels) +# + +#.FN_BODY NodeB-CommunicationContextID VAL_PTR = &com_context_id +%(DEFAULT_BODY)s +#.FN_BODY CRNC-CommunicationContextID VAL_PTR = &com_context_id + +%(DEFAULT_BODY)s #.REGISTER_NEW diff --git a/asn1/nbap/packet-nbap-template.c b/asn1/nbap/packet-nbap-template.c index ead17f1468..53aea37aa7 100644 --- a/asn1/nbap/packet-nbap-template.c +++ b/asn1/nbap/packet-nbap-template.c @@ -35,6 +35,7 @@ #include <epan/sctpppids.h> #include <epan/asn1.h> #include <epan/conversation.h> +#include <epan/expert.h> #include "packet-per.h" #include "packet-isup.h" @@ -53,6 +54,9 @@ #define PSNAME "NBAP" #define PFNAME "nbap" + +#define NBAP_IGNORE_PORT 255 + /* Debug */ #if 0 #define nbap_debug0(str) g_warning(str) @@ -70,6 +74,7 @@ dissector_handle_t fp_handle; static guint32 transportLayerAddress_ipv4; static guint16 BindingID_port; +static guint32 com_context_id; #include "packet-nbap-val.h" @@ -211,6 +216,8 @@ static int dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, pro static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); +/*Easy way to add hsdhsch binds for corner cases*/ +static void add_hsdsch_bind(packet_info * pinfo, proto_tree * tree); #include "packet-nbap-fn.c" @@ -241,13 +248,74 @@ static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, p if (!ProcedureID) return 0; return (dissector_try_string(nbap_proc_uout_dissector_table, ProcedureID, tvb, pinfo, tree)) ? tvb_length(tvb) : 0; } +static void add_hsdsch_bind(packet_info *pinfo, proto_tree * tree){ + address null_addr; + conversation_t *conversation = NULL; + umts_fp_conversation_info_t *umts_fp_conversation_info; + guint32 i; + + if (pinfo->fd->flags.visited){ + return; + } + + /* Set port to zero use that as an indication of wether we have data or not */ + SET_ADDRESS(&null_addr, AT_NONE, 0, NULL); + for (i = 0; i < maxNrOfMACdFlows; i++) { + if (nbap_hsdsch_channel_info[i].crnc_port != 0){ + conversation = find_conversation(pinfo->fd->num, &(nbap_hsdsch_channel_info[i].crnc_address), &null_addr, + PT_UDP, + nbap_hsdsch_channel_info[i].crnc_port, 0, NO_ADDR_B); + + + if (conversation == NULL) { + /* It's not part of any conversation - create a new one. */ + conversation = conversation_new(pinfo->fd->num, &(nbap_hsdsch_channel_info[i].crnc_address), + &null_addr, PT_UDP, nbap_hsdsch_channel_info[i].crnc_port, + 0, NO_ADDR2|NO_PORT2); + + /* Set dissector */ + conversation_set_dissector(conversation, fp_handle); + + if(pinfo->link_dir==P2P_DIR_DL){ + umts_fp_conversation_info = se_new0(umts_fp_conversation_info_t); + /* Fill in the HSDSCH relevant data */ + + umts_fp_conversation_info->iface_type = IuB_Interface; + umts_fp_conversation_info->division = Division_FDD; + umts_fp_conversation_info->channel = CHANNEL_HSDSCH; + umts_fp_conversation_info->dl_frame_number = 0; + umts_fp_conversation_info->ul_frame_number = pinfo->fd->num; + SE_COPY_ADDRESS(&(umts_fp_conversation_info->crnc_address), &nbap_hsdsch_channel_info[i].crnc_address); + umts_fp_conversation_info->crnc_port = nbap_hsdsch_channel_info[i].crnc_port; + + /*Added june 3, normally just the iterator variable*/ + umts_fp_conversation_info->hsdsch_macdflow_id = i ; /*hsdsch_macdflow_ids[i];*/ /* hsdsch_macdflow_id;*/ + + /* Cheat and use the DCH entries */ + umts_fp_conversation_info->num_dch_in_flow++; + umts_fp_conversation_info->dchs_in_flow_list[umts_fp_conversation_info->num_dch_in_flow -1] = i; + + /*XXX: Is this craziness, what is physical_layer? */ + if(nbap_hsdsch_channel_info[i].entity == entity_not_specified ){ + /*Error*/ + expert_add_info_format(pinfo, tree, PI_MALFORMED,PI_ERROR, "HSDSCH Entity not specified!"); + }else{ + umts_fp_conversation_info->hsdsch_entity = nbap_hsdsch_channel_info[i].entity; + } + umts_fp_conversation_info->rlc_mode = nbap_hsdsch_channel_info[i].rlc_mode; + set_umts_fp_conv_data(conversation, umts_fp_conversation_info); + } + } + } + } +} static void dissect_nbap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *nbap_item = NULL; proto_tree *nbap_tree = NULL; - + int i; /* make entry in the Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "NBAP"); @@ -255,6 +323,11 @@ dissect_nbap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) nbap_item = proto_tree_add_item(tree, proto_nbap, tvb, 0, -1, ENC_NA); nbap_tree = proto_item_add_subtree(nbap_item, ett_nbap); + /*Do a little cleanup just as a precaution*/ + for (i = 0; i < maxNrOfMACdFlows; i++) { + nbap_hsdsch_channel_info[i].entity = hs; + } + dissect_NBAP_PDU_PDU(tvb, pinfo, nbap_tree); } diff --git a/asn1/rrc/packet-rrc-template.c b/asn1/rrc/packet-rrc-template.c index def3d07e97..8dcf26724c 100644 --- a/asn1/rrc/packet-rrc-template.c +++ b/asn1/rrc/packet-rrc-template.c @@ -68,7 +68,7 @@ enum nas_sys_info_gsm_map { RRC_NAS_SYS_INFO_CN_COMMON }; -static guint32 rrc_nas_sys_info_gsm_map_type = RRC_NAS_SYS_INFO_CN_COMMON; +static enum nas_sys_info_gsm_map rrc_nas_sys_info_gsm_map_type = RRC_NAS_SYS_INFO_CN_COMMON; /* Forward declarations */ static int dissect_UE_RadioAccessCapabilityInfo_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); diff --git a/asn1/rrc/rrc.cnf b/asn1/rrc/rrc.cnf index 4ab1f1111a..96f6593482 100644 --- a/asn1/rrc/rrc.cnf +++ b/asn1/rrc/rrc.cnf @@ -606,7 +606,7 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE proto_tree_add_unicode_string(tree, hf_index, hnbname_tvb, 0, -1, tvb_get_ephemeral_string_enc(hnbname_tvb, 0, tvb_length(hnbname_tvb), ENC_UTF_8 | ENC_NA)); -#.FN_BODY CN-DomainIdentity VAL_PTR = &rrc_nas_sys_info_gsm_map_type +#.FN_BODY CN-DomainIdentity VAL_PTR = (guint32*)(&rrc_nas_sys_info_gsm_map_type) %(DEFAULT_BODY)s #.FN_BODY CN-InformationInfo/cn-CommonGSM-MAP-NAS-SysInfo |