From 3a261d31d5c7654ced2dcaace1277a77df424321 Mon Sep 17 00:00:00 2001 From: herlesupreeth Date: Tue, 5 Jan 2021 09:20:11 +0100 Subject: utils.py: Bugfix for parsing non-programmed EFePDGSelection Change-Id: I3a16af785d8ae9ea8730771367bba2d50690b414 --- pySim/utils.py | 7 ++++++- pysim-testdata/sysmoISIM-SJA2.ok | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pySim/utils.py b/pySim/utils.py index ebc2a95..cdb2926 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -651,6 +651,7 @@ def dec_ePDGSelection(sixhexbytes): def format_ePDGSelection(hexstr): ePDGSelection_info_tag_chars = 2 ePDGSelection_info_tag_str = hexstr[:2] + s = "" # Minimum length len_chars = 2 # TODO: Need to determine length properly - definite length support only @@ -659,6 +660,11 @@ def format_ePDGSelection(hexstr): # But, each PLMN entry is made of PLMN (3 Bytes) + ePDG Priority (2 Bytes) + ePDG FQDN format (1 Byte) # Totalling to 6 Bytes, maybe length should be 6n len_str = hexstr[ePDGSelection_info_tag_chars:ePDGSelection_info_tag_chars+len_chars] + + # Not programmed scenario + if int(len_str, 16) == 255 or int(ePDGSelection_info_tag_str, 16) == 255: + len_chars = 0 + ePDGSelection_info_tag_chars = 0 if len_str[0] == '8': # The bits 7 to 1 denotes the number of length octets if length > 127 if int(len_str[1]) > 0: @@ -669,7 +675,6 @@ def format_ePDGSelection(hexstr): content_str = hexstr[ePDGSelection_info_tag_chars+len_chars:] # Right pad to prevent index out of range - multiple of 6 bytes content_str = rpad(content_str, len(content_str) + (12 - (len(content_str) % 12))) - s = "" for rec_data in hexstr_to_Nbytearr(content_str, 6): rec_info = dec_ePDGSelection(rec_data) if rec_info['mcc'] == 0xFFF and rec_info['mnc'] == 0xFFF: diff --git a/pysim-testdata/sysmoISIM-SJA2.ok b/pysim-testdata/sysmoISIM-SJA2.ok index b6836e7..94c4328 100644 --- a/pysim-testdata/sysmoISIM-SJA2.ok +++ b/pysim-testdata/sysmoISIM-SJA2.ok @@ -108,7 +108,7 @@ EHPLMN: ffffff # unused ffffff # unused -USIM Service Table: beff9f9de73e0408400170730000002e00000000 +USIM Service Table: beff9f9de73e0408400170330006002e00000000 Service 2 - Fixed Dialling Numbers (FDN) Service 3 - Extension 2 Service 4 - Service Dialling Numbers (SDN) @@ -156,7 +156,8 @@ USIM Service Table: beff9f9de73e0408400170730000002e00000000 Service 90 - Operator CSG Lists and corresponding indications Service 93 - Communication Control for IMS by USIM Service 94 - Extended Terminal Applications - Service 95 - Support of UICC access to IMS + Service 106 - ePDG configuration Information support + Service 107 - ePDG configuration Information configured Service 122 - 5GS Mobility Management Information Service 123 - 5G Security Parameters Service 124 - Subscription identifier privacy support -- cgit v1.2.3