forked from acouzens/open5gs
[AMF/MME] Fixed crash when no NG/S1 context(#2012)
This commit is contained in:
parent
a8f83989f4
commit
689574a2d9
|
@ -74,11 +74,12 @@ typedef int ogs_err_t;
|
|||
|
||||
#endif
|
||||
|
||||
#define OGS_OK 0
|
||||
#define OGS_ERROR -1
|
||||
#define OGS_RETRY -2
|
||||
#define OGS_TIMEUP -3
|
||||
#define OGS_DONE -4
|
||||
#define OGS_OK 0
|
||||
#define OGS_ERROR -1
|
||||
#define OGS_RETRY -2
|
||||
#define OGS_TIMEUP -3
|
||||
#define OGS_DONE -4
|
||||
#define OGS_NOTFOUND -5
|
||||
|
||||
char *ogs_strerror(ogs_err_t err, char *buf, size_t size);
|
||||
|
||||
|
|
|
@ -318,6 +318,7 @@ ogs_pkbuf_t *ogs_pkbuf_copy_debug(ogs_pkbuf_t *pkbuf, const char *file_line)
|
|||
newbuf = ogs_pkbuf_alloc_debug(NULL, size, file_line);
|
||||
if (!newbuf) {
|
||||
ogs_error("ogs_pkbuf_alloc() failed [size=%d]", size);
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -344,6 +345,7 @@ ogs_pkbuf_t *ogs_pkbuf_copy_debug(ogs_pkbuf_t *pkbuf, const char *file_line)
|
|||
ogs_pool_alloc(&pool->pkbuf, &newbuf);
|
||||
if (!newbuf) {
|
||||
ogs_error("ogs_pkbuf_copy() failed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
ogs_thread_mutex_unlock(&pool->mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ void amf_state_final(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
char buf[OGS_ADDRSTRLEN];
|
||||
const char *api_version = NULL;
|
||||
|
||||
|
@ -621,9 +621,10 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
}
|
||||
|
||||
ogs_error("[%s] Cannot receive SBI message", amf_ue->suci);
|
||||
ogs_expect(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(amf_ue,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(amf_ue,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
|
||||
case OGS_SBI_OBJ_SESS_TYPE:
|
||||
|
@ -638,16 +639,17 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_error("[%d:%d] Cannot receive SBI message",
|
||||
sess->psi, sess->pti);
|
||||
if (sess->payload_container_type) {
|
||||
ogs_expect(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_expect(OGS_OK ==
|
||||
ngap_send_error_indication2(amf_ue,
|
||||
r = ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_transport,
|
||||
NGAP_CauseTransport_transport_resource_unavailable)
|
||||
);
|
||||
NGAP_CauseTransport_transport_resource_unavailable);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -755,10 +757,11 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_fsm_dispatch(&gnb->sm, e);
|
||||
} else {
|
||||
ogs_error("Cannot decode NGAP message");
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_error_indication(
|
||||
r = ngap_send_error_indication(
|
||||
gnb, NULL, NULL, NGAP_Cause_PR_protocol,
|
||||
NGAP_CauseProtocol_abstract_syntax_error_falsely_constructed_message));
|
||||
NGAP_CauseProtocol_abstract_syntax_error_falsely_constructed_message);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
ogs_ngap_free(&ngap_message);
|
||||
|
@ -776,7 +779,9 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
pkbuf = e->pkbuf;
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
ogs_expect(OGS_OK == ngap_send_to_ran_ue(ran_ue, pkbuf));
|
||||
r = ngap_send_to_ran_ue(ran_ue, pkbuf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
ogs_timer_delete(e->timer);
|
||||
break;
|
||||
case AMF_TIMER_NG_HOLDING:
|
||||
|
@ -811,11 +816,13 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (!amf_ue) {
|
||||
amf_ue = amf_ue_add(ran_ue);
|
||||
if (amf_ue == NULL) {
|
||||
ogs_expect(OGS_OK ==
|
||||
ngap_send_ran_ue_context_release_command(ran_ue,
|
||||
r = ngap_send_ran_ue_context_release_command(
|
||||
ran_ue,
|
||||
NGAP_Cause_PR_misc,
|
||||
NGAP_CauseMisc_control_processing_overload,
|
||||
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
|
||||
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return;
|
||||
}
|
||||
|
@ -871,10 +878,11 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
/* De-associate NG with NAS/EMM */
|
||||
ran_ue_deassociate(amf_ue->ran_ue);
|
||||
|
||||
ogs_expect(OGS_OK ==
|
||||
ngap_send_ran_ue_context_release_command(amf_ue->ran_ue,
|
||||
r = ngap_send_ran_ue_context_release_command(amf_ue->ran_ue,
|
||||
NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
|
||||
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
|
||||
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
amf_ue_associate_ran_ue(amf_ue, ran_ue);
|
||||
|
||||
|
|
|
@ -548,7 +548,7 @@ ogs_nas_5gmm_cause_t gmm_handle_service_update(amf_ue_t *amf_ue,
|
|||
{
|
||||
amf_sess_t *sess = NULL;
|
||||
uint16_t psimask = 0;
|
||||
int xact_count = 0;
|
||||
int xact_count = 0, r;
|
||||
|
||||
ogs_nas_uplink_data_status_t *uplink_data_status = NULL;
|
||||
ogs_nas_pdu_session_status_t *pdu_session_status = NULL;
|
||||
|
@ -634,9 +634,11 @@ ogs_nas_5gmm_cause_t gmm_handle_service_update(amf_ue_t *amf_ue,
|
|||
}
|
||||
}
|
||||
|
||||
if (amf_sess_xact_count(amf_ue) == xact_count)
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_service_accept(amf_ue));
|
||||
if (amf_sess_xact_count(amf_ue) == xact_count) {
|
||||
r = nas_5gs_send_service_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
return OGS_5GMM_CAUSE_REQUEST_ACCEPTED;
|
||||
}
|
||||
|
@ -644,6 +646,7 @@ ogs_nas_5gmm_cause_t gmm_handle_service_update(amf_ue_t *amf_ue,
|
|||
int gmm_handle_deregistration_request(amf_ue_t *amf_ue,
|
||||
ogs_nas_5gs_deregistration_request_from_ue_t *deregistration_request)
|
||||
{
|
||||
int r;
|
||||
ogs_nas_de_registration_type_t *de_registration_type = NULL;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
|
@ -690,9 +693,11 @@ int gmm_handle_deregistration_request(amf_ue_t *amf_ue,
|
|||
amf_sbi_send_release_all_sessions(
|
||||
amf_ue, AMF_RELEASE_SM_CONTEXT_NO_STATE);
|
||||
|
||||
if (ogs_list_count(&amf_ue->sess_list) == 0)
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_de_registration_accept(amf_ue));
|
||||
if (ogs_list_count(&amf_ue->sess_list) == 0) {
|
||||
r = nas_5gs_send_de_registration_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
@ -885,6 +890,7 @@ ogs_nas_5gmm_cause_t gmm_handle_security_mode_complete(amf_ue_t *amf_ue,
|
|||
int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
||||
ogs_nas_5gs_ul_nas_transport_t *ul_nas_transport)
|
||||
{
|
||||
int r;
|
||||
ogs_slice_data_t *selected_slice = NULL;
|
||||
amf_sess_t *sess = NULL;
|
||||
amf_nsmf_pdusession_sm_context_param_t param;
|
||||
|
@ -906,34 +912,38 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
|
||||
if (!payload_container_type->value) {
|
||||
ogs_error("[%s] No Payload container type", amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_status(
|
||||
amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION));
|
||||
r = nas_5gs_send_gmm_status(
|
||||
amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
if (!payload_container->length) {
|
||||
ogs_error("[%s] No Payload container length", amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_status(
|
||||
amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION));
|
||||
r = nas_5gs_send_gmm_status(
|
||||
amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
if (!payload_container->buffer) {
|
||||
ogs_error("[%s] No Payload container buffer", amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_status(
|
||||
amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION));
|
||||
r = nas_5gs_send_gmm_status(
|
||||
amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
if ((ul_nas_transport->presencemask &
|
||||
OGS_NAS_5GS_UL_NAS_TRANSPORT_PDU_SESSION_ID_PRESENT) == 0) {
|
||||
ogs_error("[%s] No PDU session ID", amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_status(
|
||||
amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION));
|
||||
r = nas_5gs_send_gmm_status(
|
||||
amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -941,9 +951,10 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
if (*pdu_session_id == OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) {
|
||||
ogs_error("[%s] PDU session identity is unassigned",
|
||||
amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_status(
|
||||
amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION));
|
||||
r = nas_5gs_send_gmm_status(
|
||||
amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -964,9 +975,10 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
if (!sess) {
|
||||
ogs_error("[%s] No Session Context [%d]",
|
||||
amf_ue->supi, gsm_header->message_type);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_status(amf_ue,
|
||||
OGS_5GMM_CAUSE_INSUFFICIENT_USER_PLANE_RESOURCES_FOR_THE_PDU_SESSION));
|
||||
r = nas_5gs_send_gmm_status(amf_ue,
|
||||
OGS_5GMM_CAUSE_INSUFFICIENT_USER_PLANE_RESOURCES_FOR_THE_PDU_SESSION);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -1072,8 +1084,10 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
if (!selected_slice || !sess->dnn) {
|
||||
ogs_warn("[%s] DNN Not Supported OR "
|
||||
"Not Subscribed in the Slice", amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_status(amf_ue, OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE));
|
||||
r = nas_5gs_send_gmm_status(amf_ue,
|
||||
OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -1137,9 +1151,10 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
if (!SESSION_CONTEXT_IN_SMF(sess)) {
|
||||
ogs_error("[%s:%d] Session Context is not in SMF [%d]",
|
||||
amf_ue->supi, sess->psi, gsm_header->message_type);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE, 0));
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -1192,9 +1207,10 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
memset(¶m, 0, sizeof(param));
|
||||
param.acknowledgement_requested = 1;
|
||||
param.guti = 1;
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_configuration_update_command(
|
||||
amf_ue, ¶m));
|
||||
r = nas_5gs_send_configuration_update_command(
|
||||
amf_ue, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
AMF_UE_CLEAR_PAGING_INFO(amf_ue);
|
||||
}
|
||||
|
@ -1212,9 +1228,10 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
default:
|
||||
ogs_error("[%s] Unknown Payload container type [%d]",
|
||||
amf_ue->supi, payload_container_type->value);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_status(amf_ue,
|
||||
OGS_5GMM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED));
|
||||
r = nas_5gs_send_gmm_status(amf_ue,
|
||||
OGS_5GMM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
|
275
src/amf/gmm-sm.c
275
src/amf/gmm-sm.c
|
@ -58,7 +58,7 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
ogs_sbi_message_t *sbi_message = NULL;
|
||||
|
||||
int state = 0;
|
||||
int r, state = 0;
|
||||
|
||||
ogs_assert(e);
|
||||
|
||||
|
@ -96,8 +96,9 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
} else {
|
||||
amf_ue->t3570.retry_count++;
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_identity_request(amf_ue));
|
||||
r = nas_5gs_send_identity_request(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -110,9 +111,10 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
} else {
|
||||
amf_ue->t3522.retry_count++;
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_de_registration_request(amf_ue,
|
||||
OpenAPI_deregistration_reason_NULL));
|
||||
r = nas_5gs_send_de_registration_request(amf_ue,
|
||||
OpenAPI_deregistration_reason_NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -287,9 +289,11 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
break;
|
||||
|
||||
CASE(OGS_SBI_HTTP_METHOD_DELETE)
|
||||
if (state != AMF_NETWORK_INITIATED_DE_REGISTERED)
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_de_registration_accept(amf_ue));
|
||||
if (state != AMF_NETWORK_INITIATED_DE_REGISTERED) {
|
||||
r = nas_5gs_send_de_registration_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
PCF_AM_POLICY_CLEAR(amf_ue);
|
||||
break;
|
||||
|
@ -320,7 +324,7 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
||||
{
|
||||
int i;
|
||||
int i, r;
|
||||
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
amf_sess_t *sess = NULL;
|
||||
|
@ -389,7 +393,9 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
} else {
|
||||
amf_ue->t3513.retry_count++;
|
||||
/* If t3513 is timeout, the saved pkbuf is used. */
|
||||
ogs_assert(OGS_OK == ngap_send_paging(amf_ue));
|
||||
r = ngap_send_paging(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -408,8 +414,9 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
* If t3555 is timeout, the saved pkbuf is used.
|
||||
* In this case, ack should be set to 1 for timer expiration
|
||||
*/
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_configuration_update_command(amf_ue, NULL));
|
||||
r = nas_5gs_send_configuration_update_command(amf_ue, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -422,8 +429,9 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
} else {
|
||||
amf_ue->t3570.retry_count++;
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_identity_request(amf_ue));
|
||||
r = nas_5gs_send_identity_request(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -507,7 +515,7 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
|
||||
{
|
||||
int rv, xact_count = 0;
|
||||
int r, rv, xact_count = 0;
|
||||
ogs_nas_5gmm_cause_t gmm_cause;
|
||||
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
|
@ -548,16 +556,18 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
|
||||
ogs_error("gmm_handle_registration_request() failed [%d]",
|
||||
gmm_cause);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_registration_reject(amf_ue, gmm_cause));
|
||||
r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!AMF_UE_HAVE_SUCI(amf_ue)) {
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->t3570);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_identity_request(amf_ue));
|
||||
r = nas_5gs_send_identity_request(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -568,8 +578,9 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
|
||||
ogs_error("[%s] gmm_handle_registration_update() "
|
||||
"failed [%d]", amf_ue->suci, gmm_cause);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_registration_reject(amf_ue, gmm_cause));
|
||||
r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -595,8 +606,9 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
|
|||
}
|
||||
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->t3550);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_registration_accept(amf_ue));
|
||||
r = nas_5gs_send_registration_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
if (amf_ue->next.m_tmsi)
|
||||
|
@ -628,28 +640,29 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
|
||||
ogs_error("[%s] gmm_handle_service_request() failed [%d]",
|
||||
amf_ue->suci, gmm_cause);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_service_reject(amf_ue, gmm_cause));
|
||||
r = nas_5gs_send_service_reject(amf_ue, gmm_cause);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!AMF_UE_HAVE_SUCI(amf_ue)) {
|
||||
ogs_info("Service request : Unknown UE");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_service_reject(amf_ue,
|
||||
OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
|
||||
);
|
||||
r = nas_5gs_send_service_reject(amf_ue,
|
||||
OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!h.integrity_protected || !SECURITY_CONTEXT_IS_VALID(amf_ue)) {
|
||||
ogs_error("No Security Context");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_service_reject(amf_ue,
|
||||
OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
|
||||
);
|
||||
r = nas_5gs_send_service_reject(amf_ue,
|
||||
OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -659,8 +672,9 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
|
||||
ogs_error("[%s] gmm_handle_service_update() failed [%d]",
|
||||
amf_ue->suci, gmm_cause);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_service_reject(amf_ue, gmm_cause));
|
||||
r = nas_5gs_send_service_reject(amf_ue, gmm_cause);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, gmm_state_exception);
|
||||
}
|
||||
|
||||
|
@ -719,10 +733,11 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
|
|||
/* De-associate NG with NAS/EMM */
|
||||
ran_ue_deassociate(amf_ue->ran_ue);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_ran_ue_context_release_command(amf_ue->ran_ue,
|
||||
r = ngap_send_ran_ue_context_release_command(amf_ue->ran_ue,
|
||||
NGAP_Cause_PR_misc, NGAP_CauseMisc_om_intervention,
|
||||
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
|
||||
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
OGS_FSM_TRAN(s, &gmm_state_de_registered);
|
||||
break;
|
||||
|
@ -789,7 +804,7 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
ogs_nas_5gmm_cause_t gmm_cause;
|
||||
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
|
@ -835,8 +850,9 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
amf_ue, &nas_message->gmm.authentication_response);
|
||||
|
||||
if (rv != OGS_OK) {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_authentication_reject(amf_ue));
|
||||
r = nas_5gs_send_authentication_reject(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
}
|
||||
break;
|
||||
|
@ -893,8 +909,9 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
break;
|
||||
}
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_authentication_reject(amf_ue));
|
||||
r = nas_5gs_send_authentication_reject(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
|
||||
break;
|
||||
|
@ -906,8 +923,9 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
|
||||
ogs_error("[%s] gmm_handle_registration_request() failed [%d]",
|
||||
amf_ue->suci, gmm_cause);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_registration_reject(amf_ue, gmm_cause));
|
||||
r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -944,17 +962,15 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
amf_timer_cfg(AMF_TIMER_T3560)->max_count) {
|
||||
ogs_warn("[%s] Retransmission failed. Stop retransmission",
|
||||
amf_ue->suci);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_authentication_reject(amf_ue));
|
||||
r = nas_5gs_send_authentication_reject(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
} else {
|
||||
rv = nas_5gs_send_authentication_request(amf_ue);
|
||||
if (rv == OGS_OK) {
|
||||
amf_ue->t3560.retry_count++;
|
||||
} else {
|
||||
ogs_error("nas_5gs_send_authentication_request() failed");
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
}
|
||||
amf_ue->t3560.retry_count++;
|
||||
r = nas_5gs_send_authentication_request(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -982,9 +998,10 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_error("[%s] HTTP response error [%d]",
|
||||
amf_ue->suci, sbi_message->res_status);
|
||||
}
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, sbi_message->res_status));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, sbi_message->res_status);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -996,8 +1013,9 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (rv != OGS_OK) {
|
||||
ogs_error("[%s] Cannot handle SBI message",
|
||||
amf_ue->suci);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_authentication_reject(amf_ue));
|
||||
r = nas_5gs_send_authentication_reject(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
}
|
||||
break;
|
||||
|
@ -1007,8 +1025,9 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (rv != OGS_OK) {
|
||||
ogs_error("[%s] Cannot handle SBI message",
|
||||
amf_ue->suci);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_authentication_reject(amf_ue));
|
||||
r = nas_5gs_send_authentication_reject(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
} else {
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_security_mode);
|
||||
|
@ -1042,7 +1061,7 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
int r;
|
||||
ogs_nas_5gmm_cause_t gmm_cause;
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
ogs_nas_5gs_message_t *nas_message = NULL;
|
||||
|
@ -1059,8 +1078,9 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
|
|||
switch (e->h.id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->t3560);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_security_mode_command(amf_ue));
|
||||
r = nas_5gs_send_security_mode_command(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
break;
|
||||
|
@ -1109,8 +1129,9 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_error("[%s] gmm_handle_security_mode_complete() "
|
||||
"failed [%d] in type [%d]",
|
||||
amf_ue->suci, gmm_cause, amf_ue->nas.message_type);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject(amf_ue, gmm_cause));
|
||||
r = nas_5gs_send_gmm_reject(amf_ue, gmm_cause);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -1151,8 +1172,9 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
|
||||
ogs_error("[%s] gmm_handle_registration_request() failed [%d]",
|
||||
amf_ue->suci, gmm_cause);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_registration_reject(amf_ue, gmm_cause));
|
||||
r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -1167,10 +1189,10 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
case OGS_NAS_5GS_SERVICE_REQUEST:
|
||||
ogs_info("[%s] Service request", amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_service_reject(amf_ue,
|
||||
OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
|
||||
);
|
||||
r = nas_5gs_send_service_reject(amf_ue,
|
||||
OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &gmm_state_exception);
|
||||
break;
|
||||
|
||||
|
@ -1199,18 +1221,16 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (amf_ue->t3560.retry_count >=
|
||||
amf_timer_cfg(AMF_TIMER_T3560)->max_count) {
|
||||
ogs_warn("[%s] Retransmission failed. Stop", amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject(amf_ue,
|
||||
OGS_5GMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED));
|
||||
r = nas_5gs_send_gmm_reject(amf_ue,
|
||||
OGS_5GMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
} else {
|
||||
rv = nas_5gs_send_security_mode_command(amf_ue);
|
||||
if (rv == OGS_OK) {
|
||||
amf_ue->t3560.retry_count++;
|
||||
} else {
|
||||
ogs_error("nas_5gs_send_security_mode_command() failed");
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
}
|
||||
amf_ue->t3560.retry_count++;
|
||||
r = nas_5gs_send_security_mode_command(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1227,7 +1247,7 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
||||
{
|
||||
int rv, state, xact_count = 0;
|
||||
int rv, r, state, xact_count = 0;
|
||||
ogs_nas_5gmm_cause_t gmm_cause;
|
||||
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
|
@ -1274,9 +1294,10 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
amf_ue->supi, sbi_message->res_status);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject(
|
||||
amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED));
|
||||
r = nas_5gs_send_gmm_reject(
|
||||
amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -1316,9 +1337,10 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
(sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED)) {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
amf_ue->supi, sbi_message->res_status);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject(
|
||||
amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED));
|
||||
r = nas_5gs_send_gmm_reject(
|
||||
amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -1328,9 +1350,10 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (rv != OGS_OK) {
|
||||
ogs_error("[%s] amf_nudm_sdm_handle_provisioned(%s) failed",
|
||||
amf_ue->supi, sbi_message->h.resource.component[1]);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject(
|
||||
amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED));
|
||||
r = nas_5gs_send_gmm_reject(
|
||||
amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -1360,8 +1383,9 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_assert(amf_ue->nas.message_type ==
|
||||
OGS_NAS_5GS_REGISTRATION_REQUEST);
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->t3550);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_registration_accept(amf_ue));
|
||||
r = nas_5gs_send_registration_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
/* In nsmf-handler.c
|
||||
*
|
||||
|
@ -1465,8 +1489,9 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
*/
|
||||
memset(¶m, 0, sizeof(param));
|
||||
param.nitz = 1;
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_configuration_update_command(amf_ue, ¶m));
|
||||
r = nas_5gs_send_configuration_update_command(amf_ue, ¶m);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
OGS_FSM_TRAN(s, &gmm_state_registered);
|
||||
break;
|
||||
|
@ -1479,8 +1504,9 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
|
||||
ogs_error("[%s] gmm_handle_registration_request() failed [%d]",
|
||||
amf_ue->suci, gmm_cause);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_registration_reject(amf_ue, gmm_cause));
|
||||
r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -1499,10 +1525,10 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
case OGS_NAS_5GS_SERVICE_REQUEST:
|
||||
ogs_info("[%s] Service request", amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_service_reject(amf_ue,
|
||||
OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
|
||||
);
|
||||
r = nas_5gs_send_service_reject(amf_ue,
|
||||
OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &gmm_state_exception);
|
||||
break;
|
||||
|
||||
|
@ -1534,13 +1560,10 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
amf_ue->suci);
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
} else {
|
||||
rv = nas_5gs_send_registration_accept(amf_ue);
|
||||
if (rv == OGS_OK) {
|
||||
amf_ue->t3550.retry_count++;
|
||||
} else {
|
||||
ogs_error("nas_5gs_send_registration_accept() failed");
|
||||
OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
|
||||
}
|
||||
amf_ue->t3550.retry_count++;
|
||||
r = nas_5gs_send_registration_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1557,7 +1580,7 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
||||
{
|
||||
int xact_count = 0;
|
||||
int xact_count = 0, r;
|
||||
ogs_nas_5gmm_cause_t gmm_cause;
|
||||
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
|
@ -1588,11 +1611,13 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
|||
amf_sbi_send_release_all_sessions(
|
||||
amf_ue, AMF_RELEASE_SM_CONTEXT_NO_STATE);
|
||||
|
||||
if (ogs_list_count(&amf_ue->sess_list) == 0)
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_amf_ue_context_release_command(amf_ue,
|
||||
if (ogs_list_count(&amf_ue->sess_list) == 0) {
|
||||
r = ngap_send_amf_ue_context_release_command(amf_ue,
|
||||
NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
|
||||
NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
|
||||
NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
break;
|
||||
|
@ -1617,16 +1642,18 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
|
||||
ogs_error("gmm_handle_registration_request() failed [%d]",
|
||||
gmm_cause);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_registration_reject(amf_ue, gmm_cause));
|
||||
r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!AMF_UE_HAVE_SUCI(amf_ue)) {
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->t3570);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_identity_request(amf_ue));
|
||||
r = nas_5gs_send_identity_request(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
OGS_FSM_TRAN(s, &gmm_state_de_registered);
|
||||
break;
|
||||
|
@ -1639,8 +1666,9 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
|||
if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
|
||||
ogs_error("[%s] gmm_handle_registration_update() "
|
||||
"failed [%d]", amf_ue->suci, gmm_cause);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_registration_reject(amf_ue, gmm_cause));
|
||||
r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, gmm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -1664,8 +1692,9 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
|||
}
|
||||
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->t3550);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_registration_accept(amf_ue));
|
||||
r = nas_5gs_send_registration_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
if (amf_ue->next.m_tmsi)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
int amf_namf_comm_handle_n1_n2_message_transfer(
|
||||
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
int status;
|
||||
int status, r;
|
||||
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
|
@ -206,7 +206,9 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
|
|||
* sm-context-ref is created in [1-CLIENT].
|
||||
* So, the PDU session establishment accpet can be transmitted.
|
||||
*/
|
||||
ogs_expect(OGS_OK == ngap_send_to_ran_ue(ran_ue, ngapbuf));
|
||||
r = ngap_send_to_ran_ue(ran_ue, ngapbuf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
sess->pdu_session_establishment_accept = ngapbuf;
|
||||
}
|
||||
|
@ -285,12 +287,15 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
|
|||
AMF_SESS_STORE_N2_TRANSFER(
|
||||
sess, pdu_session_resource_setup_request, n2buf);
|
||||
|
||||
ogs_assert(OGS_OK == ngap_send_paging(amf_ue));
|
||||
r = ngap_send_paging(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else if (CM_CONNECTED(amf_ue)) {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_send_pdu_session_setup_request(sess, NULL, n2buf));
|
||||
r = nas_send_pdu_session_setup_request(sess, NULL, n2buf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -349,12 +354,15 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
|
|||
OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND,
|
||||
n1buf, n2buf);
|
||||
|
||||
ogs_assert(OGS_OK == ngap_send_paging(amf_ue));
|
||||
r = ngap_send_paging(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else if (CM_CONNECTED(amf_ue)) {
|
||||
ogs_expect(OGS_OK ==
|
||||
nas_send_pdu_session_modification_command(sess, n1buf, n2buf));
|
||||
r = nas_send_pdu_session_modification_command(sess, n1buf, n2buf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
} else {
|
||||
ogs_fatal("[%s] Invalid AMF-UE state", amf_ue->supi);
|
||||
|
@ -386,8 +394,9 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
|
|||
}
|
||||
|
||||
} else if (CM_CONNECTED(amf_ue)) {
|
||||
ogs_expect(OGS_OK ==
|
||||
nas_send_pdu_session_release_command(sess, NULL, n2buf));
|
||||
r = nas_send_pdu_session_release_command(sess, NULL, n2buf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_fatal("[%s] Invalid AMF-UE state", amf_ue->supi);
|
||||
ogs_assert_if_reached();
|
||||
|
@ -512,11 +521,13 @@ cleanup:
|
|||
static int do_network_initiated_de_register(
|
||||
amf_ue_t *amf_ue, OpenAPI_deregistration_reason_e dereg_reason)
|
||||
{
|
||||
int r;
|
||||
if ((CM_CONNECTED(amf_ue)) &&
|
||||
(OGS_FSM_CHECK(&amf_ue->sm, gmm_state_registered))) {
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_de_registration_request(amf_ue, dereg_reason));
|
||||
r = nas_5gs_send_de_registration_request(amf_ue, dereg_reason);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
amf_sbi_send_release_all_sessions(
|
||||
amf_ue, AMF_NETWORK_INITIATED_DE_REGISTERED);
|
||||
|
@ -809,6 +820,7 @@ int amf_namf_callback_handle_sdm_data_change_notify(
|
|||
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
int status = OGS_SBI_HTTP_STATUS_NO_CONTENT;
|
||||
int r;
|
||||
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
|
||||
|
@ -905,8 +917,9 @@ int amf_namf_callback_handle_sdm_data_change_notify(
|
|||
ngapbuf = ngap_build_ue_context_modification_request(amf_ue);
|
||||
ogs_assert(ngapbuf);
|
||||
|
||||
if (nas_5gs_send_to_gnb(amf_ue, ngapbuf) != OGS_OK)
|
||||
ogs_error("nas_5gs_send_to_gnb() failed");
|
||||
r = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
|
|
@ -24,16 +24,20 @@
|
|||
|
||||
int nas_5gs_send_to_gnb(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf)
|
||||
{
|
||||
int rv;
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
if (!amf_ue) {
|
||||
ogs_warn("UE(amf-ue) context has already been removed");
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
return ngap_send_to_ran_ue(amf_ue->ran_ue, pkbuf);
|
||||
rv = ngap_send_to_ran_ue(amf_ue->ran_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int nas_5gs_send_to_downlink_nas_transport(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf)
|
||||
|
@ -46,21 +50,24 @@ int nas_5gs_send_to_downlink_nas_transport(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf)
|
|||
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
if (!amf_ue) {
|
||||
ogs_warn("UE(amf-ue) context has already been removed");
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
if (!ran_ue) {
|
||||
ogs_warn("NG context has already been removed");
|
||||
ogs_error("NG context has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ngapbuf = ngap_build_downlink_nas_transport(
|
||||
ran_ue, pkbuf, false, false);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_build_downlink_nas_transport() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -80,26 +87,37 @@ int nas_5gs_send_registration_accept(amf_ue_t *amf_ue)
|
|||
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ogs_expect_or_return_val(ran_ue, OGS_ERROR);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ogs_debug("[%s] Registration accept", amf_ue->supi);
|
||||
|
||||
if (amf_ue->next.m_tmsi) {
|
||||
if (amf_ue->t3550.pkbuf) {
|
||||
gmmbuf = amf_ue->t3550.pkbuf;
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
} else {
|
||||
gmmbuf = gmm_build_registration_accept(amf_ue);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_registration_accept() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
amf_ue->t3550.pkbuf = ogs_pkbuf_copy(gmmbuf);
|
||||
ogs_expect_or_return_val(amf_ue->t3550.pkbuf, OGS_ERROR);
|
||||
if (!amf_ue->t3550.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(amf_ue->t3550.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(amf_ue->t3550.timer,
|
||||
amf_timer_cfg(AMF_TIMER_T3550)->duration);
|
||||
} else {
|
||||
gmmbuf = gmm_build_registration_accept(amf_ue);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_registration_accept() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -125,31 +143,41 @@ int nas_5gs_send_registration_accept(amf_ue_t *amf_ue)
|
|||
if (ran_ue->initial_context_setup_request_sent == false &&
|
||||
(ran_ue->ue_context_requested == true || transfer_needed == true)) {
|
||||
ngapbuf = ngap_ue_build_initial_context_setup_request(amf_ue, gmmbuf);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_ue_build_initial_context_setup_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
ran_ue->initial_context_setup_request_sent = true;
|
||||
} else {
|
||||
if (transfer_needed == true) {
|
||||
ngapbuf = ngap_ue_build_pdu_session_resource_setup_request(
|
||||
amf_ue, gmmbuf);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_ue_build_pdu_session_resource_setup_request()"
|
||||
" failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
} else {
|
||||
ngapbuf = ngap_build_downlink_nas_transport(
|
||||
ran_ue, gmmbuf, true, true);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_build_downlink_nas_transport() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
}
|
||||
|
||||
return OGS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
int nas_5gs_send_registration_reject(
|
||||
|
@ -165,7 +193,10 @@ int nas_5gs_send_registration_reject(
|
|||
ogs_warn("[%s] Registration reject [%d]", amf_ue->suci, gmm_cause);
|
||||
|
||||
gmmbuf = gmm_build_registration_reject(gmm_cause);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_registration_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -184,12 +215,18 @@ int nas_5gs_send_service_accept(amf_ue_t *amf_ue)
|
|||
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ogs_expect_or_return_val(ran_ue, OGS_ERROR);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ogs_debug("[%s] Service accept", amf_ue->supi);
|
||||
|
||||
gmmbuf = gmm_build_service_accept(amf_ue);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_registration_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Previously, AMF would sends PDUSessionResourceSetupRequest
|
||||
|
@ -214,27 +251,34 @@ int nas_5gs_send_service_accept(amf_ue_t *amf_ue)
|
|||
if (ran_ue->initial_context_setup_request_sent == false &&
|
||||
(ran_ue->ue_context_requested == true || transfer_needed == true)) {
|
||||
ngapbuf = ngap_ue_build_initial_context_setup_request(amf_ue, gmmbuf);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_ue_build_initial_context_setup_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
ran_ue->initial_context_setup_request_sent = true;
|
||||
} else {
|
||||
if (transfer_needed == true) {
|
||||
ngapbuf = ngap_ue_build_pdu_session_resource_setup_request(
|
||||
amf_ue, gmmbuf);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_ue_build_pdu_session_resource_setup_request()"
|
||||
" failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
} else {
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
}
|
||||
|
||||
return OGS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
int nas_5gs_send_service_reject(
|
||||
|
@ -248,7 +292,10 @@ int nas_5gs_send_service_reject(
|
|||
ogs_debug("[%s] Service reject", amf_ue->supi);
|
||||
|
||||
gmmbuf = gmm_build_service_reject(amf_ue, gmm_cause);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_registration_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -265,7 +312,10 @@ int nas_5gs_send_de_registration_accept(amf_ue_t *amf_ue)
|
|||
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ogs_expect_or_return_val(ran_ue, OGS_ERROR);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ogs_debug("[%s] De-registration accept", amf_ue->supi);
|
||||
|
||||
|
@ -273,10 +323,16 @@ int nas_5gs_send_de_registration_accept(amf_ue_t *amf_ue)
|
|||
int rv;
|
||||
|
||||
gmmbuf = gmm_build_de_registration_accept(amf_ue);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_registration_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("nas_5gs_send_to_downlink_nas_transport() failed");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
rv = ngap_send_ran_ue_context_release_command(ran_ue,
|
||||
|
@ -297,25 +353,33 @@ int nas_5gs_send_de_registration_request(amf_ue_t *amf_ue,
|
|||
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ogs_expect_or_return_val(ran_ue, OGS_ERROR);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ogs_debug("[%s] De-registration request", amf_ue->supi);
|
||||
|
||||
if (amf_ue->t3522.pkbuf) {
|
||||
gmmbuf = amf_ue->t3522.pkbuf;
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
} else {
|
||||
gmmbuf = gmm_build_de_registration_request(amf_ue, dereg_reason);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_de_registration_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
amf_ue->t3522.pkbuf = ogs_pkbuf_copy(gmmbuf);
|
||||
ogs_expect_or_return_val(amf_ue->t3522.pkbuf, OGS_ERROR);
|
||||
if (!amf_ue->t3522.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(amf_ue->t3522.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(amf_ue->t3522.timer,
|
||||
amf_timer_cfg(AMF_TIMER_T3522)->duration);
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -331,14 +395,19 @@ int nas_5gs_send_identity_request(amf_ue_t *amf_ue)
|
|||
|
||||
if (amf_ue->t3570.pkbuf) {
|
||||
gmmbuf = amf_ue->t3570.pkbuf;
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
} else {
|
||||
gmmbuf = gmm_build_identity_request(amf_ue);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_identity_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
amf_ue->t3570.pkbuf = ogs_pkbuf_copy(gmmbuf);
|
||||
ogs_expect_or_return_val(amf_ue->t3570.pkbuf, OGS_ERROR);
|
||||
if (!amf_ue->t3570.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(amf_ue->t3570.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(amf_ue->t3570.timer,
|
||||
amf_timer_cfg(AMF_TIMER_T3570)->duration);
|
||||
|
||||
|
@ -359,14 +428,19 @@ int nas_5gs_send_authentication_request(amf_ue_t *amf_ue)
|
|||
|
||||
if (amf_ue->t3560.pkbuf) {
|
||||
gmmbuf = amf_ue->t3560.pkbuf;
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
} else {
|
||||
gmmbuf = gmm_build_authentication_request(amf_ue);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_authentication_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
amf_ue->t3560.pkbuf = ogs_pkbuf_copy(gmmbuf);
|
||||
ogs_expect_or_return_val(amf_ue->t3560.pkbuf, OGS_ERROR);
|
||||
if (!amf_ue->t3560.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(amf_ue->t3560.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(amf_ue->t3560.timer,
|
||||
amf_timer_cfg(AMF_TIMER_T3560)->duration);
|
||||
|
||||
|
@ -388,7 +462,10 @@ int nas_5gs_send_authentication_reject(amf_ue_t *amf_ue)
|
|||
ogs_warn("[%s] Authentication reject", amf_ue->suci);
|
||||
|
||||
gmmbuf = gmm_build_authentication_reject();
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_authentication_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -407,14 +484,19 @@ int nas_5gs_send_security_mode_command(amf_ue_t *amf_ue)
|
|||
|
||||
if (amf_ue->t3560.pkbuf) {
|
||||
gmmbuf = amf_ue->t3560.pkbuf;
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
} else {
|
||||
gmmbuf = gmm_build_security_mode_command(amf_ue);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_security_mode_command() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
amf_ue->t3560.pkbuf = ogs_pkbuf_copy(gmmbuf);
|
||||
ogs_expect_or_return_val(amf_ue->t3560.pkbuf, OGS_ERROR);
|
||||
if (!amf_ue->t3560.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(amf_ue->t3560.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(amf_ue->t3560.timer,
|
||||
amf_timer_cfg(AMF_TIMER_T3560)->duration);
|
||||
|
||||
|
@ -436,21 +518,32 @@ int nas_5gs_send_configuration_update_command(
|
|||
|
||||
if (amf_ue->t3555.pkbuf) {
|
||||
gmmbuf = amf_ue->t3555.pkbuf;
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
|
||||
amf_ue->t3555.pkbuf = ogs_pkbuf_copy(gmmbuf);
|
||||
ogs_expect_or_return_val(amf_ue->t3555.pkbuf, OGS_ERROR);
|
||||
if (!amf_ue->t3555.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(amf_ue->t3555.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(amf_ue->t3555.timer,
|
||||
amf_timer_cfg(AMF_TIMER_T3555)->duration);
|
||||
|
||||
} else {
|
||||
ogs_expect_or_return_val(param, OGS_ERROR);
|
||||
if (!param) {
|
||||
ogs_error("No param");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
gmmbuf = gmm_build_configuration_update_command(amf_ue, param);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_configuration_update_command() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
if (param->acknowledgement_requested) {
|
||||
amf_ue->t3555.pkbuf = ogs_pkbuf_copy(gmmbuf);
|
||||
ogs_expect_or_return_val(amf_ue->t3555.pkbuf, OGS_ERROR);
|
||||
if (!amf_ue->t3555.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(amf_ue->t3555.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(amf_ue->t3555.timer,
|
||||
amf_timer_cfg(AMF_TIMER_T3555)->duration);
|
||||
}
|
||||
|
@ -476,17 +569,17 @@ int nas_send_pdu_session_setup_request(amf_sess_t *sess,
|
|||
ogs_assert(sess);
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
if (!amf_ue) {
|
||||
ogs_warn("UE(amf-ue) context has already been removed");
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
if (n1smbuf) ogs_pkbuf_free(n1smbuf);
|
||||
ogs_pkbuf_free(n2smbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
if (!ran_ue) {
|
||||
ogs_warn("NG context has already been removed");
|
||||
if (n1smbuf) ogs_pkbuf_free(n1smbuf);
|
||||
ogs_pkbuf_free(n2smbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
if (n1smbuf) {
|
||||
|
@ -508,10 +601,7 @@ int nas_send_pdu_session_setup_request(amf_sess_t *sess,
|
|||
}
|
||||
|
||||
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("nas_5gs_send_to_gnb() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
ran_ue->initial_context_setup_request_sent = true;
|
||||
} else {
|
||||
|
@ -523,10 +613,7 @@ int nas_send_pdu_session_setup_request(amf_sess_t *sess,
|
|||
}
|
||||
|
||||
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("nas_5gs_send_to_gnb() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -546,17 +633,17 @@ int nas_send_pdu_session_modification_command(amf_sess_t *sess,
|
|||
ogs_assert(sess);
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
if (!amf_ue) {
|
||||
ogs_warn("UE(amf-ue) context has already been removed");
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
if (n1smbuf) ogs_pkbuf_free(n1smbuf);
|
||||
ogs_pkbuf_free(n2smbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
if (!ran_ue) {
|
||||
ogs_warn("NG context has already been removed");
|
||||
if (n1smbuf) ogs_pkbuf_free(n1smbuf);
|
||||
ogs_pkbuf_free(n2smbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
if (n1smbuf) {
|
||||
|
@ -607,17 +694,17 @@ int nas_send_pdu_session_release_command(amf_sess_t *sess,
|
|||
ogs_assert(sess);
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
if (!amf_ue) {
|
||||
ogs_warn("UE(amf-ue) context has already been removed");
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
if (n1smbuf) ogs_pkbuf_free(n1smbuf);
|
||||
ogs_pkbuf_free(n2smbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
if (!ran_ue) {
|
||||
ogs_warn("NG context has already been removed");
|
||||
if (n1smbuf) ogs_pkbuf_free(n1smbuf);
|
||||
ogs_pkbuf_free(n2smbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
if (n1smbuf) {
|
||||
|
@ -689,7 +776,10 @@ int nas_5gs_send_gmm_status(amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t cause)
|
|||
ogs_debug("[%s] 5GMM status", amf_ue->supi);
|
||||
|
||||
gmmbuf = gmm_build_status(amf_ue, cause);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_status() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -776,9 +866,12 @@ int nas_5gs_send_dl_nas_transport(amf_sess_t *sess,
|
|||
|
||||
gmmbuf = gmm_build_dl_nas_transport(sess,
|
||||
payload_container_type, payload_container, cause, backoff_time);
|
||||
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
|
||||
if (!gmmbuf) {
|
||||
ogs_error("gmm_build_dl_nas_transport() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -823,10 +916,13 @@ int nas_5gs_send_back_gsm_message(
|
|||
ogs_assert(sess->payload_container);
|
||||
|
||||
pbuf = ogs_pkbuf_copy(sess->payload_container);
|
||||
ogs_expect_or_return_val(pbuf, OGS_ERROR);
|
||||
if (!pbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(pbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_dl_nas_transport(sess, sess->payload_container_type, pbuf,
|
||||
cause, backoff_time);
|
||||
rv = nas_5gs_send_dl_nas_transport(
|
||||
sess, sess->payload_container_type, pbuf, cause, backoff_time);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
int amf_nausf_auth_handle_authenticate(
|
||||
amf_ue_t *amf_ue, ogs_sbi_message_t *message)
|
||||
{
|
||||
int r;
|
||||
OpenAPI_ue_authentication_ctx_t *UeAuthenticationCtx = NULL;
|
||||
OpenAPI_av5g_aka_t *AV5G_AKA = NULL;
|
||||
OpenAPI_links_value_schema_t *LinksValueSchemeValue = NULL;
|
||||
|
@ -111,8 +112,9 @@ int amf_nausf_auth_handle_authenticate(
|
|||
|
||||
amf_ue->nas.ue.ksi = amf_ue->nas.amf.ksi;
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_authentication_request(amf_ue));
|
||||
r = nas_5gs_send_authentication_request(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -54,16 +54,16 @@ int ngap_send_to_gnb(amf_gnb_t *gnb, ogs_pkbuf_t *pkbuf, uint16_t stream_no)
|
|||
|
||||
gnb = amf_gnb_cycle(gnb);
|
||||
if (!gnb) {
|
||||
ogs_warn("gNB has already been removed");
|
||||
ogs_error("gNB has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ogs_assert(gnb->sctp.sock);
|
||||
if (gnb->sctp.sock->fd == INVALID_SOCKET) {
|
||||
ogs_fatal("gNB SCTP socket has already been destroyed");
|
||||
ogs_error("gNB SCTP socket has already been destroyed");
|
||||
ogs_log_hexdump(OGS_LOG_FATAL, pkbuf->data, pkbuf->len);
|
||||
ogs_assert_if_reached();
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -83,16 +83,20 @@ int ngap_send_to_gnb(amf_gnb_t *gnb, ogs_pkbuf_t *pkbuf, uint16_t stream_no)
|
|||
|
||||
int ngap_send_to_ran_ue(ran_ue_t *ran_ue, ogs_pkbuf_t *pkbuf)
|
||||
{
|
||||
int rv;
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
ran_ue = ran_ue_cycle(ran_ue);
|
||||
if (!ran_ue) {
|
||||
ogs_warn("NG context has already been removed");
|
||||
ogs_error("NG context has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
return ngap_send_to_gnb(ran_ue->gnb, pkbuf, ran_ue->gnb_ostream_id);
|
||||
rv = ngap_send_to_gnb(ran_ue->gnb, pkbuf, ran_ue->gnb_ostream_id);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int ngap_delayed_send_to_ran_ue(
|
||||
|
@ -117,10 +121,10 @@ int ngap_delayed_send_to_ran_ue(
|
|||
|
||||
return OGS_OK;
|
||||
} else {
|
||||
amf_gnb_t *gnb = NULL;
|
||||
gnb = ran_ue->gnb;
|
||||
ogs_assert(gnb);
|
||||
return ngap_send_to_ran_ue(ran_ue, pkbuf);
|
||||
int rv = ngap_send_to_ran_ue(ran_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,6 +153,8 @@ int ngap_send_to_5gsm(amf_ue_t *amf_ue, ogs_pkbuf_t *esmbuf)
|
|||
int ngap_send_to_nas(ran_ue_t *ran_ue,
|
||||
NGAP_ProcedureCode_t procedureCode, NGAP_NAS_PDU_t *nasPdu)
|
||||
{
|
||||
int rv;
|
||||
|
||||
ogs_nas_5gs_security_header_t *sh = NULL;
|
||||
ogs_nas_security_header_type_t security_header_type;
|
||||
|
||||
|
@ -211,7 +217,6 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
|
|||
ogs_assert(h);
|
||||
if (h->extended_protocol_discriminator ==
|
||||
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM) {
|
||||
int rv;
|
||||
e = amf_event_new(AMF_EVENT_5GMM_MESSAGE);
|
||||
if (!e) {
|
||||
ogs_error("ngap_send_to_nas() failed");
|
||||
|
@ -237,7 +242,10 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
|
|||
ogs_pkbuf_free(nasbuf);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
return ngap_send_to_5gsm(amf_ue, nasbuf);
|
||||
rv = ngap_send_to_5gsm(amf_ue, nasbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
} else {
|
||||
ogs_error("Unknown NAS Protocol discriminator 0x%02x",
|
||||
h->extended_protocol_discriminator);
|
||||
|
@ -253,7 +261,10 @@ int ngap_send_ng_setup_response(amf_gnb_t *gnb)
|
|||
|
||||
ogs_debug("NG-Setup response");
|
||||
ngap_buffer = ngap_build_ng_setup_response();
|
||||
ogs_expect_or_return_val(ngap_buffer, OGS_ERROR);
|
||||
if (!ngap_buffer) {
|
||||
ogs_error("ngap_build_ng_setup_response() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_gnb(gnb, ngap_buffer, NGAP_NON_UE_SIGNALLING);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -270,7 +281,10 @@ int ngap_send_ng_setup_failure(
|
|||
ogs_debug("NG-Setup failure");
|
||||
ngap_buffer = ngap_build_ng_setup_failure(
|
||||
group, cause, NGAP_TimeToWait_v10s);
|
||||
ogs_expect_or_return_val(ngap_buffer, OGS_ERROR);
|
||||
if (!ngap_buffer) {
|
||||
ogs_error("ngap_build_ng_setup_failure() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_gnb(gnb, ngap_buffer, NGAP_NON_UE_SIGNALLING);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -285,7 +299,10 @@ int ngap_send_ran_configuration_update_ack(amf_gnb_t *gnb)
|
|||
|
||||
ogs_debug("RANConfigurationUpdateAcknowledge");
|
||||
ngap_buffer = ngap_build_ran_configuration_update_ack();
|
||||
ogs_expect_or_return_val(ngap_buffer, OGS_ERROR);
|
||||
if (!ngap_buffer) {
|
||||
ogs_error("ngap_build_ran_configuration_update_ack() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_gnb(gnb, ngap_buffer, NGAP_NON_UE_SIGNALLING);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -302,7 +319,10 @@ int ngap_send_ran_configuration_update_failure(
|
|||
ogs_debug("RANConfigurationUpdateFailure");
|
||||
ngap_buffer = ngap_build_ran_configuration_update_failure(
|
||||
group, cause, NGAP_TimeToWait_v10s);
|
||||
ogs_expect_or_return_val(ngap_buffer, OGS_ERROR);
|
||||
if (!ngap_buffer) {
|
||||
ogs_error("ngap_build_ran_configuration_update_failure() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_gnb(gnb, ngap_buffer, NGAP_NON_UE_SIGNALLING);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -330,7 +350,10 @@ int ngap_send_ran_ue_context_release_command(
|
|||
group, (int)cause, action, (int)duration);
|
||||
|
||||
ngapbuf = ngap_build_ue_context_release_command(ran_ue, group, cause);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_build_ue_context_release_command() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_delayed_send_to_ran_ue(ran_ue, ngapbuf, duration);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -345,21 +368,15 @@ int ngap_send_amf_ue_context_release_command(
|
|||
amf_ue_t *amf_ue, NGAP_Cause_PR group, long cause,
|
||||
uint8_t action, ogs_time_t duration)
|
||||
{
|
||||
int rv;
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
ran_ue_t *ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
if (ran_ue) {
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_ran_ue_context_release_command(ran_ue,
|
||||
group, cause, action, duration));
|
||||
ogs_debug(" SUPI[%s]", amf_ue->supi);
|
||||
} else {
|
||||
ogs_error("[%s] No NG Context - "
|
||||
"Group[%d] Cause[%d] Action[%d] Duration[%d]",
|
||||
amf_ue->supi, group, (int)cause, action, (int)duration);
|
||||
}
|
||||
rv = ngap_send_ran_ue_context_release_command(
|
||||
amf_ue->ran_ue, group, cause, action, duration);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
ogs_debug(" SUPI[%s]", amf_ue->supi);
|
||||
|
||||
return OGS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
int ngap_send_paging(amf_ue_t *amf_ue)
|
||||
|
@ -383,14 +400,23 @@ int ngap_send_paging(amf_ue_t *amf_ue)
|
|||
ngapbuf = amf_ue->t3513.pkbuf;
|
||||
} else {
|
||||
ngapbuf = ngap_build_paging(amf_ue);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_build_paging() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
amf_ue->t3513.pkbuf = ogs_pkbuf_copy(ngapbuf);
|
||||
ogs_expect_or_return_val(amf_ue->t3513.pkbuf, OGS_ERROR);
|
||||
if (!amf_ue->t3513.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_gnb(gnb, ngapbuf, NGAP_NON_UE_SIGNALLING);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("ngap_send_to_gnb() failed");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -413,7 +439,10 @@ int ngap_send_downlink_ran_configuration_transfer(
|
|||
ogs_assert(transfer);
|
||||
|
||||
ngapbuf = ngap_build_downlink_ran_configuration_transfer(transfer);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_build_downlink_ran_configuration_transfer() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_gnb(target_gnb, ngapbuf, NGAP_NON_UE_SIGNALLING);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -433,7 +462,10 @@ int ngap_send_path_switch_ack(amf_sess_t *sess)
|
|||
ogs_assert(amf_ue);
|
||||
|
||||
ngapbuf = ngap_build_path_switch_ack(amf_ue);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_build_path_switch_ack() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -456,7 +488,10 @@ int ngap_send_handover_request(amf_ue_t *amf_ue)
|
|||
ogs_assert(target_ue);
|
||||
|
||||
ngapbuf = ngap_build_handover_request(target_ue);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_build_handover_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_ran_ue(target_ue, ngapbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -474,7 +509,10 @@ int ngap_send_handover_preparation_failure(
|
|||
ogs_assert(cause);
|
||||
|
||||
ngapbuf = ngap_build_handover_preparation_failure(source_ue, cause);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_build_handover_preparation_failure() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_ran_ue(source_ue, ngapbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -494,7 +532,10 @@ int ngap_send_handover_command(amf_ue_t *amf_ue)
|
|||
ogs_assert(source_ue);
|
||||
|
||||
ngapbuf = ngap_build_handover_command(source_ue);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_build_handover_command() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_ran_ue(source_ue, ngapbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -510,7 +551,10 @@ int ngap_send_handover_cancel_ack(ran_ue_t *source_ue)
|
|||
ogs_assert(source_ue);
|
||||
|
||||
ngapbuf = ngap_build_handover_cancel_ack(source_ue);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_build_handover_cancel_ack() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_ran_ue(source_ue, ngapbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -529,7 +573,10 @@ int ngap_send_downlink_ran_status_transfer(
|
|||
ogs_assert(transfer);
|
||||
|
||||
ngapbuf = ngap_build_uplink_ran_status_transfer(target_ue, transfer);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ngap_build_uplink_ran_status_transfer() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_ran_ue(target_ue, ngapbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -550,7 +597,10 @@ int ngap_send_error_indication(
|
|||
|
||||
ngapbuf = ogs_ngap_build_error_indication(
|
||||
ran_ue_ngap_id, amf_ue_ngap_id, group, cause);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ogs_ngap_build_error_indication() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_gnb(gnb, ngapbuf, NGAP_NON_UE_SIGNALLING);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -562,17 +612,18 @@ int ngap_send_error_indication2(
|
|||
amf_ue_t *amf_ue, NGAP_Cause_PR group, long cause)
|
||||
{
|
||||
int rv;
|
||||
amf_gnb_t *gnb;
|
||||
ran_ue_t *ran_ue;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ogs_expect_or_return_val(ran_ue, OGS_ERROR);
|
||||
gnb = ran_ue->gnb;
|
||||
ogs_expect_or_return_val(gnb, OGS_ERROR);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
rv = ngap_send_error_indication(
|
||||
gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id, group, cause);
|
||||
ran_ue->gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
|
||||
group, cause);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
|
@ -588,7 +639,10 @@ int ngap_send_ng_reset_ack(
|
|||
ogs_assert(gnb);
|
||||
|
||||
ngapbuf = ogs_ngap_build_ng_reset_ack(partOfNG_Interface);
|
||||
ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
|
||||
if (!ngapbuf) {
|
||||
ogs_error("ogs_ngap_build_ng_reset_ack() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_gnb(gnb, ngapbuf, NGAP_NON_UE_SIGNALLING);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
|
|
@ -35,8 +35,6 @@ void ngap_close(void);
|
|||
|
||||
ogs_sock_t *ngap_server(ogs_socknode_t *node);
|
||||
void ngap_recv_upcall(short when, ogs_socket_t fd, void *data);
|
||||
int ngap_send(ogs_sock_t *sock,
|
||||
ogs_pkbuf_t *pkbuf, ogs_sockaddr_t *addr, uint16_t stream_no);
|
||||
|
||||
int ngap_send_to_gnb(
|
||||
amf_gnb_t *gnb, ogs_pkbuf_t *pkb, uint16_t stream_no);
|
||||
|
|
|
@ -39,6 +39,8 @@ void ngap_state_final(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
void ngap_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
||||
{
|
||||
int r;
|
||||
|
||||
amf_gnb_t *gnb = NULL;
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
|
||||
|
@ -192,7 +194,10 @@ void ngap_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_assert(e->ran_ue);
|
||||
ogs_assert(e->pkbuf);
|
||||
|
||||
ogs_expect(OGS_OK == ngap_send_to_ran_ue(e->ran_ue, e->pkbuf));
|
||||
r = ngap_send_to_ran_ue(e->ran_ue, e->pkbuf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_timer_delete(e->timer);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
void amf_nnrf_handle_nf_discover(
|
||||
ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
int r;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
ogs_sbi_object_t *sbi_object = NULL;
|
||||
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
|
||||
|
@ -68,9 +70,10 @@ void amf_nnrf_handle_nf_discover(
|
|||
ogs_assert(amf_ue);
|
||||
ogs_error("[%s] (NF discover) No [%s]", amf_ue->suci,
|
||||
ogs_sbi_service_type_to_name(service_type));
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(amf_ue,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(amf_ue,
|
||||
OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
case OGS_SBI_OBJ_SESS_TYPE:
|
||||
sess = (amf_sess_t *)sbi_object;
|
||||
|
@ -82,15 +85,17 @@ void amf_nnrf_handle_nf_discover(
|
|||
ogs_error("[%d:%d] (NF discover) No [%s]", sess->psi, sess->pti,
|
||||
ogs_sbi_service_type_to_name(service_type));
|
||||
if (sess->payload_container_type) {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_error_indication2(amf_ue,
|
||||
r = ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_transport,
|
||||
NGAP_CauseTransport_transport_resource_unavailable));
|
||||
NGAP_CauseTransport_transport_resource_unavailable);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -25,6 +25,7 @@ int amf_nnssf_nsselection_handle_get(
|
|||
amf_sess_t *sess, ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
bool rc;
|
||||
int r;
|
||||
OpenAPI_uri_scheme_e scheme = OpenAPI_uri_scheme_NULL;
|
||||
ogs_sbi_client_t *client = NULL, *scp_client = NULL;
|
||||
ogs_sockaddr_t *addr = NULL;
|
||||
|
@ -44,34 +45,38 @@ int amf_nnssf_nsselection_handle_get(
|
|||
if (recvmsg->res_status != OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
amf_ue->supi, recvmsg->res_status);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_status(amf_ue, recvmsg->res_status));
|
||||
r = nas_5gs_send_gmm_status(amf_ue, recvmsg->res_status);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
AuthorizedNetworkSliceInfo = recvmsg->AuthorizedNetworkSliceInfo;
|
||||
if (!AuthorizedNetworkSliceInfo) {
|
||||
ogs_error("No AuthorizedNetworkSliceInfo");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
NsiInformation = AuthorizedNetworkSliceInfo->nsi_information;
|
||||
if (!NsiInformation) {
|
||||
ogs_error("No NsiInformation");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
if (!NsiInformation->nrf_id) {
|
||||
ogs_error("No nrfId");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -97,9 +102,10 @@ int amf_nnssf_nsselection_handle_get(
|
|||
if (rc == false || scheme == OpenAPI_uri_scheme_NULL) {
|
||||
ogs_error("[%s:%d] Invalid URI [%s]",
|
||||
amf_ue->supi, sess->psi, NsiInformation->nrf_id);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
int amf_npcf_am_policy_control_handle_create(
|
||||
amf_ue_t *amf_ue, ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
|
||||
uint64_t supported_features;
|
||||
|
||||
|
@ -38,33 +38,37 @@ int amf_npcf_am_policy_control_handle_create(
|
|||
if (recvmsg->res_status != OGS_SBI_HTTP_STATUS_CREATED) {
|
||||
ogs_error("[%s] HTTP response error [%d]",
|
||||
amf_ue->supi, recvmsg->res_status);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(amf_ue, recvmsg->res_status));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(amf_ue, recvmsg->res_status);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
if (!recvmsg->http.location) {
|
||||
ogs_error("[%s] No http.location", amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
PolicyAssociation = recvmsg->PolicyAssociation;
|
||||
if (!PolicyAssociation) {
|
||||
ogs_error("No PolicyAssociation");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
if (!PolicyAssociation->supp_feat) {
|
||||
ogs_error("No suppFeat");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -75,9 +79,10 @@ int amf_npcf_am_policy_control_handle_create(
|
|||
if (rv != OGS_OK) {
|
||||
ogs_error("[%s] Cannot parse http.location [%s]",
|
||||
amf_ue->supi, recvmsg->http.location);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -86,9 +91,10 @@ int amf_npcf_am_policy_control_handle_create(
|
|||
amf_ue->supi, recvmsg->http.location);
|
||||
|
||||
ogs_sbi_header_free(&header);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
int amf_nsmf_pdusession_handle_create_sm_context(
|
||||
amf_sess_t *sess, ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
int rv;
|
||||
int rv, r;
|
||||
|
||||
ogs_assert(sess);
|
||||
ogs_assert(recvmsg);
|
||||
|
@ -38,10 +38,11 @@ int amf_nsmf_pdusession_handle_create_sm_context(
|
|||
|
||||
if (!recvmsg->http.location) {
|
||||
ogs_error("[%d:%d] No http.location", sess->psi, sess->pti);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -53,10 +54,11 @@ int amf_nsmf_pdusession_handle_create_sm_context(
|
|||
if (rv != OGS_OK) {
|
||||
ogs_error("[%d:%d] Cannot parse http.location [%s]",
|
||||
sess->psi, sess->pti, recvmsg->http.location);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -66,10 +68,11 @@ int amf_nsmf_pdusession_handle_create_sm_context(
|
|||
sess->psi, sess->pti, recvmsg->http.location);
|
||||
|
||||
ogs_sbi_header_free(&header);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -86,7 +89,7 @@ int amf_nsmf_pdusession_handle_create_sm_context(
|
|||
amf_ue_t *amf_ue = sess->amf_ue;
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
rv = nas_5gs_send_to_gnb(amf_ue,
|
||||
r = nas_5gs_send_to_gnb(amf_ue,
|
||||
sess->pdu_session_establishment_accept);
|
||||
|
||||
sess->pdu_session_establishment_accept = NULL;
|
||||
|
@ -96,10 +99,11 @@ int amf_nsmf_pdusession_handle_create_sm_context(
|
|||
sess->psi, sess->pti);
|
||||
|
||||
ogs_sbi_header_free(&header);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -120,19 +124,21 @@ int amf_nsmf_pdusession_handle_create_sm_context(
|
|||
SmContextCreateError = recvmsg->SmContextCreateError;
|
||||
if (!SmContextCreateError) {
|
||||
ogs_error("[%d:%d] No SmContextCreateError", sess->psi, sess->pti);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
if (!SmContextCreateError->error) {
|
||||
ogs_error("[%d:%d] No Error", sess->psi, sess->pti);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -150,19 +156,21 @@ int amf_nsmf_pdusession_handle_create_sm_context(
|
|||
sess->psi, sess->pti);
|
||||
n1smbuf = ogs_pkbuf_copy(n1smbuf);
|
||||
ogs_assert(n1smbuf);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gsm_reject(sess,
|
||||
OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, n1smbuf));
|
||||
r = nas_5gs_send_gsm_reject(sess,
|
||||
OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, n1smbuf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
ogs_error("[%d:%d] 5GMM was not forwarded", sess->psi, sess->pti);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -173,6 +181,8 @@ int amf_nsmf_pdusession_handle_create_sm_context(
|
|||
int amf_nsmf_pdusession_handle_update_sm_context(
|
||||
amf_sess_t *sess, int state, ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
int r;
|
||||
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
|
||||
|
@ -239,8 +249,9 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
amf_ue, 0, NULL));
|
||||
} else {
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->t3550);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_registration_accept(amf_ue));
|
||||
r = nas_5gs_send_registration_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
AMF_UE_CLEAR_N2_TRANSFER(
|
||||
amf_ue, pdu_session_resource_setup_request);
|
||||
|
@ -255,8 +266,9 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
AMF_RELEASE_SM_CONTEXT_SERVICE_ACCEPT) &&
|
||||
AMF_SESSION_SYNC_DONE(amf_ue,
|
||||
AMF_UPDATE_SM_CONTEXT_SERVICE_REQUEST)) {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_service_accept(amf_ue));
|
||||
r = nas_5gs_send_service_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
AMF_UE_CLEAR_N2_TRANSFER(
|
||||
amf_ue, pdu_session_resource_setup_request);
|
||||
|
@ -267,8 +279,9 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
|
||||
if (AMF_SESSION_SYNC_DONE(amf_ue,
|
||||
AMF_UPDATE_SM_CONTEXT_HANDOVER_REQUIRED)) {
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_handover_request(amf_ue));
|
||||
r = ngap_send_handover_request(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
AMF_UE_CLEAR_N2_TRANSFER(amf_ue, handover_request);
|
||||
}
|
||||
|
@ -282,10 +295,11 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
if (!n1smbuf) {
|
||||
ogs_error("[%s:%d] No N1 SM Content [%s]",
|
||||
amf_ue->supi, sess->psi, n1SmMsg->content_id);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -293,10 +307,11 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
if (!n2smbuf) {
|
||||
ogs_error("[%s:%d] No N2 SM Content",
|
||||
amf_ue->supi, sess->psi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -311,9 +326,10 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
n2smbuf = ogs_pkbuf_copy(n2smbuf);
|
||||
ogs_assert(n2smbuf);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_send_pdu_session_modification_command(
|
||||
sess, n1smbuf, n2smbuf));
|
||||
r = nas_send_pdu_session_modification_command(
|
||||
sess, n1smbuf, n2smbuf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
|
||||
|
||||
|
@ -321,10 +337,11 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
if (!n1smbuf) {
|
||||
ogs_error("[%s:%d] No N1 SM Content [%s]",
|
||||
amf_ue->supi, sess->psi, n1SmMsg->content_id);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -332,10 +349,11 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
if (!n2smbuf) {
|
||||
ogs_error("[%s:%d] No N2 SM Content",
|
||||
amf_ue->supi, sess->psi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -350,19 +368,21 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
n2smbuf = ogs_pkbuf_copy(n2smbuf);
|
||||
ogs_assert(n2smbuf);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_send_pdu_session_release_command(
|
||||
sess, n1smbuf, n2smbuf));
|
||||
r = nas_send_pdu_session_release_command(
|
||||
sess, n1smbuf, n2smbuf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
|
||||
case OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_ACK:
|
||||
if (!n2smbuf) {
|
||||
ogs_error("[%s:%d] No N2 SM Content",
|
||||
amf_ue->supi, sess->psi);
|
||||
ogs_expect(OGS_OK ==
|
||||
ngap_send_error_indication2(amf_ue,
|
||||
r = ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol,
|
||||
NGAP_CauseProtocol_semantic_error));
|
||||
NGAP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -372,8 +392,9 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
ogs_pkbuf_copy(n2smbuf));
|
||||
|
||||
if (AMF_SESSION_SYNC_DONE(amf_ue, state)) {
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_path_switch_ack(sess));
|
||||
r = ngap_send_path_switch_ack(sess);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
AMF_UE_CLEAR_N2_TRANSFER(amf_ue, path_switch_request_ack);
|
||||
}
|
||||
|
@ -383,10 +404,11 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
if (!n2smbuf) {
|
||||
ogs_error("[%s:%d] No N2 SM Content",
|
||||
amf_ue->supi, sess->psi);
|
||||
ogs_expect(OGS_OK ==
|
||||
ngap_send_error_indication2(amf_ue,
|
||||
r = ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol,
|
||||
NGAP_CauseProtocol_semantic_error));
|
||||
NGAP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -395,8 +417,9 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
sess, handover_command, ogs_pkbuf_copy(n2smbuf));
|
||||
|
||||
if (AMF_SESSION_SYNC_DONE(amf_ue, state)) {
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_handover_command(amf_ue));
|
||||
r = ngap_send_handover_command(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
AMF_UE_CLEAR_N2_TRANSFER(amf_ue, handover_command);
|
||||
}
|
||||
|
@ -405,10 +428,11 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
default:
|
||||
ogs_error("Not implemented [%d]",
|
||||
SmContextUpdatedData->n2_sm_info_type);
|
||||
ogs_expect(OGS_OK ==
|
||||
ngap_send_error_indication2(amf_ue,
|
||||
r = ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol,
|
||||
NGAP_CauseProtocol_semantic_error));
|
||||
NGAP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -478,11 +502,12 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
ogs_warn("PDUSessionResourceSetupResponse(Unsuccessful)");
|
||||
ogs_assert(amf_ue->deactivation.group);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_amf_ue_context_release_command(amf_ue,
|
||||
r = ngap_send_amf_ue_context_release_command(amf_ue,
|
||||
amf_ue->deactivation.group,
|
||||
amf_ue->deactivation.cause,
|
||||
NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0));
|
||||
NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
} else if (state == AMF_UPDATE_SM_CONTEXT_MODIFIED) {
|
||||
/*
|
||||
|
@ -515,11 +540,12 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
if (AMF_SESSION_SYNC_DONE(amf_ue, state)) {
|
||||
ogs_assert(amf_ue->deactivation.group);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_amf_ue_context_release_command(amf_ue,
|
||||
r = ngap_send_amf_ue_context_release_command(amf_ue,
|
||||
amf_ue->deactivation.group,
|
||||
amf_ue->deactivation.cause,
|
||||
NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0));
|
||||
NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else if (state == AMF_UPDATE_SM_CONTEXT_REGISTRATION_REQUEST) {
|
||||
|
@ -597,11 +623,12 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
target_ue = source_ue->target_ue;
|
||||
ogs_assert(target_ue);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_ran_ue_context_release_command(target_ue,
|
||||
r = ngap_send_ran_ue_context_release_command(target_ue,
|
||||
NGAP_Cause_PR_radioNetwork,
|
||||
NGAP_CauseRadioNetwork_handover_cancelled,
|
||||
NGAP_UE_CTX_REL_NG_HANDOVER_CANCEL, 0));
|
||||
NGAP_UE_CTX_REL_NG_HANDOVER_CANCEL, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else if (state == AMF_UPDATE_SM_CONTEXT_HANDOVER_NOTIFY) {
|
||||
|
@ -636,9 +663,11 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
ogs_debug(" SUPI[%s]", amf_ue->supi);
|
||||
ran_ue_remove(ran_ue);
|
||||
|
||||
if (ogs_list_count(&gnb->ran_ue_list) == 0)
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_ng_reset_ack(gnb, NULL));
|
||||
if (ogs_list_count(&gnb->ran_ue_list) == 0) {
|
||||
r = ngap_send_ng_reset_ack(gnb, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else {
|
||||
ogs_warn("[%s] RAN-NG Context has already been removed",
|
||||
|
@ -673,9 +702,10 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
* where PartOfNG_interface was requested
|
||||
* REMOVED */
|
||||
ogs_assert(gnb->ng_reset_ack);
|
||||
ogs_expect(OGS_OK ==
|
||||
ngap_send_to_gnb(gnb,
|
||||
gnb->ng_reset_ack, NGAP_NON_UE_SIGNALLING));
|
||||
r = ngap_send_to_gnb(
|
||||
gnb, gnb->ng_reset_ack, NGAP_NON_UE_SIGNALLING);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
/* Clear NG-Reset Ack Buffer */
|
||||
gnb->ng_reset_ack = NULL;
|
||||
|
@ -722,18 +752,20 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
if (!SmContextUpdateError) {
|
||||
ogs_error("[%d:%d] No SmContextUpdateError [%d]",
|
||||
sess->psi, sess->pti, recvmsg->res_status);
|
||||
ogs_expect(OGS_OK ==
|
||||
ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
|
||||
r = ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
if (!SmContextUpdateError->error) {
|
||||
ogs_error("[%d:%d] No Error [%d]",
|
||||
sess->psi, sess->pti, recvmsg->res_status);
|
||||
ogs_expect(OGS_OK ==
|
||||
ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
|
||||
r = ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -752,9 +784,10 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
|
||||
n1smbuf = ogs_pkbuf_copy(n1smbuf);
|
||||
ogs_assert(n1smbuf);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gsm_reject(sess,
|
||||
OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, n1smbuf));
|
||||
r = nas_5gs_send_gsm_reject(sess,
|
||||
OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, n1smbuf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -764,9 +797,10 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
n2SmInfo = SmContextUpdateError->n2_sm_info;
|
||||
if (!n2SmInfo || !n2SmInfo->content_id) {
|
||||
ogs_error("[%d:%d] No N2 SM Message", sess->psi, sess->pti);
|
||||
ogs_expect(OGS_OK ==
|
||||
ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
|
||||
r = ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -776,9 +810,10 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
if (!n2smbuf) {
|
||||
ogs_error("[%d:%d] No N2 SM Content [%s]",
|
||||
sess->psi, sess->pti, n2SmInfo->content_id);
|
||||
ogs_expect(OGS_OK ==
|
||||
ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
|
||||
r = ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -786,9 +821,10 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
|
||||
ogs_error("[%d:%d] Error Indication", sess->psi, sess->pti);
|
||||
|
||||
ogs_expect(OGS_OK ==
|
||||
ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
|
||||
r = ngap_send_error_indication2(amf_ue,
|
||||
NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -798,6 +834,7 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
|
||||
int amf_nsmf_pdusession_handle_release_sm_context(amf_sess_t *sess, int state)
|
||||
{
|
||||
int r;
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
|
||||
ogs_assert(sess);
|
||||
|
@ -825,8 +862,9 @@ int amf_nsmf_pdusession_handle_release_sm_context(amf_sess_t *sess, int state)
|
|||
amf_ue, 0, NULL));
|
||||
} else {
|
||||
CLEAR_AMF_UE_TIMER(amf_ue->t3550);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_registration_accept(amf_ue));
|
||||
r = nas_5gs_send_registration_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -836,10 +874,14 @@ int amf_nsmf_pdusession_handle_release_sm_context(amf_sess_t *sess, int state)
|
|||
* 2. Release All SM contexts
|
||||
* 3. Service accept
|
||||
*/
|
||||
if (AMF_SESSION_SYNC_DONE(amf_ue, AMF_RELEASE_SM_CONTEXT_SERVICE_ACCEPT) &&
|
||||
AMF_SESSION_SYNC_DONE(amf_ue, AMF_UPDATE_SM_CONTEXT_SERVICE_REQUEST))
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_service_accept(amf_ue));
|
||||
if (AMF_SESSION_SYNC_DONE(amf_ue,
|
||||
AMF_RELEASE_SM_CONTEXT_SERVICE_ACCEPT) &&
|
||||
AMF_SESSION_SYNC_DONE(amf_ue,
|
||||
AMF_UPDATE_SM_CONTEXT_SERVICE_REQUEST)) {
|
||||
r = nas_5gs_send_service_accept(amf_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -852,10 +894,11 @@ int amf_nsmf_pdusession_handle_release_sm_context(amf_sess_t *sess, int state)
|
|||
* 3. UE Context release command
|
||||
* 4. UE Context release complete
|
||||
*/
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_amf_ue_context_release_command(amf_ue,
|
||||
r = ngap_send_amf_ue_context_release_command(amf_ue,
|
||||
NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
|
||||
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
|
||||
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
} else if (state == AMF_RELEASE_SM_CONTEXT_REGISTRATION_ACCEPT) {
|
||||
|
||||
|
@ -917,10 +960,11 @@ int amf_nsmf_pdusession_handle_release_sm_context(amf_sess_t *sess, int state)
|
|||
* 3. UE Context release command
|
||||
* 4. UE Context release complete
|
||||
*/
|
||||
ogs_assert(OGS_OK ==
|
||||
ngap_send_amf_ue_context_release_command(amf_ue,
|
||||
r = ngap_send_amf_ue_context_release_command(amf_ue,
|
||||
NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
|
||||
NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
|
||||
NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
} else if (OGS_FSM_CHECK(&amf_ue->sm,
|
||||
gmm_state_initial_context_setup)) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
int amf_nudm_sdm_handle_provisioned(
|
||||
amf_ue_t *amf_ue, int state, ogs_sbi_message_t *recvmsg)
|
||||
{
|
||||
int i;
|
||||
int i, r;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
ogs_assert(recvmsg);
|
||||
|
@ -259,9 +259,10 @@ int amf_nudm_sdm_handle_provisioned(
|
|||
|
||||
if (!recvmsg->http.location) {
|
||||
ogs_error("[%s] No http.location", amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -272,9 +273,10 @@ int amf_nudm_sdm_handle_provisioned(
|
|||
if (rv != OGS_OK) {
|
||||
ogs_error("[%s] Cannot parse http.location [%s]",
|
||||
amf_ue->supi, recvmsg->http.location);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -283,9 +285,10 @@ int amf_nudm_sdm_handle_provisioned(
|
|||
amf_ue->supi, recvmsg->http.location);
|
||||
|
||||
ogs_sbi_header_free(&header);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ bool amf_ue_sbi_discover_and_send(
|
|||
ogs_sbi_request_t *(*build)(amf_ue_t *amf_ue, void *data),
|
||||
amf_ue_t *amf_ue, int state, void *data)
|
||||
{
|
||||
int r;
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
|
||||
ogs_assert(service_type);
|
||||
|
@ -103,9 +104,10 @@ bool amf_ue_sbi_discover_and_send(
|
|||
(ogs_sbi_build_f)build, amf_ue, data);
|
||||
if (!xact) {
|
||||
ogs_error("amf_ue_sbi_discover_and_send() failed");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -114,9 +116,10 @@ bool amf_ue_sbi_discover_and_send(
|
|||
if (ogs_sbi_discover_and_send(xact) != true) {
|
||||
ogs_error("amf_ue_sbi_discover_and_send() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT));
|
||||
r = nas_5gs_send_gmm_reject_from_sbi(
|
||||
amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -129,6 +132,7 @@ bool amf_sess_sbi_discover_and_send(
|
|||
ogs_sbi_request_t *(*build)(amf_sess_t *sess, void *data),
|
||||
amf_sess_t *sess, int state, void *data)
|
||||
{
|
||||
int r;
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
|
||||
ogs_assert(service_type);
|
||||
|
@ -140,8 +144,10 @@ bool amf_sess_sbi_discover_and_send(
|
|||
(ogs_sbi_build_f)build, sess, data);
|
||||
if (!xact) {
|
||||
ogs_error("amf_sess_sbi_discover_and_send() failed");
|
||||
ogs_assert(OGS_OK == nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME));
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -150,8 +156,10 @@ bool amf_sess_sbi_discover_and_send(
|
|||
if (ogs_sbi_discover_and_send(xact) != true) {
|
||||
ogs_error("amf_sess_sbi_discover_and_send() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
ogs_assert(OGS_OK == nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME));
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -160,7 +168,7 @@ bool amf_sess_sbi_discover_and_send(
|
|||
static int client_discover_cb(
|
||||
int status, ogs_sbi_response_t *response, void *data)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
ogs_sbi_message_t message;
|
||||
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
|
@ -216,24 +224,30 @@ static int client_discover_cb(
|
|||
rv = ogs_sbi_parse_response(&message, response);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("cannot parse HTTP response");
|
||||
ogs_assert(OGS_OK == nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME));
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (message.res_status != OGS_SBI_HTTP_STATUS_OK) {
|
||||
ogs_error("NF-Discover failed [%d]", message.res_status);
|
||||
ogs_assert(OGS_OK == nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME));
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!message.SearchResult) {
|
||||
ogs_error("No SearchResult");
|
||||
ogs_assert(OGS_OK == nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME));
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -247,10 +261,11 @@ static int client_discover_cb(
|
|||
ogs_error("[%s:%d] (NF discover) No [%s]",
|
||||
amf_ue->supi, sess->psi,
|
||||
ogs_sbi_service_type_to_name(service_type));
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_back_gsm_message(sess,
|
||||
r = nas_5gs_send_back_gsm_message(sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME));
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -294,11 +309,18 @@ bool amf_sess_sbi_discover_by_nsi(
|
|||
|
||||
xact = ogs_sbi_xact_add(
|
||||
&sess->sbi, service_type, discovery_option, NULL, NULL, NULL);
|
||||
ogs_expect_or_return_val(xact, false);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_sbi_xact_add() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
xact->request = amf_nnrf_disc_build_discover(
|
||||
sess->nssf.nrf.id, xact->service_type, xact->discovery_option);
|
||||
ogs_expect_or_return_val(xact->request, false);
|
||||
if (!xact->request) {
|
||||
ogs_error("amf_nnrf_disc_build_discover() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
return false;
|
||||
}
|
||||
|
||||
return ogs_sbi_client_send_request(
|
||||
client, client_discover_cb, xact->request, xact);
|
||||
|
@ -460,7 +482,10 @@ bool amf_sbi_send_n1_n2_failure_notify(
|
|||
ogs_assert(client);
|
||||
|
||||
request = amf_nsmf_callback_build_n1_n2_failure_notify(sess, cause);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
if (!request) {
|
||||
ogs_error("amf_nsmf_callback_build_n1_n2_failure_notify() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
rc = ogs_sbi_send_request_to_client(
|
||||
client, client_notify_cb, request, NULL);
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
int emm_handle_attach_request(mme_ue_t *mme_ue,
|
||||
ogs_nas_eps_attach_request_t *attach_request, ogs_pkbuf_t *pkbuf)
|
||||
{
|
||||
int r;
|
||||
int served_tai_index = 0;
|
||||
|
||||
ogs_nas_eps_mobile_identity_guti_t *eps_mobile_identity_guti = NULL;
|
||||
|
@ -129,10 +130,11 @@ int emm_handle_attach_request(mme_ue_t *mme_ue,
|
|||
/* Send Attach Reject */
|
||||
ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]",
|
||||
ogs_plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index);
|
||||
|
@ -172,10 +174,11 @@ int emm_handle_attach_request(mme_ue_t *mme_ue,
|
|||
"but Integrity[0x%x] cannot be bypassed with EIA0",
|
||||
mme_selected_enc_algorithm(mme_ue),
|
||||
mme_selected_int_algorithm(mme_ue));
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_SECURITY_CAPABILITIES_MISMATCH,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -222,7 +225,7 @@ int emm_handle_attach_request(mme_ue_t *mme_ue,
|
|||
int emm_handle_attach_complete(
|
||||
mme_ue_t *mme_ue, ogs_nas_eps_attach_complete_t *attach_complete)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
ogs_pkbuf_t *emmbuf = NULL;
|
||||
|
||||
ogs_nas_eps_message_t message;
|
||||
|
@ -315,15 +318,19 @@ int emm_handle_attach_complete(
|
|||
network_daylight_saving_time->length = 1;
|
||||
|
||||
emmbuf = nas_eps_security_encode(mme_ue, &message);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("nas_eps_security_encode() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
r = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_debug("EMM information");
|
||||
ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd);
|
||||
|
||||
return rv;
|
||||
return r;
|
||||
}
|
||||
|
||||
int emm_handle_identity_response(
|
||||
|
@ -487,6 +494,7 @@ int emm_handle_service_request(
|
|||
int emm_handle_tau_request(mme_ue_t *mme_ue,
|
||||
ogs_nas_eps_tracking_area_update_request_t *tau_request, ogs_pkbuf_t *pkbuf)
|
||||
{
|
||||
int r;
|
||||
int served_tai_index = 0;
|
||||
|
||||
ogs_nas_eps_mobile_identity_guti_t *eps_mobile_identity_guti = NULL;
|
||||
|
@ -560,9 +568,10 @@ int emm_handle_tau_request(mme_ue_t *mme_ue,
|
|||
/* Send TAU reject */
|
||||
ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]",
|
||||
ogs_plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_tau_reject(
|
||||
mme_ue, OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED));
|
||||
r = nas_eps_send_tau_reject(
|
||||
mme_ue, OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index);
|
||||
|
@ -625,6 +634,7 @@ int emm_handle_tau_request(mme_ue_t *mme_ue,
|
|||
int emm_handle_extended_service_request(mme_ue_t *mme_ue,
|
||||
ogs_nas_eps_extended_service_request_t *extended_service_request)
|
||||
{
|
||||
int r;
|
||||
int served_tai_index = 0;
|
||||
|
||||
ogs_nas_service_type_t *service_type =
|
||||
|
@ -678,9 +688,10 @@ int emm_handle_extended_service_request(mme_ue_t *mme_ue,
|
|||
/* Send TAU reject */
|
||||
ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]",
|
||||
ogs_plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_tau_reject(
|
||||
mme_ue, OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED));
|
||||
r = nas_eps_send_tau_reject(
|
||||
mme_ue, OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index);
|
||||
|
|
312
src/mme/emm-sm.c
312
src/mme/emm-sm.c
|
@ -56,7 +56,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e);
|
|||
|
||||
void emm_state_de_registered(ogs_fsm_t *s, mme_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
int r;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
ogs_assert(e);
|
||||
|
@ -85,14 +85,10 @@ void emm_state_de_registered(ogs_fsm_t *s, mme_event_t *e)
|
|||
"Stop retransmission");
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
} else {
|
||||
ogs_assert(mme_ue->t3470.pkbuf);
|
||||
rv = nas_eps_send_identity_request(mme_ue);
|
||||
if (rv == OGS_OK) {
|
||||
mme_ue->t3470.retry_count++;
|
||||
} else {
|
||||
ogs_error("nas_eps_send_identity_request() failed");
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
}
|
||||
mme_ue->t3470.retry_count++;
|
||||
r = nas_eps_send_identity_request(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -109,7 +105,7 @@ void emm_state_de_registered(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
void emm_state_registered(ogs_fsm_t *s, mme_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
int r;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
ogs_assert(e);
|
||||
|
@ -146,7 +142,9 @@ void emm_state_registered(ogs_fsm_t *s, mme_event_t *e)
|
|||
* We don't have to set CNDomain.
|
||||
* So, we just set CNDomain to 0
|
||||
*/
|
||||
ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, 0));
|
||||
r = s1ap_send_paging(mme_ue, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -157,14 +155,10 @@ void emm_state_registered(ogs_fsm_t *s, mme_event_t *e)
|
|||
"Stop retransmission");
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
} else {
|
||||
ogs_assert(mme_ue->t3470.pkbuf);
|
||||
rv = nas_eps_send_identity_request(mme_ue);
|
||||
if (rv == OGS_OK) {
|
||||
mme_ue->t3470.retry_count++;
|
||||
} else {
|
||||
ogs_error("nas_eps_send_identity_request() failed");
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
}
|
||||
mme_ue->t3470.retry_count++;
|
||||
r = nas_eps_send_identity_request(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -175,14 +169,10 @@ void emm_state_registered(ogs_fsm_t *s, mme_event_t *e)
|
|||
"Stop retransmission");
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
} else {
|
||||
ogs_assert(mme_ue->t3422.pkbuf);
|
||||
rv = nas_eps_send_detach_request(mme_ue);
|
||||
if (rv == OGS_OK) {
|
||||
mme_ue->t3422.retry_count++;
|
||||
} else {
|
||||
ogs_error("nas_eps_send_detach_request() failed");
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
}
|
||||
mme_ue->t3422.retry_count++;
|
||||
r = nas_eps_send_detach_request(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -199,7 +189,7 @@ void emm_state_registered(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
|
@ -234,42 +224,47 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
if (!MME_UE_HAVE_IMSI(mme_ue)) {
|
||||
ogs_info("Service request : Unknown UE");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!SECURITY_CONTEXT_IS_VALID(mme_ue)) {
|
||||
ogs_warn("No Security Context : IMSI[%s]", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) {
|
||||
ogs_warn("No Session Context : IMSI[%s]", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ACTIVE_EPS_BEARERS_IS_AVAIABLE(mme_ue)) {
|
||||
ogs_warn("No active EPS bearers : IMSI[%s]", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED));
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_initial_context_setup_request(mme_ue));
|
||||
r = s1ap_send_initial_context_setup_request(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_registered);
|
||||
break;
|
||||
}
|
||||
|
@ -314,8 +309,9 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
if (!MME_UE_HAVE_IMSI(mme_ue)) {
|
||||
CLEAR_MME_UE_TIMER(mme_ue->t3470);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_identity_request(mme_ue));
|
||||
r = nas_eps_send_identity_request(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -328,10 +324,11 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
&mme_ue->pdn_connectivity_request);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("nas_eps_send_emm_to_esm() failed");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -360,27 +357,30 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
if (!MME_UE_HAVE_IMSI(mme_ue)) {
|
||||
ogs_info("TAU request : Unknown UE");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_tau_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
|
||||
r = nas_eps_send_tau_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) {
|
||||
ogs_warn("No PDN Connection : UE[%s]", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_tau_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
|
||||
r = nas_eps_send_tau_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ACTIVE_EPS_BEARERS_IS_AVAIABLE(mme_ue)) {
|
||||
ogs_warn("No active EPS bearers : IMSI[%s]", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_tau_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED));
|
||||
r = nas_eps_send_tau_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -459,20 +459,23 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
if (e->s1ap_code == S1AP_ProcedureCode_id_initialUEMessage) {
|
||||
ogs_debug(" Iniital UE Message");
|
||||
if (mme_ue->nas_eps.update.active_flag) {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_tau_accept(mme_ue,
|
||||
S1AP_ProcedureCode_id_InitialContextSetup));
|
||||
r = nas_eps_send_tau_accept(mme_ue,
|
||||
S1AP_ProcedureCode_id_InitialContextSetup);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_tau_accept(mme_ue,
|
||||
S1AP_ProcedureCode_id_downlinkNASTransport));
|
||||
r = nas_eps_send_tau_accept(mme_ue,
|
||||
S1AP_ProcedureCode_id_downlinkNASTransport);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
} else if (e->s1ap_code ==
|
||||
S1AP_ProcedureCode_id_uplinkNASTransport) {
|
||||
ogs_debug(" Uplink NAS Transport");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_tau_accept(mme_ue,
|
||||
S1AP_ProcedureCode_id_downlinkNASTransport));
|
||||
r = nas_eps_send_tau_accept(mme_ue,
|
||||
S1AP_ProcedureCode_id_downlinkNASTransport);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_fatal("Invalid Procedure Code[%d]", (int)e->s1ap_code);
|
||||
}
|
||||
|
@ -501,27 +504,30 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
if (!MME_UE_HAVE_IMSI(mme_ue)) {
|
||||
ogs_warn("Extended Service request : Unknown UE");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) {
|
||||
ogs_warn("No PDN Connection : UE[%s]", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!SECURITY_CONTEXT_IS_VALID(mme_ue)) {
|
||||
ogs_warn("No Security Context : IMSI[%s]", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -531,10 +537,10 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
if (!MME_P_TMSI_IS_AVAILABLE(mme_ue)) {
|
||||
ogs_warn("No P-TMSI : UE[%s]", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
|
||||
);
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
mme_send_release_access_bearer_or_ue_context_release(
|
||||
enb_ue);
|
||||
break;
|
||||
|
@ -558,16 +564,17 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
} else {
|
||||
ogs_warn(" Unknown CSFB Service Type[%d]",
|
||||
mme_ue->nas_eps.service.value);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
|
||||
);
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_initial_context_setup_request(mme_ue));
|
||||
r = s1ap_send_initial_context_setup_request(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
} else if (e->s1ap_code ==
|
||||
S1AP_ProcedureCode_id_uplinkNASTransport) {
|
||||
|
@ -575,10 +582,10 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
if (!MME_P_TMSI_IS_AVAILABLE(mme_ue)) {
|
||||
ogs_warn("No P-TMSI : UE[%s]", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
|
||||
);
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -600,16 +607,17 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
} else {
|
||||
ogs_warn(" Unknown CSFB Service Type[%d]",
|
||||
mme_ue->nas_eps.service.value);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
|
||||
);
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_modification_request(mme_ue));
|
||||
r = s1ap_send_ue_context_modification_request(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_error("Invalid Procedure Code[%d]", (int)e->s1ap_code);
|
||||
}
|
||||
|
@ -646,10 +654,11 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
CLEAR_MME_UE_TIMER(mme_ue->t3422);
|
||||
|
||||
rv = s1ap_send_ue_context_release_command(enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_detach,
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
OGS_FSM_TRAN(s, &emm_state_de_registered);
|
||||
break;
|
||||
|
@ -669,11 +678,12 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
MME_UE_S1AP_ID = enb_ue->mme_ue_s1ap_id;
|
||||
ENB_UE_S1AP_ID = enb_ue->enb_ue_s1ap_id;
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_error_indication(enb_ue->enb,
|
||||
r = s1ap_send_error_indication(enb_ue->enb,
|
||||
&MME_UE_S1AP_ID, &ENB_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_transport,
|
||||
S1AP_CauseTransport_transport_resource_unavailable));
|
||||
S1AP_CauseTransport_transport_resource_unavailable);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -700,7 +710,7 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
void emm_state_authentication(ogs_fsm_t *s, mme_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
ogs_nas_eps_message_t *message = NULL;
|
||||
|
||||
|
@ -745,8 +755,9 @@ void emm_state_authentication(ogs_fsm_t *s, mme_event_t *e)
|
|||
authentication_response_parameter->length);
|
||||
ogs_log_hexdump(OGS_LOG_WARN,
|
||||
mme_ue->xres, OGS_MAX_RES_LEN);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_authentication_reject(mme_ue));
|
||||
r = nas_eps_send_authentication_reject(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
} else {
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_security_mode);
|
||||
|
@ -789,8 +800,9 @@ void emm_state_authentication(ogs_fsm_t *s, mme_event_t *e)
|
|||
break;
|
||||
}
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_authentication_reject(mme_ue));
|
||||
r = nas_eps_send_authentication_reject(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
|
||||
break;
|
||||
|
@ -841,16 +853,14 @@ void emm_state_authentication(ogs_fsm_t *s, mme_event_t *e)
|
|||
"Stop retransmission", mme_ue->imsi_bcd);
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
|
||||
ogs_expect(OGS_OK ==
|
||||
nas_eps_send_authentication_reject(mme_ue));
|
||||
r = nas_eps_send_authentication_reject(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
rv = nas_eps_send_authentication_request(mme_ue);
|
||||
if (rv == OGS_OK) {
|
||||
mme_ue->t3460.retry_count++;
|
||||
} else {
|
||||
ogs_error("nas_eps_send_authentication_request() failed");
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
}
|
||||
mme_ue->t3460.retry_count++;
|
||||
r = nas_eps_send_authentication_request(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -867,7 +877,7 @@ void emm_state_authentication(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
ogs_nas_eps_message_t *message = NULL;
|
||||
ogs_nas_security_header_type_t h;
|
||||
|
@ -883,8 +893,9 @@ void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e)
|
|||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
CLEAR_MME_UE_TIMER(mme_ue->t3460);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_security_mode_command(mme_ue));
|
||||
r = nas_eps_send_security_mode_command(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
break;
|
||||
|
@ -895,9 +906,10 @@ void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e)
|
|||
if (message->emm.h.security_header_type
|
||||
== OGS_NAS_SECURITY_HEADER_FOR_SERVICE_REQUEST_MESSAGE) {
|
||||
ogs_debug("Service request");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED));
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -979,9 +991,10 @@ void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e)
|
|||
break;
|
||||
case OGS_NAS_EPS_TRACKING_AREA_UPDATE_REQUEST:
|
||||
ogs_debug("Tracking area update request");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_tau_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED));
|
||||
r = nas_eps_send_tau_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
case OGS_NAS_EPS_EMM_STATUS:
|
||||
|
@ -1017,18 +1030,16 @@ void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e)
|
|||
"Stop retransmission", mme_ue->imsi_bcd);
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
|
||||
ogs_expect(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
rv = nas_eps_send_security_mode_command(mme_ue);
|
||||
if (rv == OGS_OK) {
|
||||
mme_ue->t3460.retry_count++;
|
||||
} else {
|
||||
ogs_error("nas_eps_send_security_mode_command() failed");
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
}
|
||||
mme_ue->t3460.retry_count++;
|
||||
r = nas_eps_send_security_mode_command(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1045,7 +1056,7 @@ void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
ogs_nas_eps_message_t *message = NULL;
|
||||
ogs_nas_security_header_type_t h;
|
||||
|
@ -1070,9 +1081,10 @@ void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e)
|
|||
if (message->emm.h.security_header_type
|
||||
== OGS_NAS_SECURITY_HEADER_FOR_SERVICE_REQUEST_MESSAGE) {
|
||||
ogs_debug("Service request");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
|
||||
r = nas_eps_send_service_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -1225,7 +1237,10 @@ void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e)
|
|||
mme_ue->t3450.retry_count++;
|
||||
|
||||
emmbuf = mme_ue->t3450.pkbuf;
|
||||
ogs_expect_or_return(emmbuf);
|
||||
if (!emmbuf) {
|
||||
ogs_error("No emmbuf");
|
||||
return;
|
||||
}
|
||||
|
||||
mme_ue->t3450.pkbuf = ogs_pkbuf_copy(emmbuf);
|
||||
ogs_assert(mme_ue->t3450.pkbuf);
|
||||
|
@ -1233,12 +1248,9 @@ void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e)
|
|||
ogs_timer_start(mme_ue->t3450.timer,
|
||||
mme_timer_cfg(MME_TIMER_T3450)->duration);
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("nas_eps_send_to_downlink_nas_transport() "
|
||||
"failed");
|
||||
OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
|
||||
}
|
||||
r = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1255,7 +1267,7 @@ void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
void emm_state_exception(ogs_fsm_t *s, mme_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
|
@ -1298,8 +1310,9 @@ void emm_state_exception(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
if (!MME_UE_HAVE_IMSI(mme_ue)) {
|
||||
CLEAR_MME_UE_TIMER(mme_ue->t3470);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_identity_request(mme_ue));
|
||||
r = nas_eps_send_identity_request(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
OGS_FSM_TRAN(s, &emm_state_de_registered);
|
||||
break;
|
||||
|
@ -1314,10 +1327,11 @@ void emm_state_exception(ogs_fsm_t *s, mme_event_t *e)
|
|||
&mme_ue->pdn_connectivity_request);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("nas_eps_send_emm_to_esm() failed");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer,
|
||||
ogs_nas_eps_pdn_connectivity_request_t *req, int create_action)
|
||||
{
|
||||
int r;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
mme_sess_t *sess = NULL;
|
||||
uint8_t security_protected_required = 0;
|
||||
|
@ -65,9 +66,11 @@ int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer,
|
|||
mme_ue, req->access_point_name.apn);
|
||||
if (!sess->session) {
|
||||
/* Invalid APN */
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_pdn_connectivity_reject(
|
||||
sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN, create_action));
|
||||
r = nas_eps_send_pdn_connectivity_reject(
|
||||
sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN,
|
||||
create_action);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
ogs_warn("Invalid APN[%s]", req->access_point_name.apn);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
@ -80,9 +83,11 @@ int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer,
|
|||
if (derived_pdn_type == 0) {
|
||||
ogs_error("Cannot derived PDN Type [UE:%d,HSS:%d]",
|
||||
sess->request_type.type, sess->session->session_type);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_pdn_connectivity_reject(
|
||||
sess, OGS_NAS_ESM_CAUSE_UNKNOWN_PDN_TYPE, create_action));
|
||||
r = nas_eps_send_pdn_connectivity_reject(
|
||||
sess, OGS_NAS_ESM_CAUSE_UNKNOWN_PDN_TYPE,
|
||||
create_action);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
} else {
|
||||
|
@ -102,7 +107,9 @@ int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer,
|
|||
|
||||
if (security_protected_required) {
|
||||
CLEAR_BEARER_TIMER(bearer->t3489);
|
||||
ogs_assert(OGS_OK == nas_eps_send_esm_information_request(bearer));
|
||||
r = nas_eps_send_esm_information_request(bearer);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
@ -137,9 +144,10 @@ int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer,
|
|||
mme_gtp_send_create_session_request(sess, create_action));
|
||||
} else {
|
||||
ogs_error("No APN");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_pdn_connectivity_reject(
|
||||
sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN, create_action));
|
||||
r = nas_eps_send_pdn_connectivity_reject(
|
||||
sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN, create_action);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -149,6 +157,7 @@ int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer,
|
|||
int esm_handle_information_response(mme_sess_t *sess,
|
||||
ogs_nas_eps_esm_information_response_t *rsp)
|
||||
{
|
||||
int r;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
ogs_assert(sess);
|
||||
|
@ -183,10 +192,11 @@ int esm_handle_information_response(mme_sess_t *sess,
|
|||
if (derived_pdn_type == 0) {
|
||||
ogs_error("Cannot derived PDN Type [UE:%d,HSS:%d]",
|
||||
sess->request_type.type, sess->session->session_type);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_pdn_connectivity_reject(
|
||||
r = nas_eps_send_pdn_connectivity_reject(
|
||||
sess, OGS_NAS_ESM_CAUSE_UNKNOWN_PDN_TYPE,
|
||||
OGS_GTP_CREATE_IN_ATTACH_REQUEST));
|
||||
OGS_GTP_CREATE_IN_ATTACH_REQUEST);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
} else {
|
||||
|
@ -203,8 +213,9 @@ int esm_handle_information_response(mme_sess_t *sess,
|
|||
ogs_assert(OGS_OK ==
|
||||
sgsap_send_location_update_request(mme_ue));
|
||||
} else {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_accept(mme_ue));
|
||||
r = nas_eps_send_attach_accept(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
} else {
|
||||
ogs_assert(OGS_OK ==
|
||||
|
@ -217,10 +228,11 @@ int esm_handle_information_response(mme_sess_t *sess,
|
|||
else
|
||||
ogs_error("No APN");
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_pdn_connectivity_reject(
|
||||
r = nas_eps_send_pdn_connectivity_reject(
|
||||
sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN,
|
||||
OGS_GTP_CREATE_IN_ATTACH_REQUEST));
|
||||
OGS_GTP_CREATE_IN_ATTACH_REQUEST);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -230,6 +242,7 @@ int esm_handle_information_response(mme_sess_t *sess,
|
|||
int esm_handle_bearer_resource_allocation_request(
|
||||
mme_bearer_t *bearer, ogs_nas_eps_message_t *message)
|
||||
{
|
||||
int r;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
mme_sess_t *sess = NULL;
|
||||
|
||||
|
@ -239,9 +252,10 @@ int esm_handle_bearer_resource_allocation_request(
|
|||
mme_ue = sess->mme_ue;
|
||||
ogs_assert(mme_ue);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_bearer_resource_allocation_reject(
|
||||
mme_ue, sess->pti, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE));
|
||||
r = nas_eps_send_bearer_resource_allocation_reject(
|
||||
mme_ue, sess->pti, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ void esm_state_final(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
void esm_state_inactive(ogs_fsm_t *s, mme_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
mme_sess_t *sess = NULL;
|
||||
mme_bearer_t *bearer = NULL;
|
||||
|
@ -122,8 +122,9 @@ void esm_state_inactive(ogs_fsm_t *s, mme_event_t *e)
|
|||
mme_gtp_send_delete_session_request(mme_ue->sgw_ue, sess,
|
||||
OGS_GTP_DELETE_SEND_DEACTIVATE_BEARER_CONTEXT_REQUEST));
|
||||
} else {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_deactivate_bearer_context_request(bearer));
|
||||
r = nas_eps_send_deactivate_bearer_context_request(bearer);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
OGS_FSM_TRAN(s, esm_state_pdn_will_disconnect);
|
||||
break;
|
||||
|
@ -137,30 +138,34 @@ void esm_state_inactive(ogs_fsm_t *s, mme_event_t *e)
|
|||
h.type = e->nas_type;
|
||||
if (h.integrity_protected == 0) {
|
||||
ogs_error("[%s] No Integrity Protected", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
ogs_assert(mme_ue->enb_ue);
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(mme_ue->enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(mme_ue->enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &esm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!SECURITY_CONTEXT_IS_VALID(mme_ue)) {
|
||||
ogs_warn("[%s] No Security Context", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
ogs_assert(mme_ue->enb_ue);
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(mme_ue->enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(mme_ue->enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
OGS_FSM_TRAN(s, &esm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
@ -230,18 +235,16 @@ void esm_state_inactive(ogs_fsm_t *s, mme_event_t *e)
|
|||
"Stop retransmission", mme_ue->imsi_bcd);
|
||||
OGS_FSM_TRAN(&bearer->sm, &esm_state_exception);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_pdn_connectivity_reject(sess,
|
||||
r = nas_eps_send_pdn_connectivity_reject(sess,
|
||||
OGS_NAS_ESM_CAUSE_ESM_INFORMATION_NOT_RECEIVED,
|
||||
e->create_action));
|
||||
e->create_action);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
rv = nas_eps_send_esm_information_request(bearer);
|
||||
if (rv == OGS_OK) {
|
||||
bearer->t3489.retry_count++;
|
||||
} else {
|
||||
ogs_error("nas_eps_send_esm_information_request() failed");
|
||||
OGS_FSM_TRAN(&bearer->sm, &esm_state_exception);
|
||||
}
|
||||
bearer->t3489.retry_count++;
|
||||
r = nas_eps_send_esm_information_request(bearer);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -258,7 +261,7 @@ void esm_state_inactive(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
void esm_state_active(ogs_fsm_t *s, mme_event_t *e)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
mme_sess_t *sess = NULL;
|
||||
mme_bearer_t *bearer = NULL;
|
||||
|
@ -309,8 +312,9 @@ void esm_state_active(ogs_fsm_t *s, mme_event_t *e)
|
|||
mme_gtp_send_delete_session_request(mme_ue->sgw_ue, sess,
|
||||
OGS_GTP_DELETE_SEND_DEACTIVATE_BEARER_CONTEXT_REQUEST));
|
||||
} else {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_deactivate_bearer_context_request(bearer));
|
||||
r = nas_eps_send_deactivate_bearer_context_request(bearer);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
OGS_FSM_TRAN(s, esm_state_pdn_will_disconnect);
|
||||
break;
|
||||
|
|
|
@ -3223,6 +3223,7 @@ mme_bearer_t *mme_bearer_find_by_ue_ebi(mme_ue_t *mme_ue, uint8_t ebi)
|
|||
mme_bearer_t *mme_bearer_find_or_add_by_message(
|
||||
mme_ue_t *mme_ue, ogs_nas_eps_message_t *message, int create_action)
|
||||
{
|
||||
int r;
|
||||
uint8_t pti = OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED;
|
||||
uint8_t ebi = OGS_NAS_EPS_BEARER_IDENTITY_UNASSIGNED;
|
||||
|
||||
|
@ -3242,10 +3243,11 @@ mme_bearer_t *mme_bearer_find_or_add_by_message(
|
|||
bearer = mme_bearer_find_by_ue_ebi(mme_ue, ebi);
|
||||
if (!bearer) {
|
||||
ogs_error("No Bearer : EBI[%d]", ebi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -3254,10 +3256,11 @@ mme_bearer_t *mme_bearer_find_or_add_by_message(
|
|||
|
||||
if (pti == OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED) {
|
||||
ogs_error("Both PTI[%d] and EBI[%d] are 0", pti, ebi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -3272,10 +3275,11 @@ mme_bearer_t *mme_bearer_find_or_add_by_message(
|
|||
if (!bearer) {
|
||||
ogs_error("No Bearer : Linked-EBI[%d]",
|
||||
linked_eps_bearer_identity->eps_bearer_identity);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
} else if (message->esm.h.message_type ==
|
||||
|
@ -3291,10 +3295,11 @@ mme_bearer_t *mme_bearer_find_or_add_by_message(
|
|||
if (!bearer) {
|
||||
ogs_error("No Bearer : Linked-EBI[%d]",
|
||||
linked_eps_bearer_identity->eps_bearer_identity);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_bearer_resource_allocation_reject(
|
||||
r = nas_eps_send_bearer_resource_allocation_reject(
|
||||
mme_ue, pti,
|
||||
OGS_NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY));
|
||||
OGS_NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -3311,10 +3316,11 @@ mme_bearer_t *mme_bearer_find_or_add_by_message(
|
|||
if (!bearer) {
|
||||
ogs_error("No Bearer : Linked-EBI[%d]",
|
||||
linked_eps_bearer_identity->eps_bearer_identity);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_bearer_resource_modification_reject(
|
||||
r = nas_eps_send_bearer_resource_modification_reject(
|
||||
mme_ue, pti,
|
||||
OGS_NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY));
|
||||
OGS_NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -3335,11 +3341,12 @@ mme_bearer_t *mme_bearer_find_or_add_by_message(
|
|||
sess = mme_sess_find_by_apn(mme_ue,
|
||||
pdn_connectivity_request->access_point_name.apn);
|
||||
if (sess && create_action != OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_pdn_connectivity_reject(
|
||||
r = nas_eps_send_pdn_connectivity_reject(
|
||||
sess,
|
||||
OGS_NAS_ESM_CAUSE_MULTIPLE_PDN_CONNECTIONS_FOR_A_GIVEN_APN_NOT_ALLOWED,
|
||||
create_action));
|
||||
create_action);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
ogs_warn("APN duplicated [%s]",
|
||||
pdn_connectivity_request->access_point_name.apn);
|
||||
return NULL;
|
||||
|
@ -3359,10 +3366,11 @@ mme_bearer_t *mme_bearer_find_or_add_by_message(
|
|||
if (!sess) {
|
||||
ogs_error("No Session : ESM message type[%d], PTI[%d]",
|
||||
message->esm.h.message_type, pti);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ static void _gtpv2_c_recv_cb(short when, ogs_socket_t fd, void *data)
|
|||
|
||||
static void timeout(ogs_gtp_xact_t *xact, void *data)
|
||||
{
|
||||
int r;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
mme_sess_t *sess = NULL;
|
||||
|
@ -131,10 +132,11 @@ static void timeout(ogs_gtp_xact_t *xact, void *data)
|
|||
|
||||
enb_ue = enb_ue_cycle(mme_ue->enb_ue);
|
||||
if (enb_ue) {
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_warn("No S1 Context");
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
void mme_send_delete_session_or_detach(mme_ue_t *mme_ue)
|
||||
{
|
||||
int r;
|
||||
ogs_assert(mme_ue);
|
||||
|
||||
switch (mme_ue->detach_type) {
|
||||
|
@ -35,7 +36,9 @@ void mme_send_delete_session_or_detach(mme_ue_t *mme_ue)
|
|||
mme_gtp_send_delete_all_sessions(
|
||||
mme_ue, OGS_GTP_DELETE_SEND_DETACH_ACCEPT);
|
||||
} else {
|
||||
ogs_assert(OGS_OK == nas_eps_send_detach_accept(mme_ue));
|
||||
r = nas_eps_send_detach_accept(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -94,6 +97,7 @@ void mme_send_delete_session_or_detach(mme_ue_t *mme_ue)
|
|||
|
||||
void mme_send_delete_session_or_mme_ue_context_release(mme_ue_t *mme_ue)
|
||||
{
|
||||
int r;
|
||||
ogs_assert(mme_ue);
|
||||
|
||||
if (SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) {
|
||||
|
@ -102,10 +106,11 @@ void mme_send_delete_session_or_mme_ue_context_release(mme_ue_t *mme_ue)
|
|||
} else {
|
||||
enb_ue_t *enb_ue = enb_ue_cycle(mme_ue->enb_ue);
|
||||
if (enb_ue) {
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_warn("[%s] No S1 Context", mme_ue->imsi_bcd);
|
||||
}
|
||||
|
@ -114,6 +119,7 @@ void mme_send_delete_session_or_mme_ue_context_release(mme_ue_t *mme_ue)
|
|||
|
||||
void mme_send_release_access_bearer_or_ue_context_release(enb_ue_t *enb_ue)
|
||||
{
|
||||
int r;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
ogs_assert(enb_ue);
|
||||
|
||||
|
@ -125,15 +131,17 @@ void mme_send_release_access_bearer_or_ue_context_release(enb_ue_t *enb_ue)
|
|||
mme_ue, OGS_GTP_RELEASE_SEND_UE_CONTEXT_RELEASE_COMMAND));
|
||||
} else {
|
||||
ogs_debug("No UE Context");
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0));
|
||||
S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
void mme_send_after_paging(mme_ue_t *mme_ue, bool failed)
|
||||
{
|
||||
int r;
|
||||
mme_bearer_t *bearer = NULL;
|
||||
|
||||
ogs_assert(mme_ue);
|
||||
|
@ -168,8 +176,9 @@ void mme_send_after_paging(mme_ue_t *mme_ue, bool failed)
|
|||
mme_gtp_send_create_bearer_response(
|
||||
bearer, OGS_GTP2_CAUSE_UNABLE_TO_PAGE_UE));
|
||||
} else {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_activate_dedicated_bearer_context_request(bearer));
|
||||
r = nas_eps_send_activate_dedicated_bearer_context_request(bearer);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
case MME_PAGING_TYPE_UPDATE_BEARER:
|
||||
|
@ -190,12 +199,13 @@ void mme_send_after_paging(mme_ue_t *mme_ue, bool failed)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_modify_bearer_context_request(bearer,
|
||||
r = nas_eps_send_modify_bearer_context_request(bearer,
|
||||
(xact->update_flags &
|
||||
OGS_GTP_MODIFY_QOS_UPDATE) ? 1 : 0,
|
||||
(xact->update_flags &
|
||||
OGS_GTP_MODIFY_TFT_UPDATE) ? 1 : 0));
|
||||
OGS_GTP_MODIFY_TFT_UPDATE) ? 1 : 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
case MME_PAGING_TYPE_DELETE_BEARER:
|
||||
|
@ -210,8 +220,9 @@ void mme_send_after_paging(mme_ue_t *mme_ue, bool failed)
|
|||
mme_gtp_send_delete_bearer_response(
|
||||
bearer, OGS_GTP2_CAUSE_UNABLE_TO_PAGE_UE));
|
||||
} else {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_deactivate_bearer_context_request(bearer));
|
||||
r = nas_eps_send_deactivate_bearer_context_request(bearer);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
case MME_PAGING_TYPE_CS_CALL_SERVICE:
|
||||
|
@ -239,7 +250,9 @@ void mme_send_after_paging(mme_ue_t *mme_ue, bool failed)
|
|||
/* Nothing */
|
||||
ogs_warn("MME-initiated Detach cannot be invoked");
|
||||
} else {
|
||||
ogs_assert(OGS_OK == nas_eps_send_detach_request(mme_ue));
|
||||
r = nas_eps_send_detach_request(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
if (MME_P_TMSI_IS_AVAILABLE(mme_ue)) {
|
||||
ogs_assert(OGS_OK == sgsap_send_detach_indication(mme_ue));
|
||||
} else {
|
||||
|
|
|
@ -81,7 +81,7 @@ void mme_s11_handle_create_session_response(
|
|||
ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
|
||||
ogs_gtp2_create_session_response_t *rsp)
|
||||
{
|
||||
int rv, i;
|
||||
int i, r, rv;
|
||||
uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
uint8_t session_cause = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
uint8_t bearer_cause = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
|
@ -151,8 +151,11 @@ void mme_s11_handle_create_session_response(
|
|||
if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
|
||||
ogs_error("[%s] Attach reject [Cause:%d]",
|
||||
mme_ue->imsi_bcd, session_cause);
|
||||
ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_NETWORK_FAILURE, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE));
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_NETWORK_FAILURE,
|
||||
OGS_NAS_ESM_CAUSE_NETWORK_FAILURE);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
mme_send_delete_session_or_mme_ue_context_release(mme_ue);
|
||||
return;
|
||||
|
@ -216,9 +219,11 @@ void mme_s11_handle_create_session_response(
|
|||
if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
|
||||
ogs_error("[%s] Attach reject [Cause:%d]",
|
||||
mme_ue->imsi_bcd, session_cause);
|
||||
ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_NETWORK_FAILURE,
|
||||
OGS_NAS_ESM_CAUSE_NETWORK_FAILURE));
|
||||
OGS_NAS_ESM_CAUSE_NETWORK_FAILURE);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
mme_send_delete_session_or_mme_ue_context_release(mme_ue);
|
||||
return;
|
||||
|
@ -246,9 +251,11 @@ void mme_s11_handle_create_session_response(
|
|||
mme_ue->imsi_bcd, bearer_cause);
|
||||
if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
|
||||
ogs_error("[%s] Attach reject", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_NETWORK_FAILURE,
|
||||
OGS_NAS_ESM_CAUSE_NETWORK_FAILURE));
|
||||
OGS_NAS_ESM_CAUSE_NETWORK_FAILURE);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
mme_send_delete_session_or_mme_ue_context_release(mme_ue);
|
||||
return;
|
||||
|
@ -264,8 +271,11 @@ void mme_s11_handle_create_session_response(
|
|||
ogs_error("[%s] GTP Cause [VALUE:%d]", mme_ue->imsi_bcd, session_cause);
|
||||
if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
|
||||
ogs_error("[%s] Attach reject", mme_ue->imsi_bcd);
|
||||
ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_NETWORK_FAILURE, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE));
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_NETWORK_FAILURE,
|
||||
OGS_NAS_ESM_CAUSE_NETWORK_FAILURE);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
mme_send_delete_session_or_mme_ue_context_release(mme_ue);
|
||||
return;
|
||||
|
@ -395,15 +405,17 @@ void mme_s11_handle_create_session_response(
|
|||
} else {
|
||||
ogs_assert(OGS_PDU_SESSION_TYPE_IS_VALID(
|
||||
session->paa.session_type));
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_accept(mme_ue));
|
||||
r = nas_eps_send_attach_accept(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else if (create_action == OGS_GTP_CREATE_IN_UPLINK_NAS_TRANSPORT) {
|
||||
ogs_assert(OGS_PDU_SESSION_TYPE_IS_VALID(session->paa.session_type));
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_activate_default_bearer_context_request(
|
||||
bearer, create_action));
|
||||
r = nas_eps_send_activate_default_bearer_context_request(
|
||||
bearer, create_action);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else if (create_action == OGS_GTP_CREATE_IN_PATH_SWITCH_REQUEST) {
|
||||
|
||||
GTP_COUNTER_CHECK(mme_ue, GTP_COUNTER_CREATE_SESSION_BY_PATH_SWITCH,
|
||||
|
@ -411,7 +423,9 @@ void mme_s11_handle_create_session_response(
|
|||
mme_timer_cfg(MME_TIMER_S11_HOLDING)->duration);
|
||||
|
||||
sgw_ue_associate_mme_ue(target_ue, mme_ue);
|
||||
ogs_assert(OGS_OK == s1ap_send_path_switch_ack(mme_ue, true));
|
||||
r = s1ap_send_path_switch_ack(mme_ue, true);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
);
|
||||
|
||||
} else {
|
||||
|
@ -424,7 +438,7 @@ void mme_s11_handle_modify_bearer_response(
|
|||
ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
|
||||
ogs_gtp2_modify_bearer_response_t *rsp)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
uint8_t session_cause = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
int modify_action = 0;
|
||||
|
@ -511,10 +525,14 @@ void mme_s11_handle_modify_bearer_response(
|
|||
|
||||
switch (modify_action) {
|
||||
case OGS_GTP_MODIFY_IN_PATH_SWITCH_REQUEST:
|
||||
ogs_assert(OGS_OK == s1ap_send_path_switch_ack(mme_ue, false));
|
||||
r = s1ap_send_path_switch_ack(mme_ue, false);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
case OGS_GTP_MODIFY_IN_E_RAB_MODIFICATION:
|
||||
ogs_assert(OGS_OK == s1ap_send_e_rab_modification_confirm(mme_ue));
|
||||
r = s1ap_send_e_rab_modification_confirm(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -525,7 +543,7 @@ void mme_s11_handle_delete_session_response(
|
|||
ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
|
||||
ogs_gtp2_delete_session_response_t *rsp)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
int action = 0;
|
||||
sgw_ue_t *source_ue = NULL, *target_ue = NULL;
|
||||
|
@ -601,7 +619,9 @@ void mme_s11_handle_delete_session_response(
|
|||
|
||||
} else if (action == OGS_GTP_DELETE_SEND_DETACH_ACCEPT) {
|
||||
if (mme_sess_count(mme_ue) == 1) /* Last Session */ {
|
||||
ogs_assert(OGS_OK == nas_eps_send_detach_accept(mme_ue));
|
||||
r = nas_eps_send_detach_accept(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
} else if (action ==
|
||||
|
@ -609,8 +629,9 @@ void mme_s11_handle_delete_session_response(
|
|||
mme_bearer_t *bearer = mme_default_bearer_in_sess(sess);
|
||||
ogs_expect_or_return(bearer);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_deactivate_bearer_context_request(bearer));
|
||||
r = nas_eps_send_deactivate_bearer_context_request(bearer);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
/*
|
||||
* mme_sess_remove() should not be called here.
|
||||
|
@ -631,10 +652,11 @@ void mme_s11_handle_delete_session_response(
|
|||
}
|
||||
} else {
|
||||
ogs_assert(mme_ue->enb_ue);
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(mme_ue->enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(mme_ue->enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -645,10 +667,11 @@ void mme_s11_handle_delete_session_response(
|
|||
|
||||
enb_ue = enb_ue_cycle(mme_ue->enb_ue);
|
||||
if (enb_ue) {
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_S1_REMOVE_AND_UNLINK, 0));
|
||||
S1AP_UE_CTX_REL_S1_REMOVE_AND_UNLINK, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else
|
||||
ogs_error("ENB-S1 Context has already been removed");
|
||||
}
|
||||
|
@ -659,10 +682,11 @@ void mme_s11_handle_delete_session_response(
|
|||
&mme_ue->pdn_connectivity_request);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("nas_eps_send_emm_to_esm() failed");
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -701,6 +725,7 @@ void mme_s11_handle_create_bearer_request(
|
|||
ogs_gtp_xact_t *xact, mme_ue_t *mme_ue,
|
||||
ogs_gtp2_create_bearer_request_t *req)
|
||||
{
|
||||
int r;
|
||||
uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
mme_bearer_t *bearer = NULL, *default_bearer = NULL;
|
||||
mme_sess_t *sess = NULL;
|
||||
|
@ -863,10 +888,13 @@ void mme_s11_handle_create_bearer_request(
|
|||
if (ECM_IDLE(mme_ue)) {
|
||||
MME_STORE_PAGING_INFO(mme_ue,
|
||||
MME_PAGING_TYPE_CREATE_BEARER, bearer);
|
||||
ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
|
||||
r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_activate_dedicated_bearer_context_request(bearer));
|
||||
r = nas_eps_send_activate_dedicated_bearer_context_request(bearer);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
@ -880,6 +908,7 @@ void mme_s11_handle_update_bearer_request(
|
|||
ogs_gtp_xact_t *xact, mme_ue_t *mme_ue,
|
||||
ogs_gtp2_update_bearer_request_t *req)
|
||||
{
|
||||
int r;
|
||||
uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
mme_bearer_t *bearer = NULL;
|
||||
mme_sess_t *sess = NULL;
|
||||
|
@ -988,12 +1017,15 @@ void mme_s11_handle_update_bearer_request(
|
|||
if (ECM_IDLE(mme_ue)) {
|
||||
MME_STORE_PAGING_INFO(mme_ue,
|
||||
MME_PAGING_TYPE_UPDATE_BEARER, bearer);
|
||||
ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
|
||||
r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_modify_bearer_context_request(bearer,
|
||||
r = nas_eps_send_modify_bearer_context_request(bearer,
|
||||
req->bearer_contexts.bearer_level_qos.presence,
|
||||
req->bearer_contexts.tft.presence));
|
||||
req->bearer_contexts.tft.presence);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
} else {
|
||||
ogs_error("[IGNORE] Update Bearer Request : "
|
||||
|
@ -1001,10 +1033,11 @@ void mme_s11_handle_update_bearer_request(
|
|||
|
||||
if (xact->xid & OGS_GTP_CMD_XACT_ID) {
|
||||
/* MME received Bearer Resource Modification Request */
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_bearer_resource_modification_reject(
|
||||
r = nas_eps_send_bearer_resource_modification_reject(
|
||||
mme_ue, sess->pti,
|
||||
OGS_NAS_ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED));
|
||||
OGS_NAS_ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
|
@ -1017,6 +1050,7 @@ void mme_s11_handle_delete_bearer_request(
|
|||
ogs_gtp_xact_t *xact, mme_ue_t *mme_ue,
|
||||
ogs_gtp2_delete_bearer_request_t *req)
|
||||
{
|
||||
int r;
|
||||
uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
|
||||
mme_bearer_t *bearer = NULL;
|
||||
|
@ -1121,10 +1155,13 @@ void mme_s11_handle_delete_bearer_request(
|
|||
|
||||
if (ECM_IDLE(mme_ue)) {
|
||||
MME_STORE_PAGING_INFO(mme_ue, MME_PAGING_TYPE_DELETE_BEARER, bearer);
|
||||
ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
|
||||
r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_deactivate_bearer_context_request(bearer));
|
||||
r = nas_eps_send_deactivate_bearer_context_request(bearer);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1132,7 +1169,7 @@ void mme_s11_handle_release_access_bearers_response(
|
|||
ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
|
||||
ogs_gtp2_release_access_bearers_response_t *rsp)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
int action = 0;
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
|
@ -1197,10 +1234,11 @@ void mme_s11_handle_release_access_bearers_response(
|
|||
if (action == OGS_GTP_RELEASE_SEND_UE_CONTEXT_RELEASE_COMMAND) {
|
||||
enb_ue = enb_ue_cycle(mme_ue->enb_ue);
|
||||
if (enb_ue) {
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_S1_REMOVE_AND_UNLINK, 0));
|
||||
S1AP_UE_CTX_REL_S1_REMOVE_AND_UNLINK, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_error("ENB-S1 Context has already been removed");
|
||||
}
|
||||
|
@ -1232,9 +1270,11 @@ void mme_s11_handle_release_access_bearers_response(
|
|||
|
||||
enb_ue_remove(enb_ue);
|
||||
|
||||
if (ogs_list_count(&enb->enb_ue_list) == 0)
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_s1_reset_ack(enb, NULL));
|
||||
if (ogs_list_count(&enb->enb_ue_list) == 0) {
|
||||
r = s1ap_send_s1_reset_ack(enb, NULL);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
} else {
|
||||
ogs_error("ENB-S1 Context has already been removed");
|
||||
}
|
||||
|
@ -1265,7 +1305,9 @@ void mme_s11_handle_release_access_bearers_response(
|
|||
* where PartOfS1_interface was requested
|
||||
* REMOVED */
|
||||
ogs_assert(enb->s1_reset_ack);
|
||||
s1ap_send_to_enb(enb, enb->s1_reset_ack, S1AP_NON_UE_SIGNALLING);
|
||||
r = s1ap_send_to_enb(enb, enb->s1_reset_ack, S1AP_NON_UE_SIGNALLING);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
/* Clear S1-Reset Ack Buffer */
|
||||
enb->s1_reset_ack = NULL;
|
||||
|
@ -1284,6 +1326,7 @@ void mme_s11_handle_downlink_data_notification(
|
|||
ogs_gtp2_downlink_data_notification_t *noti)
|
||||
{
|
||||
uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
int r;
|
||||
|
||||
mme_bearer_t *bearer = NULL;
|
||||
sgw_ue_t *sgw_ue = NULL;
|
||||
|
@ -1370,7 +1413,9 @@ void mme_s11_handle_downlink_data_notification(
|
|||
if (ECM_IDLE(mme_ue)) {
|
||||
MME_STORE_PAGING_INFO(mme_ue,
|
||||
MME_PAGING_TYPE_DOWNLINK_DATA_NOTIFICATION, bearer);
|
||||
ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
|
||||
r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
} else if (ECM_CONNECTED(mme_ue)) {
|
||||
if (cause_value == OGS_GTP2_CAUSE_ERROR_INDICATION_RECEIVED) {
|
||||
|
@ -1406,10 +1451,11 @@ void mme_s11_handle_downlink_data_notification(
|
|||
enb_ue_t *enb_ue = enb_ue_cycle(mme_ue->enb_ue);
|
||||
ogs_assert(enb_ue);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_S1_PAGING, 0));
|
||||
S1AP_UE_CTX_REL_S1_PAGING, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_assert(OGS_OK ==
|
||||
mme_gtp_send_downlink_data_notification_ack(
|
||||
|
@ -1422,14 +1468,13 @@ void mme_s11_handle_create_indirect_data_forwarding_tunnel_response(
|
|||
ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
|
||||
ogs_gtp2_create_indirect_data_forwarding_tunnel_response_t *rsp)
|
||||
{
|
||||
int rv;
|
||||
int i, r, rv;
|
||||
uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
uint8_t session_cause = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
sgw_ue_t *sgw_ue = NULL;
|
||||
mme_bearer_t *bearer = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
enb_ue_t *source_ue = NULL;
|
||||
int i;
|
||||
|
||||
ogs_gtp2_f_teid_t *teid = NULL;
|
||||
|
||||
|
@ -1540,14 +1585,16 @@ void mme_s11_handle_create_indirect_data_forwarding_tunnel_response(
|
|||
source_ue = enb_ue_cycle(mme_ue->enb_ue);
|
||||
ogs_assert(source_ue);
|
||||
|
||||
ogs_assert(OGS_OK == s1ap_send_handover_command(source_ue));
|
||||
r = s1ap_send_handover_command(source_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
void mme_s11_handle_delete_indirect_data_forwarding_tunnel_response(
|
||||
ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
|
||||
ogs_gtp2_delete_indirect_data_forwarding_tunnel_response_t *rsp)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
uint8_t session_cause = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
int action = 0;
|
||||
|
@ -1637,8 +1684,9 @@ void mme_s11_handle_delete_indirect_data_forwarding_tunnel_response(
|
|||
if (action == OGS_GTP_DELETE_INDIRECT_HANDOVER_COMPLETE) {
|
||||
/* Nothing to do */
|
||||
} else if (action == OGS_GTP_DELETE_INDIRECT_HANDOVER_CANCEL) {
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_handover_cancel_ack(mme_ue->enb_ue));
|
||||
r = s1ap_send_handover_cancel_ack(mme_ue->enb_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_fatal("Invalid action = %d", action);
|
||||
ogs_assert_if_reached();
|
||||
|
@ -1649,7 +1697,7 @@ void mme_s11_handle_bearer_resource_failure_indication(
|
|||
ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
|
||||
ogs_gtp2_bearer_resource_failure_indication_t *ind)
|
||||
{
|
||||
int rv;
|
||||
int r, rv;
|
||||
uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
|
||||
|
||||
mme_bearer_t *bearer = NULL;
|
||||
|
@ -1700,9 +1748,10 @@ void mme_s11_handle_bearer_resource_failure_indication(
|
|||
ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]",
|
||||
mme_ue->mme_s11_teid, sgw_ue->sgw_s11_teid);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_bearer_resource_modification_reject(
|
||||
mme_ue, sess->pti, esm_cause_from_gtp(cause_value)));
|
||||
r = nas_eps_send_bearer_resource_modification_reject(
|
||||
mme_ue, sess->pti, esm_cause_from_gtp(cause_value));
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
if (!sgw_ue ||
|
||||
cause_value == OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND) {
|
||||
|
|
|
@ -39,6 +39,7 @@ static uint8_t mme_ue_session_from_slice_data(mme_ue_t *mme_ue,
|
|||
uint8_t mme_s6a_handle_aia(
|
||||
mme_ue_t *mme_ue, ogs_diam_s6a_message_t *s6a_message)
|
||||
{
|
||||
int r;
|
||||
ogs_diam_s6a_aia_message_t *aia_message = NULL;
|
||||
ogs_diam_e_utran_vector_t *e_utran_vector = NULL;
|
||||
|
||||
|
@ -66,7 +67,9 @@ uint8_t mme_s6a_handle_aia(
|
|||
if (mme_ue->nas_eps.ksi == OGS_NAS_KSI_NO_KEY_IS_AVAILABLE)
|
||||
mme_ue->nas_eps.ksi = 0;
|
||||
|
||||
ogs_assert(OGS_OK == nas_eps_send_authentication_request(mme_ue));
|
||||
r = nas_eps_send_authentication_request(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return OGS_NAS_EMM_CAUSE_REQUEST_ACCEPTED;
|
||||
}
|
||||
|
@ -77,7 +80,7 @@ uint8_t mme_s6a_handle_ula(
|
|||
ogs_diam_s6a_ula_message_t *ula_message = NULL;
|
||||
ogs_subscription_data_t *subscription_data = NULL;
|
||||
ogs_slice_data_t *slice_data = NULL;
|
||||
int rv, num_of_session;
|
||||
int r, rv, num_of_session;
|
||||
|
||||
ogs_assert(mme_ue);
|
||||
ogs_assert(s6a_message);
|
||||
|
@ -115,9 +118,10 @@ uint8_t mme_s6a_handle_ula(
|
|||
return OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED;
|
||||
}
|
||||
} else if (mme_ue->nas_eps.type == MME_EPS_TYPE_TAU_REQUEST) {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_tau_accept(mme_ue,
|
||||
S1AP_ProcedureCode_id_InitialContextSetup));
|
||||
r = nas_eps_send_tau_accept(mme_ue,
|
||||
S1AP_ProcedureCode_id_InitialContextSetup);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_error("Invalid Type[%d]", mme_ue->nas_eps.type);
|
||||
return OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED;
|
||||
|
@ -199,6 +203,7 @@ uint8_t mme_s6a_handle_idr(
|
|||
|
||||
void mme_s6a_handle_clr(mme_ue_t *mme_ue, ogs_diam_s6a_message_t *s6a_message)
|
||||
{
|
||||
int r;
|
||||
ogs_diam_s6a_clr_message_t *clr_message = NULL;
|
||||
ogs_assert(mme_ue);
|
||||
ogs_assert(s6a_message);
|
||||
|
@ -260,9 +265,13 @@ void mme_s6a_handle_clr(mme_ue_t *mme_ue, ogs_diam_s6a_message_t *s6a_message)
|
|||
*/
|
||||
if (ECM_IDLE(mme_ue)) {
|
||||
MME_STORE_PAGING_INFO(mme_ue, MME_PAGING_TYPE_DETACH_TO_UE, NULL);
|
||||
ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
|
||||
r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
ogs_assert(OGS_OK == nas_eps_send_detach_request(mme_ue));
|
||||
r = nas_eps_send_detach_request(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
if (MME_P_TMSI_IS_AVAILABLE(mme_ue)) {
|
||||
ogs_assert(OGS_OK == sgsap_send_detach_indication(mme_ue));
|
||||
} else {
|
||||
|
|
|
@ -62,7 +62,7 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
ogs_s1ap_message_t s1ap_message;
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
int rc;
|
||||
int rc, r;
|
||||
|
||||
ogs_nas_eps_message_t nas_message;
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
|
@ -196,10 +196,11 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e)
|
|||
ogs_fsm_dispatch(&enb->sm, e);
|
||||
} else {
|
||||
ogs_warn("Cannot decode S1AP message");
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_error_indication(
|
||||
r = s1ap_send_error_indication(
|
||||
enb, NULL, NULL, S1AP_Cause_PR_protocol,
|
||||
S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message));
|
||||
S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
ogs_s1ap_free(&s1ap_message);
|
||||
|
@ -217,7 +218,9 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e)
|
|||
pkbuf = e->pkbuf;
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
ogs_expect(OGS_OK == s1ap_send_to_enb_ue(enb_ue, pkbuf));
|
||||
r = s1ap_send_to_enb_ue(enb_ue, pkbuf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
ogs_timer_delete(e->timer);
|
||||
break;
|
||||
case MME_TIMER_S1_HOLDING:
|
||||
|
@ -251,11 +254,12 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e)
|
|||
if (!mme_ue) {
|
||||
mme_ue = mme_ue_add(enb_ue);
|
||||
if (mme_ue == NULL) {
|
||||
ogs_expect(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(enb_ue,
|
||||
S1AP_Cause_PR_misc,
|
||||
S1AP_CauseMisc_control_processing_overload,
|
||||
S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0));
|
||||
S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return;
|
||||
}
|
||||
|
@ -296,10 +300,11 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e)
|
|||
/* De-associate S1 with NAS/EMM */
|
||||
enb_ue_deassociate(mme_ue->enb_ue);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(mme_ue->enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(mme_ue->enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0));
|
||||
S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
enb_ue_associate_mme_ue(enb_ue, mme_ue);
|
||||
}
|
||||
|
@ -409,14 +414,16 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e)
|
|||
ogs_error("S1 context has already been removed");
|
||||
break;
|
||||
}
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue, emm_cause,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
r = nas_eps_send_attach_reject(mme_ue, emm_cause,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
break;
|
||||
case OGS_DIAM_S6A_CMD_CODE_UPDATE_LOCATION:
|
||||
|
@ -429,14 +436,16 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e)
|
|||
ogs_error("S1 context has already been removed");
|
||||
break;
|
||||
}
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue, emm_cause,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
r = nas_eps_send_attach_reject(mme_ue, emm_cause,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(enb_ue,
|
||||
r = s1ap_send_ue_context_release_command(enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
mme_ue->location_updated_but_not_canceled_yet = true;
|
||||
|
|
|
@ -28,16 +28,21 @@
|
|||
|
||||
int nas_eps_send_to_enb(mme_ue_t *mme_ue, ogs_pkbuf_t *pkbuf)
|
||||
{
|
||||
int rv;
|
||||
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
mme_ue = mme_ue_cycle(mme_ue);
|
||||
if (!mme_ue) {
|
||||
ogs_warn("UE(mme-ue) context has already been removed");
|
||||
ogs_error("UE(mme-ue) context has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
return s1ap_send_to_enb_ue(mme_ue->enb_ue, pkbuf);
|
||||
rv = s1ap_send_to_enb_ue(mme_ue->enb_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int nas_eps_send_emm_to_esm(mme_ue_t *mme_ue,
|
||||
|
@ -75,20 +80,23 @@ int nas_eps_send_to_downlink_nas_transport(mme_ue_t *mme_ue, ogs_pkbuf_t *pkbuf)
|
|||
|
||||
mme_ue = mme_ue_cycle(mme_ue);
|
||||
if (!mme_ue) {
|
||||
ogs_warn("UE(mme-ue) context has already been removed");
|
||||
ogs_error("UE(mme-ue) context has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
enb_ue = enb_ue_cycle(mme_ue->enb_ue);
|
||||
if (!enb_ue) {
|
||||
ogs_warn("S1 context has already been removed");
|
||||
ogs_error("S1 context has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
s1apbuf = s1ap_build_downlink_nas_transport(enb_ue, pkbuf);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_downlink_nas_transport() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -116,19 +124,31 @@ int nas_eps_send_attach_accept(mme_ue_t *mme_ue)
|
|||
|
||||
esmbuf = esm_build_activate_default_bearer_context_request(
|
||||
sess, OGS_GTP_CREATE_IN_ATTACH_REQUEST);
|
||||
ogs_expect_or_return_val(esmbuf, OGS_ERROR);
|
||||
if (!esmbuf) {
|
||||
ogs_error("esm_build_activate_default_bearer_context_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
emmbuf = emm_build_attach_accept(mme_ue, esmbuf);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_attach_accept() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
CLEAR_MME_UE_TIMER(mme_ue->t3450);
|
||||
mme_ue->t3450.pkbuf = ogs_pkbuf_copy(emmbuf);
|
||||
ogs_expect_or_return_val(mme_ue->t3450.pkbuf, OGS_ERROR);
|
||||
if (!mme_ue->t3450.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(mme_ue->t3450.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(mme_ue->t3450.timer,
|
||||
mme_timer_cfg(MME_TIMER_T3450)->duration);
|
||||
|
||||
s1apbuf = s1ap_build_initial_context_setup_request(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_initial_context_setup_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -143,7 +163,11 @@ int nas_eps_send_attach_reject(mme_ue_t *mme_ue,
|
|||
mme_sess_t *sess = NULL;
|
||||
ogs_pkbuf_t *esmbuf = NULL, *emmbuf = NULL;
|
||||
|
||||
ogs_expect_or_return_val(mme_ue, OGS_ERROR);
|
||||
mme_ue = mme_ue_cycle(mme_ue);
|
||||
if (!mme_ue) {
|
||||
ogs_error("UE(mme-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ogs_debug("[%s] Attach reject", mme_ue->imsi_bcd);
|
||||
ogs_debug(" Cause[%d]", emm_cause);
|
||||
|
@ -152,13 +176,19 @@ int nas_eps_send_attach_reject(mme_ue_t *mme_ue,
|
|||
if (sess) {
|
||||
esmbuf = esm_build_pdn_connectivity_reject(
|
||||
sess, esm_cause, OGS_GTP_CREATE_IN_ATTACH_REQUEST);
|
||||
ogs_expect_or_return_val(esmbuf, OGS_ERROR);
|
||||
if (!esmbuf) {
|
||||
ogs_error("esm_build_pdn_connectivity_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
emmbuf = emm_build_attach_reject(emm_cause, esmbuf);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_attach_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -174,19 +204,24 @@ int nas_eps_send_identity_request(mme_ue_t *mme_ue)
|
|||
|
||||
if (mme_ue->t3470.pkbuf) {
|
||||
emmbuf = mme_ue->t3470.pkbuf;
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
} else {
|
||||
emmbuf = emm_build_identity_request(mme_ue);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_identity_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
mme_ue->t3470.pkbuf = ogs_pkbuf_copy(emmbuf);
|
||||
ogs_expect_or_return_val(mme_ue->t3470.pkbuf, OGS_ERROR);
|
||||
if (!mme_ue->t3470.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(mme_ue->t3470.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(mme_ue->t3470.timer,
|
||||
mme_timer_cfg(MME_TIMER_T3470)->duration);
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -202,19 +237,24 @@ int nas_eps_send_authentication_request(mme_ue_t *mme_ue)
|
|||
|
||||
if (mme_ue->t3460.pkbuf) {
|
||||
emmbuf = mme_ue->t3460.pkbuf;
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
} else {
|
||||
emmbuf = emm_build_authentication_request(mme_ue);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_authentication_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
mme_ue->t3460.pkbuf = ogs_pkbuf_copy(emmbuf);
|
||||
ogs_expect_or_return_val(mme_ue->t3460.pkbuf, OGS_ERROR);
|
||||
if (!mme_ue->t3460.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(mme_ue->t3460.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(mme_ue->t3460.timer,
|
||||
mme_timer_cfg(MME_TIMER_T3460)->duration);
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -230,19 +270,24 @@ int nas_eps_send_security_mode_command(mme_ue_t *mme_ue)
|
|||
|
||||
if (mme_ue->t3460.pkbuf) {
|
||||
emmbuf = mme_ue->t3460.pkbuf;
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
} else {
|
||||
emmbuf = emm_build_security_mode_command(mme_ue);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_security_mode_command() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
mme_ue->t3460.pkbuf = ogs_pkbuf_copy(emmbuf);
|
||||
ogs_expect_or_return_val(mme_ue->t3460.pkbuf, OGS_ERROR);
|
||||
if (!mme_ue->t3460.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(mme_ue->t3460.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(mme_ue->t3460.timer,
|
||||
mme_timer_cfg(MME_TIMER_T3460)->duration);
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -257,10 +302,13 @@ int nas_eps_send_authentication_reject(mme_ue_t *mme_ue)
|
|||
ogs_debug("[%s] Authentication reject", mme_ue->imsi_bcd);
|
||||
|
||||
emmbuf = emm_build_authentication_reject();
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_authentication_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -274,19 +322,24 @@ int nas_eps_send_detach_request(mme_ue_t *mme_ue)
|
|||
|
||||
if (mme_ue->t3422.pkbuf) {
|
||||
emmbuf = mme_ue->t3422.pkbuf;
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
} else {
|
||||
emmbuf = emm_build_detach_request(mme_ue);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_detach_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
mme_ue->t3422.pkbuf = ogs_pkbuf_copy(emmbuf);
|
||||
ogs_expect_or_return_val(mme_ue->t3422.pkbuf, OGS_ERROR);
|
||||
if (!mme_ue->t3422.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(mme_ue->t3422.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(mme_ue->t3422.timer,
|
||||
mme_timer_cfg(MME_TIMER_T3422)->duration);
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -300,17 +353,26 @@ int nas_eps_send_detach_accept(mme_ue_t *mme_ue)
|
|||
|
||||
ogs_assert(mme_ue);
|
||||
enb_ue = enb_ue_cycle(mme_ue->enb_ue);
|
||||
ogs_expect_or_return_val(enb_ue, OGS_ERROR);
|
||||
if (!enb_ue) {
|
||||
ogs_error("S1 context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ogs_debug("[%s] Detach accept", mme_ue->imsi_bcd);
|
||||
|
||||
/* reply with detach accept */
|
||||
if (mme_ue->nas_eps.detach.switch_off == 0) {
|
||||
emmbuf = emm_build_detach_accept(mme_ue);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_detach_accept() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("nas_eps_send_to_downlink_nas_transport() failed");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
rv = s1ap_send_ue_context_release_command(enb_ue,
|
||||
|
@ -333,28 +395,29 @@ int nas_eps_send_pdn_connectivity_reject(
|
|||
ogs_assert(mme_ue);
|
||||
|
||||
if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
|
||||
/* During the UE-attach process, we'll send Attach-Reject
|
||||
* with pyggybacking PDN-connectivity-Reject */
|
||||
rv = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_ESM_FAILURE, esm_cause);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
enb_ue = enb_ue_cycle(mme_ue->enb_ue);
|
||||
if (enb_ue) {
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_ue_context_release_command(mme_ue->enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("nas_eps_send_attach_reject() failed");
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = s1ap_send_ue_context_release_command(mme_ue->enb_ue,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
||||
S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
} else {
|
||||
esmbuf = esm_build_pdn_connectivity_reject(
|
||||
sess, esm_cause, create_action);
|
||||
ogs_expect_or_return_val(esmbuf, OGS_ERROR);
|
||||
if (!esmbuf) {
|
||||
ogs_error("esm_build_pdn_connectivity_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, esmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -372,19 +435,24 @@ int nas_eps_send_esm_information_request(mme_bearer_t *bearer)
|
|||
|
||||
if (bearer->t3489.pkbuf) {
|
||||
esmbuf = bearer->t3489.pkbuf;
|
||||
ogs_expect_or_return_val(esmbuf, OGS_ERROR);
|
||||
} else {
|
||||
esmbuf = esm_build_information_request(bearer);
|
||||
ogs_expect_or_return_val(esmbuf, OGS_ERROR);
|
||||
if (!esmbuf) {
|
||||
ogs_error("esm_build_information_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
bearer->t3489.pkbuf = ogs_pkbuf_copy(esmbuf);
|
||||
ogs_expect_or_return_val(bearer->t3489.pkbuf, OGS_ERROR);
|
||||
if (!bearer->t3489.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(bearer->t3489) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(bearer->t3489.timer,
|
||||
mme_timer_cfg(MME_TIMER_T3489)->duration);
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, esmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -406,10 +474,16 @@ int nas_eps_send_activate_default_bearer_context_request(
|
|||
|
||||
esmbuf = esm_build_activate_default_bearer_context_request(
|
||||
sess, create_action);
|
||||
ogs_expect_or_return_val(esmbuf, OGS_ERROR);
|
||||
if (!esmbuf) {
|
||||
ogs_error("esm_build_activate_default_bearer_context_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
s1apbuf = s1ap_build_e_rab_setup_request(bearer, esmbuf);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_e_rab_setup_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -430,10 +504,17 @@ int nas_eps_send_activate_dedicated_bearer_context_request(
|
|||
ogs_assert(mme_ue);
|
||||
|
||||
esmbuf = esm_build_activate_dedicated_bearer_context_request(bearer);
|
||||
ogs_expect_or_return_val(esmbuf, OGS_ERROR);
|
||||
if (!esmbuf) {
|
||||
ogs_error(
|
||||
"esm_build_activate_dedicated_bearer_context_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
s1apbuf = s1ap_build_e_rab_setup_request(bearer, esmbuf);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_e_rab_setup_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -443,12 +524,15 @@ int nas_eps_send_activate_dedicated_bearer_context_request(
|
|||
|
||||
void nas_eps_send_activate_all_dedicated_bearers(mme_bearer_t *default_bearer)
|
||||
{
|
||||
int r;
|
||||
ogs_assert(default_bearer);
|
||||
|
||||
mme_bearer_t *dedicated_bearer = mme_bearer_next(default_bearer);
|
||||
while (dedicated_bearer) {
|
||||
nas_eps_send_activate_dedicated_bearer_context_request(
|
||||
r = nas_eps_send_activate_dedicated_bearer_context_request(
|
||||
dedicated_bearer);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
dedicated_bearer = mme_bearer_next(dedicated_bearer);
|
||||
}
|
||||
}
|
||||
|
@ -467,17 +551,23 @@ int nas_eps_send_modify_bearer_context_request(
|
|||
|
||||
esmbuf = esm_build_modify_bearer_context_request(
|
||||
bearer, qos_presence, tft_presence);
|
||||
ogs_expect_or_return_val(esmbuf, OGS_ERROR);
|
||||
if (!esmbuf) {
|
||||
ogs_error("esm_build_modify_bearer_context_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
if (qos_presence == 1) {
|
||||
s1apbuf = s1ap_build_e_rab_modify_request(bearer, esmbuf);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_e_rab_modify_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
} else {
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, esmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -496,11 +586,17 @@ int nas_eps_send_deactivate_bearer_context_request(mme_bearer_t *bearer)
|
|||
|
||||
esmbuf = esm_build_deactivate_bearer_context_request(
|
||||
bearer, OGS_NAS_ESM_CAUSE_REGULAR_DEACTIVATION);
|
||||
ogs_expect_or_return_val(esmbuf, OGS_ERROR);
|
||||
if (!esmbuf) {
|
||||
ogs_error("esm_build_deactivate_bearer_context_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
s1apbuf = s1ap_build_e_rab_release_command(bearer, esmbuf,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_e_rab_release_command() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -519,10 +615,13 @@ int nas_eps_send_bearer_resource_allocation_reject(
|
|||
|
||||
esmbuf = esm_build_bearer_resource_allocation_reject(
|
||||
mme_ue, pti, esm_cause);
|
||||
ogs_expect_or_return_val(esmbuf, OGS_ERROR);
|
||||
if (!esmbuf) {
|
||||
ogs_error("esm_build_bearer_resource_allocation_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, esmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -538,10 +637,13 @@ int nas_eps_send_bearer_resource_modification_reject(
|
|||
|
||||
esmbuf = esm_build_bearer_resource_modification_reject(
|
||||
mme_ue, pti, esm_cause);
|
||||
ogs_expect_or_return_val(esmbuf, OGS_ERROR);
|
||||
if (!esmbuf) {
|
||||
ogs_error("esm_build_bearer_resource_modification_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, esmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -557,12 +659,18 @@ int nas_eps_send_tau_accept(
|
|||
ogs_debug("[%s] Tracking area update accept", mme_ue->imsi_bcd);
|
||||
|
||||
emmbuf = emm_build_tau_accept(mme_ue);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_tau_accept() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
if (mme_ue->next.m_tmsi) {
|
||||
CLEAR_MME_UE_TIMER(mme_ue->t3450);
|
||||
mme_ue->t3450.pkbuf = ogs_pkbuf_copy(emmbuf);
|
||||
ogs_expect_or_return_val(mme_ue->t3450.pkbuf, OGS_ERROR);
|
||||
if (!mme_ue->t3450.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy(mme_ue->t3450.pkbuf) failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_timer_start(mme_ue->t3450.timer,
|
||||
mme_timer_cfg(MME_TIMER_T3450)->duration);
|
||||
}
|
||||
|
@ -570,13 +678,16 @@ int nas_eps_send_tau_accept(
|
|||
if (procedureCode == S1AP_ProcedureCode_id_InitialContextSetup) {
|
||||
ogs_pkbuf_t *s1apbuf = NULL;
|
||||
s1apbuf = s1ap_build_initial_context_setup_request(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_initial_context_setup_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
} else if (procedureCode == S1AP_ProcedureCode_id_downlinkNASTransport) {
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
} else
|
||||
ogs_assert_if_reached();
|
||||
|
||||
|
@ -594,10 +705,13 @@ int nas_eps_send_tau_reject(mme_ue_t *mme_ue, ogs_nas_emm_cause_t emm_cause)
|
|||
|
||||
/* Build TAU reject */
|
||||
emmbuf = emm_build_tau_reject(emm_cause, mme_ue);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_tau_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -614,10 +728,13 @@ int nas_eps_send_service_reject(mme_ue_t *mme_ue,
|
|||
|
||||
/* Build Service Reject */
|
||||
emmbuf = emm_build_service_reject(emm_cause, mme_ue);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_service_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -632,10 +749,13 @@ int nas_eps_send_cs_service_notification(mme_ue_t *mme_ue)
|
|||
ogs_debug("[%s] CS Service Notification", mme_ue->imsi_bcd);
|
||||
|
||||
emmbuf = emm_build_cs_service_notification(mme_ue);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_cs_service_notification() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -653,10 +773,13 @@ int nas_eps_send_downlink_nas_transport(
|
|||
ogs_debug("[%s] Downlink NAS transport", mme_ue->imsi_bcd);
|
||||
|
||||
emmbuf = emm_build_downlink_nas_transport(mme_ue, buffer, length);
|
||||
ogs_expect_or_return_val(emmbuf, OGS_ERROR);
|
||||
if (!emmbuf) {
|
||||
ogs_error("emm_build_downlink_nas_transport() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -55,16 +55,16 @@ int s1ap_send_to_enb(mme_enb_t *enb, ogs_pkbuf_t *pkbuf, uint16_t stream_no)
|
|||
|
||||
enb = mme_enb_cycle(enb);
|
||||
if (!enb) {
|
||||
ogs_warn("eNB has already been removed");
|
||||
ogs_error("eNB has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ogs_assert(enb->sctp.sock);
|
||||
if (enb->sctp.sock->fd == INVALID_SOCKET) {
|
||||
ogs_fatal("eNB SCTP socket has already been destroyed");
|
||||
ogs_log_hexdump(OGS_LOG_FATAL, pkbuf->data, pkbuf->len);
|
||||
ogs_assert_if_reached();
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -84,16 +84,20 @@ int s1ap_send_to_enb(mme_enb_t *enb, ogs_pkbuf_t *pkbuf, uint16_t stream_no)
|
|||
|
||||
int s1ap_send_to_enb_ue(enb_ue_t *enb_ue, ogs_pkbuf_t *pkbuf)
|
||||
{
|
||||
int rv;
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
enb_ue = enb_ue_cycle(enb_ue);
|
||||
if (!enb_ue) {
|
||||
ogs_warn("S1 context has already been removed");
|
||||
ogs_error("S1 context has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_ERROR;
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
return s1ap_send_to_enb(enb_ue->enb, pkbuf, enb_ue->enb_ostream_id);
|
||||
rv = s1ap_send_to_enb(enb_ue->enb, pkbuf, enb_ue->enb_ostream_id);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int s1ap_delayed_send_to_enb_ue(
|
||||
|
@ -118,10 +122,10 @@ int s1ap_delayed_send_to_enb_ue(
|
|||
|
||||
return OGS_OK;
|
||||
} else {
|
||||
mme_enb_t *enb = NULL;
|
||||
enb = enb_ue->enb;
|
||||
ogs_assert(enb);
|
||||
return s1ap_send_to_enb_ue(enb_ue, pkbuf);
|
||||
int rv = s1ap_send_to_enb_ue(enb_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,6 +158,7 @@ int s1ap_send_to_esm(
|
|||
int s1ap_send_to_nas(enb_ue_t *enb_ue,
|
||||
S1AP_ProcedureCode_t procedureCode, S1AP_NAS_PDU_t *nasPdu)
|
||||
{
|
||||
int rv;
|
||||
ogs_nas_eps_security_header_t *sh = NULL;
|
||||
ogs_nas_security_header_type_t security_header_type;
|
||||
|
||||
|
@ -244,9 +249,11 @@ int s1ap_send_to_nas(enb_ue_t *enb_ue,
|
|||
ogs_pkbuf_free(nasbuf);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
return s1ap_send_to_esm(
|
||||
rv = s1ap_send_to_esm(
|
||||
mme_ue, nasbuf, security_header_type.type,
|
||||
OGS_GTP_CREATE_IN_UPLINK_NAS_TRANSPORT);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
return rv;
|
||||
} else {
|
||||
ogs_error("Unknown/Unimplemented NAS Protocol discriminator 0x%02x",
|
||||
h->protocol_discriminator);
|
||||
|
@ -262,7 +269,10 @@ int s1ap_send_s1_setup_response(mme_enb_t *enb)
|
|||
|
||||
ogs_debug("S1-Setup response");
|
||||
s1ap_buffer = s1ap_build_setup_rsp();
|
||||
ogs_expect_or_return_val(s1ap_buffer, OGS_ERROR);
|
||||
if (!s1ap_buffer) {
|
||||
ogs_error("s1ap_build_setup_rsp() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = s1ap_send_to_enb(enb, s1ap_buffer, S1AP_NON_UE_SIGNALLING);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -278,7 +288,10 @@ int s1ap_send_s1_setup_failure(
|
|||
|
||||
ogs_debug("S1-Setup failure");
|
||||
s1ap_buffer = s1ap_build_setup_failure(group, cause, S1AP_TimeToWait_v10s);
|
||||
ogs_expect_or_return_val(s1ap_buffer, OGS_ERROR);
|
||||
if (!s1ap_buffer) {
|
||||
ogs_error("s1ap_build_setup_failure() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = s1ap_send_to_enb(enb, s1ap_buffer, S1AP_NON_UE_SIGNALLING);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -295,7 +308,10 @@ int s1ap_send_initial_context_setup_request(mme_ue_t *mme_ue)
|
|||
|
||||
ogs_debug("InitialContextSetupRequest");
|
||||
s1apbuf = s1ap_build_initial_context_setup_request(mme_ue, NULL);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_initial_context_setup_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -312,7 +328,10 @@ int s1ap_send_ue_context_modification_request(mme_ue_t *mme_ue)
|
|||
|
||||
ogs_debug("UEContextModificationRequest");
|
||||
s1apbuf = s1ap_build_ue_context_modification_request(mme_ue);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_ue_context_modification_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -340,7 +359,10 @@ int s1ap_send_ue_context_release_command(
|
|||
group, (int)cause, action, (int)duration);
|
||||
|
||||
s1apbuf = s1ap_build_ue_context_release_command(enb_ue, group, cause);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_ue_context_release_command() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = s1ap_delayed_send_to_enb_ue(enb_ue, s1apbuf, duration);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -369,14 +391,23 @@ int s1ap_send_paging(mme_ue_t *mme_ue, S1AP_CNDomain_t cn_domain)
|
|||
s1apbuf = mme_ue->t3413.pkbuf;
|
||||
} else {
|
||||
s1apbuf = s1ap_build_paging(mme_ue, cn_domain);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_paging() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
mme_ue->t3413.pkbuf = ogs_pkbuf_copy(s1apbuf);
|
||||
ogs_expect_or_return_val(mme_ue->t3413.pkbuf, OGS_ERROR);
|
||||
if (!mme_ue->t3413.pkbuf) {
|
||||
ogs_error("ogs_pkbuf_copy() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
|
||||
ogs_expect_or_return_val(rv == OGS_OK, rv);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("s1ap_send_to_enb() failed");
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +431,10 @@ int s1ap_send_mme_configuration_transfer(
|
|||
|
||||
ogs_debug("MMEConfigurationTransfer");
|
||||
s1apbuf = s1ap_build_mme_configuration_transfer(SONConfigurationTransfer);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_mme_configuration_transfer() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = s1ap_send_to_enb(target_enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -417,7 +451,10 @@ int s1ap_send_e_rab_modification_confirm(mme_ue_t *mme_ue)
|
|||
|
||||
ogs_debug("E-RABModificationConfirm");
|
||||
s1apbuf = s1ap_build_e_rab_modification_confirm(mme_ue);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_e_rab_modification_confirm() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -436,7 +473,10 @@ int s1ap_send_path_switch_ack(
|
|||
ogs_debug("PathSwitchAcknowledge");
|
||||
s1apbuf = s1ap_build_path_switch_ack(
|
||||
mme_ue, e_rab_to_switched_in_uplink_list);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_path_switch_ack() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -453,7 +493,10 @@ int s1ap_send_handover_command(enb_ue_t *source_ue)
|
|||
|
||||
ogs_debug("HandoverCommand");
|
||||
s1apbuf = s1ap_build_handover_command(source_ue);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_handover_command() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = s1ap_send_to_enb_ue(source_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -472,7 +515,10 @@ int s1ap_send_handover_preparation_failure(
|
|||
|
||||
ogs_debug("HandoverPreparationFailure");
|
||||
s1apbuf = s1ap_build_handover_preparation_failure(source_ue, group, cause);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_handover_preparation_failure() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = s1ap_send_to_enb_ue(source_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -489,7 +535,10 @@ int s1ap_send_handover_cancel_ack(enb_ue_t *source_ue)
|
|||
|
||||
ogs_debug("HandoverCancelAcknowledge");
|
||||
s1apbuf = s1ap_build_handover_cancel_ack(source_ue);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_handover_cancel_ack() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = s1ap_send_to_enb_ue(source_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -516,11 +565,12 @@ int s1ap_send_handover_request(
|
|||
|
||||
target_ue = enb_ue_add(target_enb, INVALID_UE_S1AP_ID);
|
||||
if (target_ue == NULL) {
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_error_indication(target_enb, NULL, NULL,
|
||||
rv = s1ap_send_error_indication(target_enb, NULL, NULL,
|
||||
S1AP_Cause_PR_misc,
|
||||
S1AP_CauseMisc_control_processing_overload));
|
||||
return OGS_ERROR;
|
||||
S1AP_CauseMisc_control_processing_overload);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
ogs_info(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
||||
|
@ -533,7 +583,10 @@ int s1ap_send_handover_request(
|
|||
s1apbuf = s1ap_build_handover_request(
|
||||
target_ue, handovertype, cause,
|
||||
source_totarget_transparentContainer);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_handover_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = s1ap_send_to_enb_ue(target_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -554,7 +607,10 @@ int s1ap_send_mme_status_transfer(
|
|||
ogs_info("MMEStatusTransfer");
|
||||
s1apbuf = s1ap_build_mme_status_transfer(target_ue,
|
||||
enb_statustransfer_transparentContainer);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_mme_status_transfer() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = s1ap_send_to_enb_ue(target_ue, s1apbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -576,7 +632,10 @@ int s1ap_send_error_indication(
|
|||
ogs_info("ErrorIndication");
|
||||
s1apbuf = ogs_s1ap_build_error_indication(
|
||||
mme_ue_s1ap_id, enb_ue_s1ap_id, group, cause);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("ogs_s1ap_build_error_indication() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
@ -596,9 +655,15 @@ int s1ap_send_error_indication2(
|
|||
|
||||
ogs_assert(mme_ue);
|
||||
enb_ue = enb_ue_cycle(mme_ue->enb_ue);
|
||||
ogs_expect_or_return_val(enb_ue, OGS_ERROR);
|
||||
enb = enb_ue->enb;
|
||||
ogs_expect_or_return_val(enb, OGS_ERROR);
|
||||
if (!enb_ue) {
|
||||
ogs_error("S1 context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
enb = mme_enb_cycle(enb_ue->enb);
|
||||
if (!enb) {
|
||||
ogs_error("eNB has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
mme_ue_s1ap_id = enb_ue->mme_ue_s1ap_id,
|
||||
enb_ue_s1ap_id = enb_ue->enb_ue_s1ap_id,
|
||||
|
@ -621,7 +686,10 @@ int s1ap_send_s1_reset_ack(
|
|||
|
||||
ogs_info("S1-Reset Acknowledge");
|
||||
s1apbuf = ogs_s1ap_build_s1_reset_ack(partOfS1_Interface);
|
||||
ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("ogs_s1ap_build_s1_reset_ack() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
|
|
@ -26,7 +26,7 @@ void sbc_handle_write_replace_warning_request(sbc_pws_data_t *sbc_pws)
|
|||
{
|
||||
ogs_pkbuf_t *s1apbuf = NULL;
|
||||
mme_enb_t *enb = NULL;
|
||||
int i, j, flag;
|
||||
int i, j, flag, r;
|
||||
|
||||
/* Find enB with matched TAI */
|
||||
ogs_list_for_each(&mme_self()->enb_list, enb) {
|
||||
|
@ -48,11 +48,15 @@ void sbc_handle_write_replace_warning_request(sbc_pws_data_t *sbc_pws)
|
|||
if (flag) {
|
||||
/* Build S1AP Write Replace Warning Request message */
|
||||
s1apbuf = s1ap_build_write_replace_warning_request(sbc_pws);
|
||||
ogs_expect_or_return(s1apbuf);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_kill_request() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Send to enb */
|
||||
ogs_expect(s1ap_send_to_enb(
|
||||
enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == OGS_OK);
|
||||
r = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +65,7 @@ void sbc_handle_stop_warning_request(sbc_pws_data_t *sbc_pws)
|
|||
{
|
||||
ogs_pkbuf_t *s1apbuf = NULL;
|
||||
mme_enb_t *enb = NULL;
|
||||
int i, j, flag;
|
||||
int i, j, flag, r;
|
||||
|
||||
/* Find enB with matched TAI */
|
||||
ogs_list_for_each(&mme_self()->enb_list, enb) {
|
||||
|
@ -83,11 +87,15 @@ void sbc_handle_stop_warning_request(sbc_pws_data_t *sbc_pws)
|
|||
if (flag) {
|
||||
/* Build S1AP Kill request message */
|
||||
s1apbuf = s1ap_build_kill_request(sbc_pws);
|
||||
ogs_expect_or_return(s1apbuf);
|
||||
if (!s1apbuf) {
|
||||
ogs_error("s1ap_build_kill_request() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Send to enb */
|
||||
ogs_expect(s1ap_send_to_enb(
|
||||
enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == OGS_OK);
|
||||
r = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
void sgsap_handle_location_update_accept(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
||||
{
|
||||
int r;
|
||||
ogs_tlv_t *root = NULL, *iter = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
|
@ -116,21 +117,24 @@ void sgsap_handle_location_update_accept(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
ogs_debug(" P-TMSI[0x%08x]", mme_ue->p_tmsi);
|
||||
}
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_accept(mme_ue));
|
||||
r = nas_eps_send_attach_accept(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
return;
|
||||
|
||||
error:
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
mme_send_delete_session_or_mme_ue_context_release(mme_ue);
|
||||
}
|
||||
|
||||
void sgsap_handle_location_update_reject(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
||||
{
|
||||
int r;
|
||||
ogs_tlv_t *root = NULL, *iter = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
|
@ -203,9 +207,10 @@ void sgsap_handle_location_update_reject(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
ogs_plmn_id_hexdump(&lai->nas_plmn_id), lai->lac);
|
||||
}
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_attach_reject(mme_ue,
|
||||
emm_cause, OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
|
||||
r = nas_eps_send_attach_reject(mme_ue,
|
||||
emm_cause, OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
mme_send_delete_session_or_mme_ue_context_release(mme_ue);
|
||||
|
||||
return;
|
||||
|
@ -277,6 +282,7 @@ void sgsap_handle_detach_ack(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
|
||||
void sgsap_handle_paging_request(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
||||
{
|
||||
int r;
|
||||
ogs_tlv_t *root = NULL, *iter = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
|
@ -354,22 +360,25 @@ void sgsap_handle_paging_request(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
/* UE will respond Extended Service Request in PS CNDomain*/
|
||||
MME_STORE_PAGING_INFO(mme_ue,
|
||||
MME_PAGING_TYPE_CS_CALL_SERVICE, NULL);
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_paging(mme_ue, S1AP_CNDomain_cs));
|
||||
r = s1ap_send_paging(mme_ue, S1AP_CNDomain_cs);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
} else if (SMS_SERVICE_INDICATOR(mme_ue)) {
|
||||
/* UE will respond Service Request in PS CNDomain*/
|
||||
MME_STORE_PAGING_INFO(mme_ue,
|
||||
MME_PAGING_TYPE_SMS_SERVICE, NULL);
|
||||
ogs_assert(OGS_OK ==
|
||||
s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
|
||||
r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else
|
||||
goto paging_reject;
|
||||
|
||||
} else {
|
||||
if (CS_CALL_SERVICE_INDICATOR(mme_ue)) {
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_cs_service_notification(mme_ue));
|
||||
r = nas_eps_send_cs_service_notification(mme_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else if (SMS_SERVICE_INDICATOR(mme_ue)) {
|
||||
ogs_assert(OGS_OK ==
|
||||
sgsap_send_service_request(
|
||||
|
@ -395,6 +404,7 @@ paging_reject:
|
|||
|
||||
void sgsap_handle_downlink_unitdata(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
||||
{
|
||||
int r;
|
||||
ogs_tlv_t *root = NULL, *iter = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
|
@ -455,9 +465,10 @@ void sgsap_handle_downlink_unitdata(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
|||
nas_message_container_buffer,
|
||||
nas_message_container_length);
|
||||
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_eps_send_downlink_nas_transport(mme_ue,
|
||||
nas_message_container_buffer, nas_message_container_length));
|
||||
r = nas_eps_send_downlink_nas_transport(mme_ue,
|
||||
nas_message_container_buffer, nas_message_container_length);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
}
|
||||
|
||||
void sgsap_handle_reset_indication(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
|
||||
|
|
|
@ -120,7 +120,10 @@ int sgsap_send_location_update_request(mme_ue_t *mme_ue)
|
|||
ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd);
|
||||
|
||||
pkbuf = sgsap_build_location_update_request(mme_ue);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("sgsap_build_location_update_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
rv = sgsap_send_to_vlr(mme_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
|
@ -137,7 +140,10 @@ int sgsap_send_tmsi_reallocation_complete(mme_ue_t *mme_ue)
|
|||
ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd);
|
||||
|
||||
pkbuf = sgsap_build_tmsi_reallocation_complete(mme_ue);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("sgsap_build_tmsi_reallocation_complete() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
rv = sgsap_send_to_vlr(mme_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
|
@ -151,7 +157,10 @@ int sgsap_send_detach_indication(mme_ue_t *mme_ue)
|
|||
ogs_assert(mme_ue);
|
||||
|
||||
pkbuf = sgsap_build_detach_indication(mme_ue);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("sgsap_build_detach_indication() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
rv = sgsap_send_to_vlr(mme_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
|
@ -168,7 +177,10 @@ int sgsap_send_mo_csfb_indication(mme_ue_t *mme_ue)
|
|||
ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd);
|
||||
|
||||
pkbuf = sgsap_build_mo_csfb_indication(mme_ue);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("sgsap_build_mo_csfb_indication() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
rv = sgsap_send_to_vlr(mme_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
|
@ -187,7 +199,10 @@ int sgsap_send_paging_reject(mme_ue_t *mme_ue, uint8_t sgs_cause)
|
|||
pkbuf = sgsap_build_paging_reject(
|
||||
&mme_ue->nas_mobile_identity_imsi,
|
||||
SGSAP_IE_IMSI_LEN, sgs_cause);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("sgsap_build_paging_reject() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
rv = sgsap_send_to_vlr(mme_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
|
@ -206,7 +221,10 @@ int sgsap_send_service_request(mme_ue_t *mme_ue, uint8_t emm_mode)
|
|||
ogs_debug(" EMM_MODE[%d]", emm_mode);
|
||||
|
||||
pkbuf = sgsap_build_service_request(mme_ue, emm_mode);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("sgsap_build_service_request() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
rv = sgsap_send_to_vlr(mme_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
|
@ -222,7 +240,10 @@ int sgsap_send_reset_ack(mme_vlr_t *vlr)
|
|||
ogs_debug("[SGSAP] RESET-ACK");
|
||||
|
||||
pkbuf = sgsap_build_reset_ack(vlr);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("sgsap_build_reset_ack() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
rv = sgsap_send_to_vlr_with_sid(vlr, pkbuf, 0);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
|
@ -243,7 +264,10 @@ int sgsap_send_uplink_unitdata(mme_ue_t *mme_ue,
|
|||
nas_message_container->buffer, nas_message_container->length);
|
||||
|
||||
pkbuf = sgsap_build_uplink_unidata(mme_ue, nas_message_container);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("sgsap_build_uplink_unidata() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
rv = sgsap_send_to_vlr(mme_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
|
@ -261,7 +285,10 @@ int sgsap_send_ue_unreachable(mme_ue_t *mme_ue, uint8_t sgs_cause)
|
|||
ogs_debug(" CAUSE[%d]", sgs_cause);
|
||||
|
||||
pkbuf = sgsap_build_ue_unreachable(mme_ue, sgs_cause);
|
||||
ogs_expect_or_return_val(pkbuf, OGS_ERROR);
|
||||
if (!pkbuf) {
|
||||
ogs_error("sgsap_build_ue_unreachable() failed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
rv = sgsap_send_to_vlr(mme_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
|
|
|
@ -84,11 +84,17 @@ bool nrf_nnrf_nfm_send_nf_status_notify(
|
|||
|
||||
ogs_assert(subscription_data);
|
||||
client = subscription_data->client;
|
||||
ogs_expect_or_return_val(client, false);
|
||||
if (!client) {
|
||||
ogs_error("No Client");
|
||||
return false;
|
||||
}
|
||||
|
||||
request = nrf_nnrf_nfm_build_nf_status_notify(
|
||||
subscription_data, event, nf_instance);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
if (!request) {
|
||||
ogs_error("nrf_nnrf_nfm_build_nf_status_notify() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
rc = ogs_sbi_send_request_to_client(
|
||||
client, client_notify_cb, request, NULL);
|
||||
|
@ -103,6 +109,7 @@ bool nrf_nnrf_nfm_send_nf_status_notify_all(
|
|||
OpenAPI_notification_event_type_e event,
|
||||
ogs_sbi_nf_instance_t *nf_instance)
|
||||
{
|
||||
bool rc;
|
||||
ogs_sbi_subscription_data_t *subscription_data = NULL;
|
||||
|
||||
ogs_assert(nf_instance);
|
||||
|
@ -135,10 +142,12 @@ bool nrf_nnrf_nfm_send_nf_status_notify_all(
|
|||
continue;
|
||||
}
|
||||
|
||||
ogs_expect_or_return_val(true ==
|
||||
nrf_nnrf_nfm_send_nf_status_notify(
|
||||
subscription_data, event, nf_instance),
|
||||
false);
|
||||
rc = nrf_nnrf_nfm_send_nf_status_notify(
|
||||
subscription_data, event, nf_instance);
|
||||
if (rc == false) {
|
||||
ogs_error("nrf_nnrf_nfm_send_nf_status_notify() failed");
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -139,7 +139,10 @@ static bool pcf_sbi_discover_and_send(
|
|||
xact = ogs_sbi_xact_add(
|
||||
sbi_object, service_type, discovery_option,
|
||||
build, context, data);
|
||||
ogs_expect_or_return_val(xact, false);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_sbi_xact_add() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
xact->assoc_stream = stream;
|
||||
|
||||
|
@ -182,7 +185,10 @@ bool pcf_sess_sbi_discover_only(
|
|||
ogs_assert(service_type);
|
||||
|
||||
xact = ogs_sbi_xact_add(&sess->sbi, service_type, NULL, NULL, NULL, NULL);
|
||||
ogs_expect_or_return_val(xact, false);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_sbi_xact_add() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
xact->assoc_stream = stream;
|
||||
|
||||
|
@ -265,7 +271,10 @@ bool pcf_sbi_send_am_policy_control_notify(pcf_ue_t *pcf_ue)
|
|||
ogs_assert(client);
|
||||
|
||||
request = pcf_namf_callback_build_am_policy_control(pcf_ue, NULL);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
if (!request) {
|
||||
ogs_error("pcf_namf_callback_build_am_policy_control() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
rc = ogs_sbi_send_request_to_client(
|
||||
client, client_notify_cb, request, NULL);
|
||||
|
@ -289,7 +298,10 @@ bool pcf_sbi_send_smpolicycontrol_update_notify(
|
|||
|
||||
request = pcf_nsmf_callback_build_smpolicycontrol_update(
|
||||
sess, SmPolicyDecision);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
if (!request) {
|
||||
ogs_error("pcf_nsmf_callback_build_smpolicycontrol_update() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
rc = ogs_sbi_send_request_to_client(
|
||||
client, client_notify_cb, request, NULL);
|
||||
|
@ -314,7 +326,10 @@ bool pcf_sbi_send_smpolicycontrol_delete_notify(
|
|||
|
||||
request = pcf_nsmf_callback_build_smpolicycontrol_update(
|
||||
sess, SmPolicyDecision);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
if (!request) {
|
||||
ogs_error("pcf_nsmf_callback_build_smpolicycontrol_update() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
rc = ogs_sbi_send_request_to_client(
|
||||
client, client_delete_notify_cb, request, app_session);
|
||||
|
@ -336,7 +351,10 @@ bool pcf_sbi_send_smpolicycontrol_terminate_notify(pcf_sess_t *sess)
|
|||
ogs_assert(client);
|
||||
|
||||
request = pcf_nsmf_callback_build_smpolicycontrol_terminate(sess, NULL);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
if (!request) {
|
||||
ogs_error("pcf_nsmf_callback_build_smpolicycontrol_terminate() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
rc = ogs_sbi_send_request_to_client(
|
||||
client, client_notify_cb, request, NULL);
|
||||
|
@ -358,7 +376,11 @@ bool pcf_sbi_send_policyauthorization_terminate_notify(pcf_app_t *app)
|
|||
ogs_assert(client);
|
||||
|
||||
request = pcf_naf_callback_build_policyauthorization_terminate(app, NULL);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
if (!request) {
|
||||
ogs_error("pcf_naf_callback_build_policyauthorization_terminate() "
|
||||
"failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
rc = ogs_sbi_send_request_to_client(
|
||||
client, client_notify_cb, request, NULL);
|
||||
|
|
|
@ -392,7 +392,10 @@ bool smf_sbi_send_sm_context_status_notify(smf_sess_t *sess)
|
|||
ogs_assert(client);
|
||||
|
||||
request = smf_namf_callback_build_sm_context_status(sess, NULL);
|
||||
ogs_expect_or_return_val(request, false);
|
||||
if (!request) {
|
||||
ogs_error("smf_namf_callback_build_sm_context_status() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
rc = ogs_sbi_send_request_to_client(
|
||||
client, client_notify_cb, request, NULL);
|
||||
|
|
Loading…
Reference in New Issue