From 595a5a1c9dd7e3053247811777838e2e6bb84363 Mon Sep 17 00:00:00 2001 From: Michail Koreshkov Date: Tue, 17 Aug 2021 21:00:30 +0300 Subject: [PATCH] gsm_a_rr: add NRI decoding when pool is used Protocol BSSGP has option in GUI to enable decoding NRI when SGSN pool is used. But this configuration option is not used in code. I have marked this option as obsolete and add new single option to protocol dissector gsm_a_rr where TLLI is decoded and added code for processing NRI. --- epan/dissectors/packet-bssgp.c | 12 ++---------- epan/dissectors/packet-gsm_a_rr.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/epan/dissectors/packet-bssgp.c b/epan/dissectors/packet-bssgp.c index 0ded034048..da93df96ac 100644 --- a/epan/dissectors/packet-bssgp.c +++ b/epan/dissectors/packet-bssgp.c @@ -62,9 +62,6 @@ void proto_register_bssgp(void); void proto_reg_handoff_bssgp(void); -static int bssgp_decode_nri = 0; -static guint bssgp_nri_length = 4; - static guint8 g_pdu_type, g_rim_application_identity; static guint32 g_bssgp_ran_inf_pdu_t_ext_c; static proto_tree *gparent_tree; @@ -7605,13 +7602,8 @@ proto_register_bssgp(void) /* Register configuration options */ bssgp_module = prefs_register_protocol(proto_bssgp, NULL); - prefs_register_bool_preference(bssgp_module, "decode_nri", - "Decode NRI", - "Decode NRI (for use with SGSN in Pool)", - &bssgp_decode_nri); - prefs_register_uint_preference(bssgp_module, "nri_length", "NRI length", - "NRI length, in bits", - 10, &bssgp_nri_length); + prefs_register_obsolete_preference(bssgp_module, "decode_nri"); + prefs_register_obsolete_preference(bssgp_module, "nri_length"); } /* If this dissector uses sub-dissector registration add a registration routine. diff --git a/epan/dissectors/packet-gsm_a_rr.c b/epan/dissectors/packet-gsm_a_rr.c index 1537fc6ba5..ee0f7a76e4 100644 --- a/epan/dissectors/packet-gsm_a_rr.c +++ b/epan/dissectors/packet-gsm_a_rr.c @@ -53,6 +53,8 @@ void proto_reg_handoff_gsm_a_rr(void); static dissector_handle_t rrc_irat_ho_info_handle; static dissector_handle_t rrc_irat_ho_to_utran_cmd_handle; +static guint gsm_a_rr_nri_length = 0; + #define PADDING_BYTE 0x2B /* 3GPP TS 44.018 version 11.2.0 Release 11 */ @@ -517,6 +519,7 @@ static int hf_gsm_a_rr_start_mode = -1; static int hf_gsm_a_rr_timing_adv = -1; static int hf_gsm_a_rr_time_diff = -1; static int hf_gsm_a_rr_tlli = -1; +static int hf_gsm_a_rr_nri = -1; static int hf_gsm_a_rr_target_mode = -1; static int hf_gsm_a_rr_wait_indication = -1; static int hf_gsm_a_rr_seq_code = -1; @@ -8629,6 +8632,12 @@ de_rr_tlli(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offs tlli = tvb_get_ntohl(tvb, curr_offset); proto_tree_add_item(tree, hf_gsm_a_rr_tlli, tvb, curr_offset, 4, ENC_BIG_ENDIAN); + + if(gsm_a_rr_nri_length > 0) { + /* NRI is in second byte of TLLI */ + proto_tree_add_bits_item(tree, hf_gsm_a_rr_nri, tvb, (curr_offset+1)*8, gsm_a_rr_nri_length, ENC_BIG_ENDIAN); + } + curr_offset = curr_offset + 4; if(add_string) g_snprintf(add_string, string_len, " - 0x%x", tlli); @@ -12556,6 +12565,11 @@ proto_register_gsm_a_rr(void) FT_UINT32,BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_gsm_a_rr_nri, + { "NRI","gsm_a.rr.nri", + FT_UINT8,BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, { &hf_gsm_a_rr_target_mode, { "Target mode","gsm_a.rr.target_mode", FT_UINT8,BASE_DEC, NULL, 0xc0, @@ -14817,6 +14831,7 @@ proto_register_gsm_a_rr(void) { &ei_gsm_a_rr_missing_mandatory_element, { "gsm_a.rr.missing_mandatory_element", PI_PROTOCOL, PI_ERROR, "Missing Mandatory element, rest of dissection is suspect", EXPFILL }}, }; + module_t *gsm_a_rr_module; expert_module_t* expert_a_rr; ett[0] = &ett_ccch_msg; @@ -14883,6 +14898,12 @@ proto_register_gsm_a_rr(void) /* subtree array (for both sub-dissectors) */ proto_register_subtree_array(ett, array_length(ett)); + + /* Register configuration options */ + gsm_a_rr_module = prefs_register_protocol(proto_a_rr, NULL); + prefs_register_uint_preference(gsm_a_rr_module, "nri_length", "NRI length", + "Whether to decode NRI in TLLI. NRI is not used if length is zero", + 10, &gsm_a_rr_nri_length); } void