don't blindly assume a nAS-PDU in S1AP; check for it

Fixes

Traceback (most recent call last):
  File "/tmp/s1ap_reiniger.py", line 243, in <module>
    handle_pcap(sys.argv[1], sys.argv[2])
  File "/tmp/s1ap_reiniger.py", line 214, in handle_pcap
    pkt = handle_sctp_pkt(pkt)
  File "/tmp/s1ap_reiniger.py", line 193, in handle_sctp_pkt
    success = handle_sctp_chunk(chunk)
  File "/tmp/s1ap_reiniger.py", line 167, in handle_sctp_chunk
    handle_s1ap(s1ap())
  File "/tmp/s1ap_reiniger.py", line 149, in handle_s1ap
    find_and_handle_s1ap_nested_nas_pdu(msg[1]['value'])
  File "/tmp/s1ap_reiniger.py", line 118, in find_and_handle_s1ap_nested_nas_pdu
    pdu = handle_nas_pdu(item['value'][1]['nAS-PDU'], dl = True)
KeyError: 'nAS-PDU'
This commit is contained in:
Harald Welte 2019-09-27 09:49:51 +02:00
parent 0968f13a5d
commit a45e8b354c
1 changed files with 3 additions and 2 deletions

View File

@ -114,8 +114,9 @@ def find_and_handle_s1ap_nested_nas_pdu(msg):
for item in ie['value'][1]:
if item['value'][0] in IEs.values():
pdu = handle_nas_pdu(item['value'][1]['nAS-PDU'], dl = True)
item['value'][1]['nAS-PDU'] = pdu
if 'nAS-PDU' in item['value'][1]:
pdu = handle_nas_pdu(item['value'][1]['nAS-PDU'], dl = True)
item['value'][1]['nAS-PDU'] = pdu
def handle_s1ap(msg, pkt_number):
log.info("Processing S1AP message '%s:%s' (Packet %d)" % (msg[0], msg[1]['value'][0], pkt_number))