laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35376?usp=email )
Change subject: S1AP_Emulation: Fix NAS_PDU decoding of InitialContextSetupRequest msg ......................................................................
S1AP_Emulation: Fix NAS_PDU decoding of InitialContextSetupRequest msg
The InitialContextSetupRequest message contains a NAS_PDU deep inside (in E-RABToBeSetupListCtxtSUReq), and it was not being rx_counted nor decoded by the S1AP_Emulation. Since we also care about the lower layer contents from the emulation user point of view, first send the S1AP_PDU and later the decoded NAS_PDU. This way the user can wait to receive the related low level S1AP_PDU, and then read again from the port to get the decoded NAS_PDU.
Change-Id: Ibff5a38b92deafa8d104801f107ca1b8b82bbce0 --- M library/S1AP_Emulation.ttcn 1 file changed, 36 insertions(+), 1 deletion(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve
diff --git a/library/S1AP_Emulation.ttcn b/library/S1AP_Emulation.ttcn index bb3a2a4..9f36225 100644 --- a/library/S1AP_Emulation.ttcn +++ b/library/S1AP_Emulation.ttcn @@ -503,6 +503,11 @@ if (match(nas, tr_NAS_EMM_SecurityProtected)) { nas := f_nas_try_decaps(S1apAssociationTable[assoc_id].nus, nas); } + /* DL/UlNasTransport are not interesting, don't send them */ + if (not match(mrf.msg, (tr_S1AP_DlNasTransport, tr_S1AP_UlNasTransport))) { + /* send raw S1AP */ + S1AP_CLIENT.send(mrf.msg) to vc_conn; + } /* send decoded NAS */ S1AP_CLIENT.send(nas) to vc_conn; } else { @@ -771,7 +776,7 @@
function f_S1AP_get_NAS_PDU(S1AP_PDU s1ap) return template (omit) NAS_PDU { - var integer i; + var integer i, j;
if (ischosen(s1ap.initiatingMessage)) { var InitiatingMessage im := s1ap.initiatingMessage; @@ -792,6 +797,19 @@ } } } + case (tr_S1AP_IntialCtxSetupReq) { + var InitialContextSetupRequest msg := im.value_.initialContextSetupRequest; + for (i := 0; i < lengthof(msg.protocolIEs); i := i+1) { + if (msg.protocolIEs[i].id == id_E_RABToBeSetupListCtxtSUReq) { + var E_RABToBeSetupListCtxtSUReq rab_req := msg.protocolIEs[i].value_.E_RABToBeSetupListCtxtSUReq; + for (j := 0; j < lengthof(rab_req); j := j+1) { + var E_RABToBeSetupItemCtxtSUReq it := rab_req[j].value_.E_RABToBeSetupItemCtxtSUReq; + return it.nAS_PDU; + } + } + } + return omit; + } } } return omit;