fix: No S-TMSI in InitialUEMessage (#890)
This commit is contained in:
parent
3a2a227b48
commit
cc30aa2a9a
|
@ -1265,17 +1265,18 @@ amf_ue_t *amf_ue_find_by_message(ogs_nas_5gs_message_t *message)
|
|||
{
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
ogs_nas_5gs_registration_request_t *registration_request = NULL;
|
||||
#if 0
|
||||
ogs_nas_5gs_tracking_area_update_request_t *tau_request = NULL;
|
||||
#endif
|
||||
ogs_nas_5gs_deregistration_request_from_ue_t *deregistration_request = NULL;
|
||||
ogs_nas_5gs_service_request_t *service_request = NULL;
|
||||
ogs_nas_5gs_mobile_identity_t *mobile_identity = NULL;
|
||||
ogs_nas_5gs_mobile_identity_header_t *mobile_identity_header = NULL;
|
||||
ogs_nas_5gs_mobile_identity_guti_t *mobile_identity_guti = NULL;
|
||||
ogs_nas_5gs_mobile_identity_s_tmsi_t *mobile_identity_s_tmsi = NULL;
|
||||
ogs_nas_5gs_guti_t nas_guti;
|
||||
|
||||
char *suci = NULL;
|
||||
|
||||
ogs_assert(message);
|
||||
memset(&nas_guti, 0, sizeof(ogs_nas_5gs_guti_t));
|
||||
|
||||
switch (message->gmm.h.message_type) {
|
||||
case OGS_NAS_5GS_REGISTRATION_REQUEST:
|
||||
|
@ -1284,8 +1285,10 @@ amf_ue_t *amf_ue_find_by_message(ogs_nas_5gs_message_t *message)
|
|||
mobile_identity = ®istration_request->mobile_identity;
|
||||
ogs_assert(mobile_identity);
|
||||
|
||||
if (!mobile_identity->length || !mobile_identity->buffer)
|
||||
if (!mobile_identity->length || !mobile_identity->buffer) {
|
||||
ogs_error("No Mobilie Identity [%d]", mobile_identity->length);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mobile_identity_header =
|
||||
(ogs_nas_5gs_mobile_identity_header_t *)mobile_identity->buffer;
|
||||
|
@ -1303,15 +1306,10 @@ amf_ue_t *amf_ue_find_by_message(ogs_nas_5gs_message_t *message)
|
|||
}
|
||||
ogs_free(suci);
|
||||
break;
|
||||
|
||||
case OGS_NAS_5GS_MOBILE_IDENTITY_GUTI:
|
||||
mobile_identity_guti =
|
||||
(ogs_nas_5gs_mobile_identity_guti_t *)mobile_identity->buffer;
|
||||
|
||||
if (!mobile_identity_guti) {
|
||||
ogs_error("No mobile identity");
|
||||
return NULL;
|
||||
}
|
||||
ogs_assert(mobile_identity_guti);
|
||||
|
||||
ogs_nas_5gs_mobile_identity_guti_to_nas_guti(
|
||||
mobile_identity_guti, &nas_guti);
|
||||
|
@ -1327,8 +1325,93 @@ amf_ue_t *amf_ue_find_by_message(ogs_nas_5gs_message_t *message)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown SUCI type [%d]", mobile_identity_header->type);
|
||||
ogs_error("Unknown Mobile Identity type [%d]",
|
||||
mobile_identity_header->type);
|
||||
}
|
||||
break;
|
||||
case OGS_NAS_5GS_SERVICE_REQUEST:
|
||||
service_request = &message->gmm.service_request;
|
||||
ogs_assert(service_request);
|
||||
mobile_identity = &service_request->s_tmsi;
|
||||
ogs_assert(mobile_identity);
|
||||
|
||||
if (!mobile_identity->length || !mobile_identity->buffer) {
|
||||
ogs_error("No Mobilie Identity [%d]", mobile_identity->length);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mobile_identity_header =
|
||||
(ogs_nas_5gs_mobile_identity_header_t *)mobile_identity->buffer;
|
||||
|
||||
switch (mobile_identity_header->type) {
|
||||
case OGS_NAS_5GS_MOBILE_IDENTITY_S_TMSI:
|
||||
mobile_identity_s_tmsi =
|
||||
(ogs_nas_5gs_mobile_identity_s_tmsi_t *)mobile_identity->buffer;
|
||||
ogs_assert(mobile_identity_s_tmsi);
|
||||
|
||||
/* Use the first configured plmn_id and mme group id */
|
||||
ogs_nas_from_plmn_id(&nas_guti.nas_plmn_id,
|
||||
&amf_self()->served_guami[0].plmn_id);
|
||||
nas_guti.amf_id.region = amf_self()->served_guami[0].amf_id.region;
|
||||
|
||||
/* Getting from S_TMSI */
|
||||
nas_guti.amf_id.set1 = mobile_identity_s_tmsi->set1;
|
||||
nas_guti.amf_id.set2 = mobile_identity_s_tmsi->set2;
|
||||
nas_guti.amf_id.pointer = mobile_identity_s_tmsi->pointer;
|
||||
|
||||
nas_guti.m_tmsi = be32toh(mobile_identity_s_tmsi->m_tmsi);
|
||||
|
||||
amf_ue = amf_ue_find_by_guti(&nas_guti);
|
||||
if (amf_ue) {
|
||||
ogs_info("[%s] Known UE by 5G-S_TMSI[AMF_ID:0x%x,M_TMSI:0x%x]",
|
||||
amf_ue->suci ? amf_ue->suci : "Unknown",
|
||||
ogs_amf_id_hexdump(&nas_guti.amf_id), nas_guti.m_tmsi);
|
||||
} else {
|
||||
ogs_info("Unknown UE by 5G-S_TMSI[AMF_ID:0x%x,M_TMSI:0x%x]",
|
||||
ogs_amf_id_hexdump(&nas_guti.amf_id), nas_guti.m_tmsi);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown Mobile Identity type [%d]",
|
||||
mobile_identity_header->type);
|
||||
}
|
||||
break;
|
||||
case OGS_NAS_5GS_DEREGISTRATION_REQUEST:
|
||||
deregistration_request = &message->gmm.deregistration_request_from_ue;
|
||||
ogs_assert(deregistration_request);
|
||||
mobile_identity = &deregistration_request->mobile_identity;
|
||||
ogs_assert(mobile_identity);
|
||||
|
||||
if (!mobile_identity->length || !mobile_identity->buffer) {
|
||||
ogs_error("No Mobilie Identity [%d]", mobile_identity->length);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mobile_identity_header =
|
||||
(ogs_nas_5gs_mobile_identity_header_t *)mobile_identity->buffer;
|
||||
|
||||
switch (mobile_identity_header->type) {
|
||||
case OGS_NAS_5GS_MOBILE_IDENTITY_GUTI:
|
||||
mobile_identity_guti =
|
||||
(ogs_nas_5gs_mobile_identity_guti_t *)mobile_identity->buffer;
|
||||
ogs_assert(mobile_identity_guti);
|
||||
|
||||
ogs_nas_5gs_mobile_identity_guti_to_nas_guti(
|
||||
mobile_identity_guti, &nas_guti);
|
||||
|
||||
amf_ue = amf_ue_find_by_guti(&nas_guti);
|
||||
if (amf_ue) {
|
||||
ogs_info("[%s] Known UE by 5G-S_TMSI[AMF_ID:0x%x,M_TMSI:0x%x]",
|
||||
amf_ue->suci ? amf_ue->suci : "Unknown",
|
||||
ogs_amf_id_hexdump(&nas_guti.amf_id), nas_guti.m_tmsi);
|
||||
} else {
|
||||
ogs_info("Unknown UE by 5G-S_TMSI[AMF_ID:0x%x,M_TMSI:0x%x]",
|
||||
ogs_amf_id_hexdump(&nas_guti.amf_id), nas_guti.m_tmsi);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown Mobile Identity type [%d]",
|
||||
mobile_identity_header->type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -2250,6 +2250,7 @@ mme_ue_t *mme_ue_find_by_message(ogs_nas_eps_message_t *message)
|
|||
{
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
ogs_nas_eps_attach_request_t *attach_request = NULL;
|
||||
ogs_nas_eps_detach_request_from_ue_t *detach_request = NULL;
|
||||
ogs_nas_eps_tracking_area_update_request_t *tau_request = NULL;
|
||||
ogs_nas_eps_extended_service_request_t *extended_service_request = NULL;
|
||||
ogs_nas_eps_mobile_identity_t *eps_mobile_identity = NULL;
|
||||
|
@ -2302,13 +2303,10 @@ mme_ue_t *mme_ue_find_by_message(ogs_nas_eps_message_t *message)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown IMSI type [%d]", eps_mobile_identity->imsi.type);
|
||||
break;
|
||||
ogs_error("Unknown EPS Mobile Identity Type [%d]",
|
||||
eps_mobile_identity->imsi.type);
|
||||
}
|
||||
break;
|
||||
case OGS_NAS_EPS_DETACH_REQUEST:
|
||||
/* TODO */
|
||||
break;
|
||||
case OGS_NAS_EPS_TRACKING_AREA_UPDATE_REQUEST:
|
||||
tau_request = &message->emm.tracking_area_update_request;
|
||||
eps_mobile_identity = &tau_request->old_guti;
|
||||
|
@ -2337,8 +2335,40 @@ mme_ue_t *mme_ue_find_by_message(ogs_nas_eps_message_t *message)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown IMSI type [%d]", eps_mobile_identity->imsi.type);
|
||||
ogs_error("Unknown EPS Mobile Identity Type [%d]",
|
||||
eps_mobile_identity->imsi.type);
|
||||
}
|
||||
break;
|
||||
case OGS_NAS_EPS_DETACH_REQUEST:
|
||||
detach_request = &message->emm.detach_request_from_ue;
|
||||
eps_mobile_identity = &detach_request->eps_mobile_identity;
|
||||
|
||||
switch(eps_mobile_identity->imsi.type) {
|
||||
case OGS_NAS_EPS_MOBILE_IDENTITY_GUTI:
|
||||
eps_mobile_identity_guti = &eps_mobile_identity->guti;
|
||||
|
||||
ogs_nas_guti.nas_plmn_id = eps_mobile_identity_guti->nas_plmn_id;
|
||||
ogs_nas_guti.mme_gid = eps_mobile_identity_guti->mme_gid;
|
||||
ogs_nas_guti.mme_code = eps_mobile_identity_guti->mme_code;
|
||||
ogs_nas_guti.m_tmsi = eps_mobile_identity_guti->m_tmsi;
|
||||
|
||||
mme_ue = mme_ue_find_by_guti(&ogs_nas_guti);
|
||||
if (mme_ue) {
|
||||
ogs_info("[%s] Known UE by GUTI[G:%d,C:%d,M_TMSI:0x%x]",
|
||||
mme_ue->imsi_bcd,
|
||||
ogs_nas_guti.mme_gid,
|
||||
ogs_nas_guti.mme_code,
|
||||
ogs_nas_guti.m_tmsi);
|
||||
} else {
|
||||
ogs_info("Unknown UE by GUTI[G:%d,C:%d,M_TMSI:0x%x]",
|
||||
ogs_nas_guti.mme_gid,
|
||||
ogs_nas_guti.mme_code,
|
||||
ogs_nas_guti.m_tmsi);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown EPS Mobile Identity Type [%d]",
|
||||
eps_mobile_identity->imsi.type);
|
||||
}
|
||||
break;
|
||||
case OGS_NAS_EPS_EXTENDED_SERVICE_REQUEST:
|
||||
|
@ -2372,8 +2402,8 @@ mme_ue_t *mme_ue_find_by_message(ogs_nas_eps_message_t *message)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown TMSI type [%d]", mobile_identity->tmsi.type);
|
||||
break;
|
||||
ogs_error("Unknown Mobile Identity Type [%d]",
|
||||
mobile_identity->tmsi.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -421,10 +421,32 @@ static void test2_func(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(test_ue, recvbuf);
|
||||
|
||||
/* Send UEContextReleaseRequest */
|
||||
sendbuf = testngap_build_ue_context_release_request(test_ue,
|
||||
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
|
||||
true);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive UEContextReleaseCommand */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(test_ue, recvbuf);
|
||||
ABTS_INT_EQUAL(tc,
|
||||
NGAP_ProcedureCode_id_UEContextRelease,
|
||||
test_ue->ngap_procedure_code);
|
||||
|
||||
/* Send UEContextReleaseComplete */
|
||||
sendbuf = testngap_build_ue_context_release_complete(test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Send De-registration request */
|
||||
gmmbuf = testgmm_build_de_registration_request(test_ue, 1);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf);
|
||||
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, false);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
@ -836,10 +858,32 @@ static void test3_func(abts_case *tc, void *data)
|
|||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
/* Send UEContextReleaseRequest */
|
||||
sendbuf = testngap_build_ue_context_release_request(test_ue,
|
||||
NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_user_inactivity,
|
||||
true);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive UEContextReleaseCommand */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(test_ue, recvbuf);
|
||||
ABTS_INT_EQUAL(tc,
|
||||
NGAP_ProcedureCode_id_UEContextRelease,
|
||||
test_ue->ngap_procedure_code);
|
||||
|
||||
/* Send UEContextReleaseComplete */
|
||||
sendbuf = testngap_build_ue_context_release_complete(test_ue);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Send De-registration request */
|
||||
gmmbuf = testgmm_build_de_registration_request(test_ue, 1);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf);
|
||||
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, false, false);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
|
|
@ -266,7 +266,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, nasbuf);
|
||||
ABTS_PTR_NOTNULL(tc, gmmbuf);
|
||||
|
||||
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, true);
|
||||
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, false, true);
|
||||
ABTS_PTR_NOTNULL(tc, sendbuf);
|
||||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
|
Loading…
Reference in New Issue