From 0db02a89f3cb0bca3a8c6a796e7bd8822e4b3c3f Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Mon, 6 Jan 2020 01:50:11 +0100 Subject: GSUP/SMS: also dissect ToN/NPI header in SM-RP-DA/OA Unlike IMSI, both MSISDN and SMSC Address in SM-RP-OA/DA not only contain the BCD encoded digits, but also a little header with NPI (Numbering Plan Identification), ToN (Type of Number), and Extension fields. IE: SM-RP-DA (Destination Address) Information Element Identifier: SM-RP-DA (Destination Address) (65) Information Element Length: 8 Address Type: SMSC Address (3) 1... .... = Extension: No Extension .001 .... = Nature of number: International Number (0x1) .... 0001 = Number plan: ISDN/Telephony Numbering (Rec ITU-T E.164) (0x1) E.164 number (MSISDN): 447785016005 Country Code: United Kingdom of Great Britain and Northern Ireland (44) Let's dissect that header and following address bytes using the public API from MAP dissector - dissect_gsm_map_msisdn(). Change-Id: Idc8a098926d38770002ba689efcf2c794c6b18d9 Reviewed-on: https://code.wireshark.org/review/35664 Reviewed-by: Pascal Quantin Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-gsm_gsup.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/epan/dissectors/packet-gsm_gsup.c b/epan/dissectors/packet-gsm_gsup.c index 50d7add060..8b8ae4ad59 100644 --- a/epan/dissectors/packet-gsm_gsup.c +++ b/epan/dissectors/packet-gsm_gsup.c @@ -27,8 +27,10 @@ #include #include #include +#include #include "packet-gsm_a_common.h" +#include "packet-gsm_map.h" #include "packet-e164.h" #include "packet-e212.h" #include "packet-dns.h" @@ -494,6 +496,7 @@ static void dissect_ss_info_ie(tvbuff_t *tvb, packet_info *pinfo, guint offset, static void dissect_sm_rp_da_ie(tvbuff_t *tvb, packet_info *pinfo, guint offset, guint ie_len, proto_tree *tree) { + tvbuff_t *addr_tvb; proto_item *ti; guint8 id_type; @@ -515,8 +518,8 @@ static void dissect_sm_rp_da_ie(tvbuff_t *tvb, packet_info *pinfo, guint offset, break; case OSMO_GSUP_SMS_SM_RP_ODA_MSISDN: case OSMO_GSUP_SMS_SM_RP_ODA_SMSC_ADDR: - dissect_e164_msisdn(tvb, tree, - offset + 2, ie_len - 2, E164_ENC_BCD); + addr_tvb = tvb_new_subset_length(tvb, offset + 1, ie_len - 1); + dissect_gsm_map_msisdn(addr_tvb, pinfo, tree); break; /* Special case for noSM-RP-DA and noSM-RP-OA */ @@ -539,6 +542,7 @@ static void dissect_sm_rp_da_ie(tvbuff_t *tvb, packet_info *pinfo, guint offset, static void dissect_sm_rp_oa_ie(tvbuff_t *tvb, packet_info *pinfo, guint offset, guint ie_len, proto_tree *tree) { + tvbuff_t *addr_tvb; proto_item *ti; guint8 id_type; @@ -556,8 +560,8 @@ static void dissect_sm_rp_oa_ie(tvbuff_t *tvb, packet_info *pinfo, guint offset, switch (id_type) { case OSMO_GSUP_SMS_SM_RP_ODA_MSISDN: case OSMO_GSUP_SMS_SM_RP_ODA_SMSC_ADDR: - dissect_e164_msisdn(tvb, tree, - offset + 2, ie_len - 2, E164_ENC_BCD); + addr_tvb = tvb_new_subset_length(tvb, offset + 1, ie_len - 1); + dissect_gsm_map_msisdn(addr_tvb, pinfo, tree); break; /* Special case for noSM-RP-DA and noSM-RP-OA */ -- cgit v1.2.3