NR RRC: add preference to put NAS in the root tree

This commit is contained in:
Pascal Quantin 2021-02-10 13:59:47 +01:00 committed by Wireshark GitLab Utility
parent 12ab24019f
commit 46c44e0785
3 changed files with 43 additions and 13 deletions

View File

@ -928,11 +928,15 @@ RAT-Type TYPE_PREFIX
#.FN_BODY DedicatedNAS-Message VAL_PTR = &nas_5gs_tvb
tvbuff_t *nas_5gs_tvb = NULL;
proto_tree *subtree;
%(DEFAULT_BODY)s
if (nas_5gs_tvb && nas_5gs_handle) {
subtree = proto_item_add_subtree(actx->created_item, ett_nr_rrc_DedicatedNAS_Message);
nr_rrc_call_dissector(nas_5gs_handle, nas_5gs_tvb, actx->pinfo, subtree);
proto_tree *nas_tree;
if (nr_rrc_nas_in_root_tree) {
nas_tree = proto_tree_get_root(tree);
} else {
nas_tree = proto_item_add_subtree(actx->created_item, ett_nr_rrc_DedicatedNAS_Message);
}
nr_rrc_call_dissector(nas_5gs_handle, nas_5gs_tvb, actx->pinfo, nas_tree);
}
#.FN_BODY MobilityFromNRCommand-IEs/targetRAT-Type VAL_PTR = &target_rat_type

View File

@ -22,6 +22,7 @@
#include <epan/exceptions.h>
#include <epan/show_exception.h>
#include <epan/proto_data.h>
#include <epan/prefs.h>
#include <wsutil/str_util.h>
#include <wsutil/epochs.h>
@ -56,6 +57,8 @@ static wmem_map_t *nr_rrc_etws_cmas_dcs_hash = NULL;
static reassembly_table nr_rrc_sib7_reassembly_table;
static reassembly_table nr_rrc_sib8_reassembly_table;
static gboolean nr_rrc_nas_in_root_tree;
extern int proto_mac_nr;
extern int proto_pdcp_nr;
@ -744,6 +747,7 @@ proto_register_nr_rrc(void) {
};
expert_module_t* expert_nr_rrc;
module_t *nr_rrc_module;
/* Register protocol */
proto_nr_rrc = proto_register_protocol(PNAME, PSNAME, PFNAME);
@ -764,6 +768,13 @@ proto_register_nr_rrc(void) {
&addresses_reassembly_table_functions);
reassembly_table_register(&nr_rrc_sib8_reassembly_table,
&addresses_reassembly_table_functions);
/* Register configuration preferences */
nr_rrc_module = prefs_register_protocol(proto_nr_rrc, NULL);
prefs_register_bool_preference(nr_rrc_module, "nas_in_root_tree",
"Show NAS PDU in root packet details",
"Whether the NAS PDU should be shown in the root packet details tree",
&nr_rrc_nas_in_root_tree);
}
void

View File

@ -30,6 +30,7 @@
#include <epan/exceptions.h>
#include <epan/show_exception.h>
#include <epan/proto_data.h>
#include <epan/prefs.h>
#include <wsutil/str_util.h>
#include <wsutil/epochs.h>
@ -64,6 +65,8 @@ static wmem_map_t *nr_rrc_etws_cmas_dcs_hash = NULL;
static reassembly_table nr_rrc_sib7_reassembly_table;
static reassembly_table nr_rrc_sib8_reassembly_table;
static gboolean nr_rrc_nas_in_root_tree;
extern int proto_mac_nr;
extern int proto_pdcp_nr;
@ -363,7 +366,7 @@ typedef enum _T_targetRAT_Type_enum {
} T_targetRAT_Type_enum;
/*--- End of included file: packet-nr-rrc-val.h ---*/
#line 64 "./asn1/nr-rrc/packet-nr-rrc-template.c"
#line 67 "./asn1/nr-rrc/packet-nr-rrc-template.c"
/* Initialize the protocol and registered fields */
static int proto_nr_rrc = -1;
@ -6337,7 +6340,7 @@ static int hf_nr_rrc_sl_Rx_256QAM_r16_01 = -1; /* T_sl_Rx_256QAM_r16_01 */
static int dummy_hf_nr_rrc_eag_field = -1; /* never registered */
/*--- End of included file: packet-nr-rrc-hf.c ---*/
#line 68 "./asn1/nr-rrc/packet-nr-rrc-template.c"
#line 71 "./asn1/nr-rrc/packet-nr-rrc-template.c"
static int hf_nr_rrc_serialNumber_gs = -1;
static int hf_nr_rrc_serialNumber_msg_code = -1;
static int hf_nr_rrc_serialNumber_upd_nb = -1;
@ -8759,7 +8762,7 @@ static gint ett_nr_rrc_T_fr2_r16_02 = -1;
static gint ett_nr_rrc_T_csi_ReportSidelink_r16 = -1;
/*--- End of included file: packet-nr-rrc-ett.c ---*/
#line 105 "./asn1/nr-rrc/packet-nr-rrc-template.c"
#line 108 "./asn1/nr-rrc/packet-nr-rrc-template.c"
static gint ett_nr_rrc_DedicatedNAS_Message = -1;
static gint ett_nr_rrc_targetRAT_MessageContainer = -1;
static gint ett_nr_rrc_nas_Container = -1;
@ -30166,13 +30169,17 @@ dissect_nr_rrc_T_fullConfig(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx
static int
dissect_nr_rrc_DedicatedNAS_Message(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
tvbuff_t *nas_5gs_tvb = NULL;
proto_tree *subtree;
offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
NO_BOUND, NO_BOUND, FALSE, &nas_5gs_tvb);
if (nas_5gs_tvb && nas_5gs_handle) {
subtree = proto_item_add_subtree(actx->created_item, ett_nr_rrc_DedicatedNAS_Message);
nr_rrc_call_dissector(nas_5gs_handle, nas_5gs_tvb, actx->pinfo, subtree);
proto_tree *nas_tree;
if (nr_rrc_nas_in_root_tree) {
nas_tree = proto_tree_get_root(tree);
} else {
nas_tree = proto_item_add_subtree(actx->created_item, ett_nr_rrc_DedicatedNAS_Message);
}
nr_rrc_call_dissector(nas_5gs_handle, nas_5gs_tvb, actx->pinfo, nas_tree);
}
@ -88524,7 +88531,7 @@ static int dissect_UE_NR_Capability_v15c0_PDU(tvbuff_t *tvb _U_, packet_info *pi
/*--- End of included file: packet-nr-rrc-fn.c ---*/
#line 521 "./asn1/nr-rrc/packet-nr-rrc-template.c"
#line 524 "./asn1/nr-rrc/packet-nr-rrc-template.c"
int
dissect_nr_rrc_nr_RLF_Report_r16_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) {
@ -112417,7 +112424,7 @@ proto_register_nr_rrc(void) {
"T_sl_Rx_256QAM_r16_01", HFILL }},
/*--- End of included file: packet-nr-rrc-hfarr.c ---*/
#line 553 "./asn1/nr-rrc/packet-nr-rrc-template.c"
#line 556 "./asn1/nr-rrc/packet-nr-rrc-template.c"
{ &hf_nr_rrc_serialNumber_gs,
{ "Geographical Scope", "nr-rrc.serialNumber.gs",
@ -114940,7 +114947,7 @@ proto_register_nr_rrc(void) {
&ett_nr_rrc_T_csi_ReportSidelink_r16,
/*--- End of included file: packet-nr-rrc-ettarr.c ---*/
#line 691 "./asn1/nr-rrc/packet-nr-rrc-template.c"
#line 694 "./asn1/nr-rrc/packet-nr-rrc-template.c"
&ett_nr_rrc_DedicatedNAS_Message,
&ett_nr_rrc_targetRAT_MessageContainer,
&ett_nr_rrc_nas_Container,
@ -114997,6 +115004,7 @@ proto_register_nr_rrc(void) {
};
expert_module_t* expert_nr_rrc;
module_t *nr_rrc_module;
/* Register protocol */
proto_nr_rrc = proto_register_protocol(PNAME, PSNAME, PFNAME);
@ -115029,7 +115037,7 @@ proto_register_nr_rrc(void) {
/*--- End of included file: packet-nr-rrc-dis-reg.c ---*/
#line 759 "./asn1/nr-rrc/packet-nr-rrc-template.c"
#line 763 "./asn1/nr-rrc/packet-nr-rrc-template.c"
nr_rrc_etws_cmas_dcs_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(),
g_direct_hash, g_direct_equal);
@ -115038,6 +115046,13 @@ proto_register_nr_rrc(void) {
&addresses_reassembly_table_functions);
reassembly_table_register(&nr_rrc_sib8_reassembly_table,
&addresses_reassembly_table_functions);
/* Register configuration preferences */
nr_rrc_module = prefs_register_protocol(proto_nr_rrc, NULL);
prefs_register_bool_preference(nr_rrc_module, "nas_in_root_tree",
"Show NAS PDU in root packet details",
"Whether the NAS PDU should be shown in the root packet details tree",
&nr_rrc_nas_in_root_tree);
}
void