aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-03-25 15:30:16 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2020-03-25 21:34:17 +0100
commit4c20a05d41f47ec412b3b41985c59f6bca0b69b2 (patch)
tree1bef15d0ed3bff6c0c6f23d409aa22931a4ae660
parent439005cc2c78258d47a85e4b161df9c37041e60a (diff)
WIP: gm: Decode GSM GM MS RA Capabilities IE with RLCMAC CSN1 decoderpespin/racap
Tested with a sample pcap file containing an GSM GM packet (Attach Request) with an MS Radio Access Capabilities IE containing several entries. TODO: * Check if by dropping the ad-hoc decoder we lose support/features. * Drop de_gmm_ms_radio_acc_cap and replace it with de_gmm_ms_radio_acc_cap_rlcmac(), since there are other users of that function in other protocol dissectors. Then all benefit from the change. More than 1k lines of code can be dropped. * Some general clean up required Change-Id: I096eafcb5ca31d0ad1fa63561f43853ee4e7a40f
-rw-r--r--epan/dissectors/packet-gsm_a_gm.c15
-rw-r--r--epan/dissectors/packet-gsm_rlcmac.c17
2 files changed, 29 insertions, 3 deletions
diff --git a/epan/dissectors/packet-gsm_a_gm.c b/epan/dissectors/packet-gsm_a_gm.c
index efda8c3716..181e3ce893 100644
--- a/epan/dissectors/packet-gsm_a_gm.c
+++ b/epan/dissectors/packet-gsm_a_gm.c
@@ -84,6 +84,7 @@
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/ipproto.h>
+#include "packet-gsm_rlcmac.h"
#include "packet-ber.h"
#include "packet-gsm_a_common.h"
#include "packet-e212.h"
@@ -586,6 +587,7 @@ static expert_field ei_gsm_a_gm_missing_mandatory_element = EI_INIT;
static dissector_handle_t rrc_irat_ho_info_handle;
static dissector_handle_t lte_rrc_ue_eutra_cap_handle;
static dissector_handle_t nbifom_handle;
+static dissector_handle_t rlcmac_racap_handle;
static dissector_table_t gprs_sm_pco_subdissector_table; /* GPRS SM PCO PPP Protocols */
@@ -1641,6 +1643,16 @@ static const value_string gsm_a_gm_ec_pch_mon_support_vals[] = {
};
guint16
+de_gmm_ms_radio_acc_cap_rlcmac(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
+{
+ tvbuff_t *payload_tvb;
+ payload_tvb = tvb_new_subset_length(tvb, offset, len);
+
+ call_dissector(rlcmac_racap_handle, payload_tvb, pinfo, tree);
+ return len;
+}
+
+guint16
de_gmm_ms_radio_acc_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
{
guint32 curr_offset;
@@ -6239,7 +6251,7 @@ guint16 (*gm_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_
de_gmm_imeisv_req, /* IMEISV Request */
de_gmm_rec_npdu_lst, /* Receive N-PDU Numbers List */
de_gmm_ms_net_cap, /* MS Network Capability */
- de_gmm_ms_radio_acc_cap, /* MS Radio Access Capability */
+ de_gmm_ms_radio_acc_cap_rlcmac, /* MS Radio Access Capability */
de_gmm_cause, /* GMM Cause */
de_gmm_rai, /* Routing Area Identification */
de_gmm_rai2, /* Routing Area Identification 2 */
@@ -9463,6 +9475,7 @@ proto_reg_handoff_gsm_a_gm(void)
rrc_irat_ho_info_handle = find_dissector_add_dependency("rrc.irat.irat_ho_info", proto_a_gm);
lte_rrc_ue_eutra_cap_handle = find_dissector_add_dependency("lte-rrc.ue_eutra_cap", proto_a_gm);
nbifom_handle = find_dissector_add_dependency("nbifom", proto_a_gm);
+ rlcmac_racap_handle = find_dissector_add_dependency("gsm_rlcmac_racap", proto_a_gm);
}
/*
diff --git a/epan/dissectors/packet-gsm_rlcmac.c b/epan/dissectors/packet-gsm_rlcmac.c
index e48228a0b5..244ddce21e 100644
--- a/epan/dissectors/packet-gsm_rlcmac.c
+++ b/epan/dissectors/packet-gsm_rlcmac.c
@@ -2820,13 +2820,11 @@ CSN_DESCR_END (MS_RA_capability_value_t)
* This one would be used to decode for instance MS RA Capabilities IE SGSN->MS on the PCU.
* However, an ad-hoc decoder is used in this scenario in wireshark: See packet-gsm_a_gm.c de_gmm_ms_radio_acc_cap().
*/
-#if 0
static const
CSN_DESCR_BEGIN (MS_Radio_Access_capability_t)
M_REC_TARRAY_1(MS_Radio_Access_capability_t, MS_RA_capability_value, MS_RA_capability_value_t, Count_MS_RA_capability_value, &hf_ms_ra_capability_value),
M_PADDING_BITS(MS_Radio_Access_capability_t, &hf_padding),
CSN_DESCR_END (MS_Radio_Access_capability_t)
-#endif
/* TS44.060 section 12.30 "MS Radio Access Capability 2". Same as above but without spare bits */
static const
@@ -9843,6 +9841,20 @@ dissect_gsm_ec_rlcmac_uplink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
return dissect_gsm_rlcmac_uplink(tvb, pinfo, tree, &rlc_mac);
}
+static int
+dissect_gsm_rlcmac_racap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+{
+ csnStream_t ar;
+ MS_Radio_Access_capability_t racap = {0};
+ int len = tvb_reported_length(tvb);
+ guint16 bit_length = len * 8;
+
+ csnStreamInit(&ar, 0, bit_length, pinfo);
+
+ csnStreamDissector(tree, &ar, CSNDESCR(MS_Radio_Access_capability_t), tvb, &racap, ett_gsm_rlcmac);
+ return len;
+}
+
void
proto_register_gsm_rlcmac(void)
{
@@ -18566,6 +18578,7 @@ proto_register_gsm_rlcmac(void)
proto_register_subtree_array(ett, array_length(ett));
expert_gsm_rlcmac = expert_register_protocol(proto_gsm_rlcmac);
expert_register_field_array(expert_gsm_rlcmac, ei, array_length(ei));
+ register_dissector("gsm_rlcmac_racap", dissect_gsm_rlcmac_racap, proto_gsm_rlcmac);
register_dissector("gsm_rlcmac_ul", dissect_gsm_rlcmac_uplink, proto_gsm_rlcmac);
register_dissector("gsm_rlcmac_dl", dissect_gsm_rlcmac_downlink, proto_gsm_rlcmac);
register_dissector("gsm_ec_rlcmac_ul", dissect_gsm_ec_rlcmac_uplink, proto_gsm_rlcmac);