Wireshark-dev: [Wireshark-dev] Calling the lte-rrc disector from within mac-lte for NB-IoT
Hi,
I'd like to dissect NB-IoT frames using the lte-rrc dissector from
within the mac-lte one. The mac-lte dissector currently only calls the
_normal_ LTE dissectors and I therefore wanted to add support for the
NB-IoT ones as well.
I saw that in packet-mac-lte.h there is already a MAC_LTE_NB_MODE_TAG
tag present. Is that supposed to be used for NB-IoT? If so, how do you
think about the below addition to the mac-lte dissector? It's not meant
to be a pull-request, it's just to see if I got it right.
Thanks
Andre
diff --git a/epan/dissectors/packet-mac-lte.c b/epan/dissectors/packet-mac-lte.c
index e05ea61..920e286 100644
--- a/epan/dissectors/packet-mac-lte.c
+++ b/epan/dissectors/packet-mac-lte.c
@@ -52,6 +52,8 @@ static dissector_handle_t lte_rrc_ul_ccch_handle;
static dissector_handle_t lte_rrc_dl_ccch_handle;
static dissector_handle_t lte_rrc_sbcch_sl_bch_handle;
static dissector_handle_t lte_rrc_sc_mcch_handle;
+static dissector_handle_t lte_rrc_bcch_dl_sch_nb_handle;
+static dissector_handle_t lte_rrc_bcch_bch_nb_handle;
/* Decoding context */
static int hf_mac_lte_context = -1;
@@ -3219,10 +3221,18 @@ static void dissect_bch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Get appropriate dissector handle */
dissector_handle_t protocol_handle = 0;
if (p_mac_lte_info->rntiType == SI_RNTI) {
- protocol_handle = lte_rrc_bcch_dl_sch_handle;
+ if (p_mac_lte_info->nbMode == no_nb_mode) {
+ protocol_handle = lte_rrc_bcch_dl_sch_handle;
+ } else {
+ protocol_handle = lte_rrc_bcch_dl_sch_nb_handle;
+ }
}
else {
- protocol_handle = lte_rrc_bcch_bch_handle;
+ if (p_mac_lte_info->nbMode == no_nb_mode) {
+ protocol_handle = lte_rrc_bcch_bch_handle;
+ } else {
+ protocol_handle = lte_rrc_bcch_bch_nb_handle;
+ }
}
/* Hide raw view of bytes */
@@ -9240,7 +9250,9 @@ void proto_reg_handoff_mac_lte(void)
rlc_lte_handle = find_dissector_add_dependency("rlc-lte", proto_mac_lte);
lte_rrc_bcch_dl_sch_handle = find_dissector_add_dependency("lte_rrc.bcch_dl_sch", proto_mac_lte);
+ lte_rrc_bcch_dl_sch_nb_handle = find_dissector_add_dependency("lte_rrc.bcch_dl_sch.nb", proto_mac_lte);
lte_rrc_bcch_bch_handle = find_dissector_add_dependency("lte_rrc.bcch_bch", proto_mac_lte);
+ lte_rrc_bcch_bch_nb_handle = find_dissector_add_dependency("lte_rrc.bcch_bch.nb", proto_mac_lte);
lte_rrc_pcch_handle = find_dissector_add_dependency("lte_rrc.pcch", proto_mac_lte);
lte_rrc_ul_ccch_handle = find_dissector_add_dependency("lte_rrc.ul_ccch", proto_mac_lte);
lte_rrc_dl_ccch_handle = find_dissector_add_dependency("lte_rrc.dl_ccch", proto_mac_lte);