diff options
author | Supreeth Herle <herlesupreeth@gmail.com> | 2020-03-25 14:52:46 +0100 |
---|---|---|
committer | herlesupreeth <herlesupreeth@gmail.com> | 2021-01-05 11:46:41 +0100 |
commit | 43fd03b62774db3d39a5b61bca57dadd3b8e07e4 (patch) | |
tree | 8bd3a2cb13a9aa53fdad77031d86813a994936b5 | |
parent | 654eca72c992e9a75affc9ee2f2c488bc09693e2 (diff) |
utils.py: Support IPv4 decoding for Address TLV object present in EF.ePDGId and EF.ePDGIdEm
Change-Id: I96c30c1fcc03e50c55e9db7e6a18297a3b1d889d
-rw-r--r-- | pySim/utils.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pySim/utils.py b/pySim/utils.py index 782cb8b..3838eff 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -530,12 +530,18 @@ def dec_addr_tlv(hexstr): # First byte in the value has the address type addr_type = tlv[2][0] - # TODO: Support parsing of IPv4 and IPv6 + # TODO: Support parsing of IPv6 # Address Type: 0x00 (FQDN), 0x01 (IPv4), 0x02 (IPv6), other (Reserved) if addr_type == 0x00: #FQDN # Skip address tye byte i.e. first byte in value list content = tlv[2][1:] s += "\t%s # %s\n" % (i2h(content), i2s(content)) + elif addr_type == 0x01: #IPv4 + # Skip address tye byte i.e. first byte in value list + # Skip the unused byte in Octect 4 after address type byte as per 3GPP TS 31.102 + ipv4 = tlv[2][2:] + content = '.'.join(str(x) for x in ipv4) + s += "\t%s # %s\n" % (i2h(ipv4), content) return s |