mirror of
https://github.com/open5gs/open5gs.git
synced 2026-04-28 03:19:31 +00:00
[POOL] refactor memory pool in AMF (#3196)
Removed ogs_pool_cycle() from AMF memory pool and changed it to find by hash id.
This commit is contained in:
parent
c1110573d6
commit
253de8ee25
48 changed files with 624 additions and 538 deletions
|
|
@ -28,6 +28,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OGS_INVALID_POOL_ID 0
|
||||
#define OGS_MIN_POOL_ID 1
|
||||
#define OGS_MAX_POOL_ID 0x7fffffff
|
||||
|
||||
|
|
|
|||
|
|
@ -2257,6 +2257,7 @@ void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object)
|
|||
}
|
||||
|
||||
ogs_sbi_xact_t *ogs_sbi_xact_add(
|
||||
ogs_pool_id_t sbi_object_id,
|
||||
ogs_sbi_object_t *sbi_object,
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
|
|
@ -2272,6 +2273,7 @@ ogs_sbi_xact_t *ogs_sbi_xact_add(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
xact->sbi_object_id = sbi_object_id;
|
||||
xact->sbi_object = sbi_object;
|
||||
xact->service_type = service_type;
|
||||
xact->requester_nf_type = NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance);
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@ typedef struct ogs_sbi_xact_s {
|
|||
char *target_apiroot;
|
||||
|
||||
ogs_sbi_object_t *sbi_object;
|
||||
ogs_pool_id_t sbi_object_id;
|
||||
} ogs_sbi_xact_t;
|
||||
|
||||
typedef struct ogs_sbi_nf_service_s {
|
||||
|
|
@ -542,6 +543,7 @@ bool ogs_sbi_discovery_option_target_plmn_list_is_matched(
|
|||
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object);
|
||||
|
||||
ogs_sbi_xact_t *ogs_sbi_xact_add(
|
||||
ogs_pool_id_t sbi_object_id,
|
||||
ogs_sbi_object_t *sbi_object,
|
||||
ogs_sbi_service_type_e service_type,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
|
|
|
|||
110
src/amf/amf-sm.c
110
src/amf/amf-sm.c
|
|
@ -64,11 +64,12 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
amf_sess_t *sess = NULL;
|
||||
|
||||
ogs_sbi_object_t *sbi_object = NULL;
|
||||
ogs_pool_id_t sbi_object_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
ogs_pool_id_t sbi_xact_id = 0;
|
||||
ogs_pool_id_t sbi_xact_id = OGS_INVALID_POOL_ID;
|
||||
int state = AMF_CREATE_SM_CONTEXT_NO_STATE;
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_request_t *sbi_request = NULL;
|
||||
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
|
||||
|
||||
|
|
@ -430,12 +431,13 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
state = sbi_xact->state;
|
||||
|
||||
amf_ue = (amf_ue_t *)sbi_xact->sbi_object;
|
||||
ogs_assert(amf_ue);
|
||||
sbi_object_id = sbi_xact->sbi_object_id;
|
||||
ogs_assert(sbi_object_id >= OGS_MIN_POOL_ID &&
|
||||
sbi_object_id <= OGS_MAX_POOL_ID);
|
||||
|
||||
ogs_sbi_xact_remove(sbi_xact);
|
||||
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sbi_object_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf_ue) Context has already been removed");
|
||||
break;
|
||||
|
|
@ -443,7 +445,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
ogs_assert(OGS_FSM_STATE(&amf_ue->sm));
|
||||
|
||||
e->amf_ue = amf_ue;
|
||||
e->amf_ue_id = amf_ue->id;
|
||||
e->h.sbi.message = &sbi_message;;
|
||||
e->h.sbi.state = state;
|
||||
|
||||
|
|
@ -466,12 +468,13 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
state = sbi_xact->state;
|
||||
|
||||
sess = (amf_sess_t *)sbi_xact->sbi_object;
|
||||
ogs_assert(sess);
|
||||
sbi_object_id = sbi_xact->sbi_object_id;
|
||||
ogs_assert(sbi_object_id >= OGS_MIN_POOL_ID &&
|
||||
sbi_object_id <= OGS_MAX_POOL_ID);
|
||||
|
||||
ogs_sbi_xact_remove(sbi_xact);
|
||||
|
||||
sess = amf_sess_cycle(sess);
|
||||
sess = amf_sess_find_by_id(sbi_object_id);
|
||||
if (!sess) {
|
||||
/*
|
||||
* 1. If AMF-UE context is duplicated in Identity-Response,
|
||||
|
|
@ -509,15 +512,16 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
break;
|
||||
}
|
||||
|
||||
amf_ue = sess->amf_ue;
|
||||
ogs_assert(amf_ue);
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
ogs_assert(amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
break;
|
||||
}
|
||||
|
||||
ogs_assert(OGS_FSM_STATE(&amf_ue->sm));
|
||||
|
||||
e->amf_ue = amf_ue;
|
||||
e->sess = sess;
|
||||
e->amf_ue_id = amf_ue->id;
|
||||
e->sess_id = sess->id;
|
||||
e->h.sbi.message = &sbi_message;;
|
||||
|
||||
SWITCH(sbi_message.h.resource.component[2])
|
||||
|
|
@ -582,28 +586,30 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
break;
|
||||
}
|
||||
|
||||
sess = (amf_sess_t *)sbi_xact->sbi_object;
|
||||
ogs_assert(sess);
|
||||
sbi_object_id = sbi_xact->sbi_object_id;
|
||||
ogs_assert(sbi_object_id >= OGS_MIN_POOL_ID &&
|
||||
sbi_object_id <= OGS_MAX_POOL_ID);
|
||||
|
||||
state = sbi_xact->state;
|
||||
|
||||
ogs_sbi_xact_remove(sbi_xact);
|
||||
|
||||
sess = amf_sess_cycle(sess);
|
||||
sess = amf_sess_find_by_id(sbi_object_id);
|
||||
if (!sess) {
|
||||
ogs_error("Session has already been removed");
|
||||
break;
|
||||
}
|
||||
|
||||
amf_ue = sess->amf_ue;
|
||||
ogs_assert(amf_ue);
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
ogs_assert(amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
break;
|
||||
}
|
||||
|
||||
ogs_assert(OGS_FSM_STATE(&amf_ue->sm));
|
||||
|
||||
e->amf_ue = amf_ue;
|
||||
e->sess = sess;
|
||||
e->amf_ue_id = amf_ue->id;
|
||||
e->sess_id = sess->id;
|
||||
e->h.sbi.message = &sbi_message;;
|
||||
e->h.sbi.state = state;
|
||||
|
||||
|
|
@ -709,6 +715,10 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
sbi_object = sbi_xact->sbi_object;
|
||||
ogs_assert(sbi_object);
|
||||
|
||||
sbi_object_id = sbi_xact->sbi_object_id;
|
||||
ogs_assert(sbi_object_id >= OGS_MIN_POOL_ID &&
|
||||
sbi_object_id <= OGS_MAX_POOL_ID);
|
||||
|
||||
service_type = sbi_xact->service_type;
|
||||
|
||||
ogs_sbi_xact_remove(sbi_xact);
|
||||
|
|
@ -718,9 +728,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
switch(sbi_object->type) {
|
||||
case OGS_SBI_OBJ_UE_TYPE:
|
||||
amf_ue = (amf_ue_t *)sbi_object;
|
||||
ogs_assert(amf_ue);
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sbi_object_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf_ue) Context has already been removed");
|
||||
break;
|
||||
|
|
@ -734,15 +742,13 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
break;
|
||||
|
||||
case OGS_SBI_OBJ_SESS_TYPE:
|
||||
sess = (amf_sess_t *)sbi_object;
|
||||
ogs_assert(sess);
|
||||
sess = amf_sess_cycle(sess);
|
||||
sess = amf_sess_find_by_id(sbi_object_id);
|
||||
if (!sess) {
|
||||
ogs_error("Session has already been removed");
|
||||
break;
|
||||
}
|
||||
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf_ue) Context has already been removed");
|
||||
break;
|
||||
|
|
@ -751,13 +757,15 @@ 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) {
|
||||
r = nas_5gs_send_back_gsm_message(sess->ran_ue, sess,
|
||||
r = nas_5gs_send_back_gsm_message(
|
||||
ran_ue_find_by_id(sess->ran_ue_id), sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
r = ngap_send_error_indication2(sess->ran_ue,
|
||||
r = ngap_send_error_indication2(
|
||||
ran_ue_find_by_id(sess->ran_ue_id),
|
||||
NGAP_Cause_PR_transport,
|
||||
NGAP_CauseTransport_transport_resource_unavailable);
|
||||
ogs_expect(r == OGS_OK);
|
||||
|
|
@ -791,7 +799,11 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
gnb = amf_gnb_find_by_addr(addr);
|
||||
if (!gnb) {
|
||||
gnb = amf_gnb_add(sock, addr);
|
||||
ogs_assert(gnb);
|
||||
if (!gnb) {
|
||||
ogs_error("amf_gnb_add() failed");
|
||||
ogs_sock_destroy(sock);
|
||||
ogs_free(addr);
|
||||
}
|
||||
} else {
|
||||
ogs_warn("gNB context duplicated with IP-address [%s]!!!",
|
||||
OGS_ADDR(addr, buf));
|
||||
|
|
@ -813,7 +825,10 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
gnb = amf_gnb_find_by_addr(addr);
|
||||
if (!gnb) {
|
||||
gnb = amf_gnb_add(sock, addr);
|
||||
ogs_assert(gnb);
|
||||
if (!gnb) {
|
||||
ogs_error("amf_gnb_add() failed");
|
||||
ogs_free(addr);
|
||||
}
|
||||
} else {
|
||||
ogs_free(addr);
|
||||
}
|
||||
|
|
@ -864,7 +879,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
rc = ogs_ngap_decode(&ngap_message, pkbuf);
|
||||
if (rc == OGS_OK) {
|
||||
e->gnb = gnb;
|
||||
e->gnb_id = gnb->id;
|
||||
e->ngap.message = &ngap_message;
|
||||
ogs_fsm_dispatch(&gnb->sm, e);
|
||||
} else {
|
||||
|
|
@ -881,13 +896,14 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
break;
|
||||
|
||||
case AMF_EVENT_NGAP_TIMER:
|
||||
ran_ue = e->ran_ue;
|
||||
ogs_assert(ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(e->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG Context has already been removed");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (e->h.timer_id) {
|
||||
case AMF_TIMER_NG_DELAYED_SEND:
|
||||
gnb = e->gnb;
|
||||
ogs_assert(gnb);
|
||||
pkbuf = e->pkbuf;
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
|
|
@ -911,18 +927,22 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
break;
|
||||
|
||||
case AMF_EVENT_5GMM_MESSAGE:
|
||||
ran_ue = e->ran_ue;
|
||||
ogs_assert(ran_ue);
|
||||
pkbuf = e->pkbuf;
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
ran_ue = ran_ue_find_by_id(e->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG Context has already been removed");
|
||||
break;
|
||||
}
|
||||
|
||||
if (ogs_nas_5gmm_decode(&nas_message, pkbuf) != OGS_OK) {
|
||||
ogs_error("ogs_nas_5gmm_decode() failed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
break;
|
||||
}
|
||||
|
||||
amf_ue = ran_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
amf_ue = amf_ue_find_by_message(&nas_message);
|
||||
if (!amf_ue) {
|
||||
|
|
@ -1017,7 +1037,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_assert(amf_ue);
|
||||
ogs_assert(OGS_FSM_STATE(&amf_ue->sm));
|
||||
|
||||
e->amf_ue = amf_ue;
|
||||
e->amf_ue_id = amf_ue->id;
|
||||
e->nas.message = &nas_message;
|
||||
|
||||
ogs_fsm_dispatch(&amf_ue->sm, e);
|
||||
|
|
@ -1026,7 +1046,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
break;
|
||||
|
||||
case AMF_EVENT_5GMM_TIMER:
|
||||
amf_ue = amf_ue_cycle(e->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(e->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf_ue) Context has already been removed");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1201,9 +1201,11 @@ amf_gnb_t *amf_gnb_add(ogs_sock_t *sock, ogs_sockaddr_t *addr)
|
|||
ogs_assert(sock);
|
||||
ogs_assert(addr);
|
||||
|
||||
ogs_pool_alloc(&amf_gnb_pool, &gnb);
|
||||
ogs_assert(gnb);
|
||||
memset(gnb, 0, sizeof *gnb);
|
||||
ogs_pool_id_calloc(&amf_gnb_pool, &gnb);
|
||||
if (!gnb) {
|
||||
ogs_error("ogs_pool_id_callod() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Defaut RAT-Type */
|
||||
gnb->rat_type = OpenAPI_rat_type_NR;
|
||||
|
|
@ -1227,7 +1229,7 @@ amf_gnb_t *amf_gnb_add(ogs_sock_t *sock, ogs_sockaddr_t *addr)
|
|||
gnb->sctp.addr, sizeof(ogs_sockaddr_t), gnb);
|
||||
|
||||
memset(&e, 0, sizeof(e));
|
||||
e.gnb = gnb;
|
||||
e.gnb_id = gnb->id;
|
||||
ogs_fsm_init(&gnb->sm, ngap_state_initial, ngap_state_final, &e);
|
||||
|
||||
ogs_list_add(&self.gnb_list, gnb);
|
||||
|
|
@ -1249,7 +1251,7 @@ void amf_gnb_remove(amf_gnb_t *gnb)
|
|||
ogs_list_remove(&self.gnb_list, gnb);
|
||||
|
||||
memset(&e, 0, sizeof(e));
|
||||
e.gnb = gnb;
|
||||
e.gnb_id = gnb->id;
|
||||
ogs_fsm_fini(&gnb->sm, &e);
|
||||
|
||||
ogs_hash_set(self.gnb_addr_hash,
|
||||
|
|
@ -1258,7 +1260,7 @@ void amf_gnb_remove(amf_gnb_t *gnb)
|
|||
|
||||
ogs_sctp_flush_and_destroy(&gnb->sctp);
|
||||
|
||||
ogs_pool_free(&amf_gnb_pool, gnb);
|
||||
ogs_pool_id_free(&amf_gnb_pool, gnb);
|
||||
amf_metrics_inst_global_dec(AMF_METR_GLOB_GAUGE_GNB);
|
||||
ogs_info("[Removed] Number of gNBs is now %d",
|
||||
ogs_list_count(&self.gnb_list));
|
||||
|
|
@ -1313,9 +1315,9 @@ int amf_gnb_sock_type(ogs_sock_t *sock)
|
|||
return SOCK_STREAM;
|
||||
}
|
||||
|
||||
amf_gnb_t *amf_gnb_cycle(amf_gnb_t *gnb)
|
||||
amf_gnb_t *amf_gnb_find_by_id(ogs_pool_id_t id)
|
||||
{
|
||||
return ogs_pool_cycle(&amf_gnb_pool, gnb);
|
||||
return ogs_pool_find_by_id(&amf_gnb_pool, id);
|
||||
}
|
||||
|
||||
/** ran_ue_context handling function */
|
||||
|
|
@ -1325,19 +1327,18 @@ ran_ue_t *ran_ue_add(amf_gnb_t *gnb, uint64_t ran_ue_ngap_id)
|
|||
|
||||
ogs_assert(gnb);
|
||||
|
||||
ogs_pool_alloc(&ran_ue_pool, &ran_ue);
|
||||
ogs_pool_id_calloc(&ran_ue_pool, &ran_ue);
|
||||
if (ran_ue == NULL) {
|
||||
ogs_error("Could not allocate ran_ue context from pool");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(ran_ue, 0, sizeof *ran_ue);
|
||||
|
||||
ran_ue->t_ng_holding = ogs_timer_add(
|
||||
ogs_app()->timer_mgr, amf_timer_ng_holding_timer_expire, ran_ue);
|
||||
ogs_app()->timer_mgr, amf_timer_ng_holding_timer_expire,
|
||||
OGS_UINT_TO_POINTER(ran_ue->id));
|
||||
if (!ran_ue->t_ng_holding) {
|
||||
ogs_error("ogs_timer_add() failed");
|
||||
ogs_pool_free(&ran_ue_pool, ran_ue);
|
||||
ogs_pool_id_free(&ran_ue_pool, ran_ue);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1357,7 +1358,7 @@ ran_ue_t *ran_ue_add(amf_gnb_t *gnb, uint64_t ran_ue_ngap_id)
|
|||
ran_ue->gnb_ostream_id =
|
||||
OGS_NEXT_ID(gnb->ostream_id, 1, gnb->max_num_of_ostreams-1);
|
||||
|
||||
ran_ue->gnb = gnb;
|
||||
ran_ue->gnb_id = gnb->id;
|
||||
|
||||
ogs_list_add(&gnb->ran_ue_list, ran_ue);
|
||||
|
||||
|
|
@ -1368,33 +1369,40 @@ ran_ue_t *ran_ue_add(amf_gnb_t *gnb, uint64_t ran_ue_ngap_id)
|
|||
|
||||
void ran_ue_remove(ran_ue_t *ran_ue)
|
||||
{
|
||||
amf_gnb_t *gnb = NULL;
|
||||
ogs_assert(ran_ue);
|
||||
ogs_assert(ran_ue->gnb);
|
||||
|
||||
ogs_list_remove(&ran_ue->gnb->ran_ue_list, ran_ue);
|
||||
gnb = amf_gnb_find_by_id(ran_ue->gnb_id);
|
||||
ogs_assert(gnb);
|
||||
|
||||
ogs_list_remove(&gnb->ran_ue_list, ran_ue);
|
||||
|
||||
ogs_assert(ran_ue->t_ng_holding);
|
||||
ogs_timer_delete(ran_ue->t_ng_holding);
|
||||
|
||||
ogs_pool_free(&ran_ue_pool, ran_ue);
|
||||
ogs_pool_id_free(&ran_ue_pool, ran_ue);
|
||||
|
||||
stats_remove_ran_ue();
|
||||
}
|
||||
|
||||
void ran_ue_switch_to_gnb(ran_ue_t *ran_ue, amf_gnb_t *new_gnb)
|
||||
{
|
||||
amf_gnb_t *gnb = NULL;
|
||||
|
||||
ogs_assert(ran_ue);
|
||||
ogs_assert(ran_ue->gnb);
|
||||
ogs_assert(new_gnb);
|
||||
|
||||
gnb = amf_gnb_find_by_id(ran_ue->gnb_id);
|
||||
ogs_assert(gnb);
|
||||
|
||||
/* Remove from the old gnb */
|
||||
ogs_list_remove(&ran_ue->gnb->ran_ue_list, ran_ue);
|
||||
ogs_list_remove(&gnb->ran_ue_list, ran_ue);
|
||||
|
||||
/* Add to the new gnb */
|
||||
ogs_list_add(&new_gnb->ran_ue_list, ran_ue);
|
||||
|
||||
/* Switch to gnb */
|
||||
ran_ue->gnb = new_gnb;
|
||||
ran_ue->gnb_id = new_gnb->id;
|
||||
}
|
||||
|
||||
ran_ue_t *ran_ue_find_by_ran_ue_ngap_id(
|
||||
|
|
@ -1420,9 +1428,9 @@ ran_ue_t *ran_ue_find_by_amf_ue_ngap_id(uint64_t amf_ue_ngap_id)
|
|||
return ran_ue_find(amf_ue_ngap_id);
|
||||
}
|
||||
|
||||
ran_ue_t *ran_ue_cycle(ran_ue_t *ran_ue)
|
||||
ran_ue_t *ran_ue_find_by_id(ogs_pool_id_t id)
|
||||
{
|
||||
return ogs_pool_cycle(&ran_ue_pool, ran_ue);
|
||||
return ogs_pool_find_by_id(&ran_ue_pool, id);
|
||||
}
|
||||
|
||||
void amf_ue_new_guti(amf_ue_t *amf_ue)
|
||||
|
|
@ -1520,39 +1528,44 @@ amf_ue_t *amf_ue_add(ran_ue_t *ran_ue)
|
|||
amf_ue_t *amf_ue = NULL;
|
||||
|
||||
ogs_assert(ran_ue);
|
||||
gnb = ran_ue->gnb;
|
||||
ogs_assert(gnb);
|
||||
|
||||
ogs_pool_alloc(&amf_ue_pool, &amf_ue);
|
||||
gnb = amf_gnb_find_by_id(ran_ue->gnb_id);
|
||||
if (!gnb) {
|
||||
ogs_error("[%d] gNB has already been removed", ran_ue->gnb_id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_pool_id_calloc(&amf_ue_pool, &amf_ue);
|
||||
if (amf_ue == NULL) {
|
||||
ogs_error("Could not allocate amf_ue context from pool");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(amf_ue, 0, sizeof *amf_ue);
|
||||
|
||||
/* Add All Timers */
|
||||
amf_ue->t3513.timer = ogs_timer_add(
|
||||
ogs_app()->timer_mgr, amf_timer_t3513_expire, amf_ue);
|
||||
ogs_app()->timer_mgr, amf_timer_t3513_expire,
|
||||
OGS_UINT_TO_POINTER(amf_ue->id));
|
||||
if (!amf_ue->t3513.timer) {
|
||||
ogs_error("ogs_timer_add() failed");
|
||||
ogs_pool_free(&amf_ue_pool, amf_ue);
|
||||
ogs_pool_id_free(&amf_ue_pool, amf_ue);
|
||||
return NULL;
|
||||
}
|
||||
amf_ue->t3513.pkbuf = NULL;
|
||||
amf_ue->t3522.timer = ogs_timer_add(
|
||||
ogs_app()->timer_mgr, amf_timer_t3522_expire, amf_ue);
|
||||
ogs_app()->timer_mgr, amf_timer_t3522_expire,
|
||||
OGS_UINT_TO_POINTER(amf_ue->id));
|
||||
if (!amf_ue->t3522.timer) {
|
||||
ogs_error("ogs_timer_add() failed");
|
||||
ogs_pool_free(&amf_ue_pool, amf_ue);
|
||||
ogs_pool_id_free(&amf_ue_pool, amf_ue);
|
||||
return NULL;
|
||||
}
|
||||
amf_ue->t3522.pkbuf = NULL;
|
||||
amf_ue->t3550.timer = ogs_timer_add(
|
||||
ogs_app()->timer_mgr, amf_timer_t3550_expire, amf_ue);
|
||||
ogs_app()->timer_mgr, amf_timer_t3550_expire,
|
||||
OGS_UINT_TO_POINTER(amf_ue->id));
|
||||
if (!amf_ue->t3550.timer) {
|
||||
ogs_error("ogs_timer_add() failed");
|
||||
ogs_pool_free(&amf_ue_pool, amf_ue);
|
||||
ogs_pool_id_free(&amf_ue_pool, amf_ue);
|
||||
return NULL;
|
||||
}
|
||||
amf_ue->t3550.pkbuf = NULL;
|
||||
|
|
@ -1560,39 +1573,43 @@ amf_ue_t *amf_ue_add(ran_ue_t *ran_ue)
|
|||
ogs_app()->timer_mgr, amf_timer_t3555_expire, amf_ue);
|
||||
if (!amf_ue->t3555.timer) {
|
||||
ogs_error("ogs_timer_add() failed");
|
||||
ogs_pool_free(&amf_ue_pool, amf_ue);
|
||||
ogs_pool_id_free(&amf_ue_pool, amf_ue);
|
||||
return NULL;
|
||||
}
|
||||
amf_ue->t3555.pkbuf = NULL;
|
||||
amf_ue->t3560.timer = ogs_timer_add(
|
||||
ogs_app()->timer_mgr, amf_timer_t3560_expire, amf_ue);
|
||||
ogs_app()->timer_mgr, amf_timer_t3560_expire,
|
||||
OGS_UINT_TO_POINTER(amf_ue->id));
|
||||
if (!amf_ue->t3560.timer) {
|
||||
ogs_error("ogs_timer_add() failed");
|
||||
ogs_pool_free(&amf_ue_pool, amf_ue);
|
||||
ogs_pool_id_free(&amf_ue_pool, amf_ue);
|
||||
return NULL;
|
||||
}
|
||||
amf_ue->t3560.pkbuf = NULL;
|
||||
amf_ue->t3570.timer = ogs_timer_add(
|
||||
ogs_app()->timer_mgr, amf_timer_t3570_expire, amf_ue);
|
||||
ogs_app()->timer_mgr, amf_timer_t3570_expire,
|
||||
OGS_UINT_TO_POINTER(amf_ue->id));
|
||||
if (!amf_ue->t3570.timer) {
|
||||
ogs_error("ogs_timer_add() failed");
|
||||
ogs_pool_free(&amf_ue_pool, amf_ue);
|
||||
ogs_pool_id_free(&amf_ue_pool, amf_ue);
|
||||
return NULL;
|
||||
}
|
||||
amf_ue->t3570.pkbuf = NULL;
|
||||
amf_ue->mobile_reachable.timer = ogs_timer_add(
|
||||
ogs_app()->timer_mgr, amf_timer_mobile_reachable_expire, amf_ue);
|
||||
ogs_app()->timer_mgr, amf_timer_mobile_reachable_expire,
|
||||
OGS_UINT_TO_POINTER(amf_ue->id));
|
||||
if (!amf_ue->mobile_reachable.timer) {
|
||||
ogs_error("ogs_timer_add() failed");
|
||||
ogs_pool_free(&amf_ue_pool, amf_ue);
|
||||
ogs_pool_id_free(&amf_ue_pool, amf_ue);
|
||||
return NULL;
|
||||
}
|
||||
amf_ue->mobile_reachable.pkbuf = NULL;
|
||||
amf_ue->implicit_deregistration.timer = ogs_timer_add(
|
||||
ogs_app()->timer_mgr, amf_timer_implicit_deregistration_expire, amf_ue);
|
||||
ogs_app()->timer_mgr, amf_timer_implicit_deregistration_expire,
|
||||
OGS_UINT_TO_POINTER(amf_ue->id));
|
||||
if (!amf_ue->implicit_deregistration.timer) {
|
||||
ogs_error("ogs_timer_add() failed");
|
||||
ogs_pool_free(&amf_ue_pool, amf_ue);
|
||||
ogs_pool_id_free(&amf_ue_pool, amf_ue);
|
||||
return NULL;
|
||||
}
|
||||
amf_ue->implicit_deregistration.pkbuf = NULL;
|
||||
|
|
@ -1713,7 +1730,7 @@ void amf_ue_remove(amf_ue_t *amf_ue)
|
|||
|
||||
amf_ue_deassociate(amf_ue);
|
||||
|
||||
ogs_pool_free(&amf_ue_pool, amf_ue);
|
||||
ogs_pool_id_free(&amf_ue_pool, amf_ue);
|
||||
|
||||
ogs_info("[Removed] Number of AMF-UEs is now %d",
|
||||
ogs_list_count(&self.amf_ue_list));
|
||||
|
|
@ -1724,7 +1741,7 @@ void amf_ue_remove_all(void)
|
|||
amf_ue_t *amf_ue = NULL, *next = NULL;;
|
||||
|
||||
ogs_list_for_each_safe(&self.amf_ue_list, next, amf_ue) {
|
||||
ran_ue_t *ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue_t *ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
|
||||
if (ran_ue) ran_ue_remove(ran_ue);
|
||||
|
||||
|
|
@ -1739,7 +1756,7 @@ void amf_ue_fsm_init(amf_ue_t *amf_ue)
|
|||
ogs_assert(amf_ue);
|
||||
|
||||
memset(&e, 0, sizeof(e));
|
||||
e.amf_ue = amf_ue;
|
||||
e.amf_ue_id = amf_ue->id;
|
||||
ogs_fsm_init(&amf_ue->sm, gmm_state_initial, gmm_state_final, &e);
|
||||
}
|
||||
|
||||
|
|
@ -1750,7 +1767,7 @@ void amf_ue_fsm_fini(amf_ue_t *amf_ue)
|
|||
ogs_assert(amf_ue);
|
||||
|
||||
memset(&e, 0, sizeof(e));
|
||||
e.amf_ue = amf_ue;
|
||||
e.amf_ue_id = amf_ue->id;
|
||||
ogs_fsm_fini(&amf_ue->sm, &e);
|
||||
}
|
||||
|
||||
|
|
@ -2075,13 +2092,20 @@ void amf_ue_set_suci(amf_ue_t *amf_ue,
|
|||
ogs_pool_index(&amf_ue_pool, old_amf_ue)) {
|
||||
ogs_warn("[%s] OLD UE Context Release", suci);
|
||||
if (CM_CONNECTED(old_amf_ue)) {
|
||||
ran_ue_t *ran_ue = ran_ue_find_by_id(old_amf_ue->ran_ue_id);
|
||||
/* Implcit NG release */
|
||||
ogs_warn("[%s] Implicit NG release", suci);
|
||||
ogs_warn("[%s] RAN_UE_NGAP_ID[%lld] AMF_UE_NGAP_ID[%lld]",
|
||||
old_amf_ue->suci,
|
||||
(long long)old_amf_ue->ran_ue->ran_ue_ngap_id,
|
||||
(long long)old_amf_ue->ran_ue->amf_ue_ngap_id);
|
||||
ran_ue_remove(old_amf_ue->ran_ue);
|
||||
if (ran_ue) {
|
||||
ogs_warn("[%s] RAN_UE_NGAP_ID[%lld] "
|
||||
"AMF_UE_NGAP_ID[%lld]",
|
||||
old_amf_ue->suci,
|
||||
(long long)ran_ue->ran_ue_ngap_id,
|
||||
(long long)ran_ue->amf_ue_ngap_id);
|
||||
ran_ue_remove(ran_ue);
|
||||
} else {
|
||||
ogs_error("[%s] RAN-NG Context has already been removed",
|
||||
suci);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -2099,7 +2123,7 @@ void amf_ue_set_suci(amf_ue_t *amf_ue,
|
|||
|
||||
/* Phase-1 : Change AMF-UE Context in Session Context */
|
||||
ogs_list_for_each(&old_amf_ue->sess_list, old_sess)
|
||||
old_sess->amf_ue = amf_ue;
|
||||
old_sess->amf_ue_id = amf_ue->id;
|
||||
|
||||
/* Phase-2 : Move Session Context from OLD to NEW AMF-UE Context */
|
||||
memcpy(&amf_ue->sess_list,
|
||||
|
|
@ -2138,10 +2162,17 @@ OpenAPI_rat_type_e amf_ue_rat_type(amf_ue_t *amf_ue)
|
|||
amf_gnb_t *gnb = NULL;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
|
||||
ran_ue = amf_ue->ran_ue;
|
||||
ogs_assert(ran_ue);
|
||||
gnb = ran_ue->gnb;
|
||||
ogs_assert(gnb);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] RAN-NG Context has already been removed", amf_ue->suci);
|
||||
return OpenAPI_rat_type_NULL;
|
||||
}
|
||||
|
||||
gnb = amf_gnb_find_by_id(ran_ue->gnb_id);
|
||||
if (!gnb) {
|
||||
ogs_error("[%d] gNB has already been removed", ran_ue->gnb_id);
|
||||
return OpenAPI_rat_type_NULL;
|
||||
}
|
||||
|
||||
return gnb->rat_type;
|
||||
}
|
||||
|
|
@ -2151,35 +2182,31 @@ void amf_ue_associate_ran_ue(amf_ue_t *amf_ue, ran_ue_t *ran_ue)
|
|||
ogs_assert(amf_ue);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
amf_ue->ran_ue = ran_ue;
|
||||
ran_ue->amf_ue = amf_ue;
|
||||
amf_ue->ran_ue_id = ran_ue->id;
|
||||
ran_ue->amf_ue_id = amf_ue->id;
|
||||
}
|
||||
|
||||
void ran_ue_deassociate(ran_ue_t *ran_ue)
|
||||
{
|
||||
ogs_assert(ran_ue);
|
||||
ran_ue->amf_ue = NULL;
|
||||
ran_ue->amf_ue_id = OGS_INVALID_POOL_ID;
|
||||
}
|
||||
|
||||
void amf_ue_deassociate(amf_ue_t *amf_ue)
|
||||
{
|
||||
ogs_assert(amf_ue);
|
||||
amf_ue->ran_ue = NULL;
|
||||
amf_ue->ran_ue_id = OGS_INVALID_POOL_ID;
|
||||
}
|
||||
|
||||
void source_ue_associate_target_ue(
|
||||
ran_ue_t *source_ue, ran_ue_t *target_ue)
|
||||
{
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
|
||||
ogs_assert(source_ue);
|
||||
ogs_assert(target_ue);
|
||||
amf_ue = source_ue->amf_ue;
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
target_ue->amf_ue = amf_ue;
|
||||
target_ue->source_ue = source_ue;
|
||||
source_ue->target_ue = target_ue;
|
||||
target_ue->amf_ue_id = source_ue->amf_ue_id;
|
||||
target_ue->source_ue_id = source_ue->id;
|
||||
source_ue->target_ue_id = target_ue->id;
|
||||
}
|
||||
|
||||
void source_ue_deassociate_target_ue(ran_ue_t *ran_ue)
|
||||
|
|
@ -2188,22 +2215,28 @@ void source_ue_deassociate_target_ue(ran_ue_t *ran_ue)
|
|||
ran_ue_t *target_ue = NULL;
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
if (ran_ue->target_ue) {
|
||||
if (ran_ue->target_ue_id >= OGS_MIN_POOL_ID &&
|
||||
ran_ue->target_ue_id <= OGS_MAX_POOL_ID) {
|
||||
source_ue = ran_ue;
|
||||
target_ue = ran_ue->target_ue;
|
||||
target_ue = ran_ue_find_by_id(ran_ue->target_ue_id);
|
||||
|
||||
ogs_assert(source_ue->target_ue);
|
||||
ogs_assert(target_ue->source_ue);
|
||||
source_ue->target_ue = NULL;
|
||||
target_ue->source_ue = NULL;
|
||||
} else if (ran_ue->source_ue) {
|
||||
ogs_assert(source_ue->target_ue_id >= OGS_MIN_POOL_ID &&
|
||||
source_ue->target_ue_id <= OGS_MAX_POOL_ID);
|
||||
ogs_assert(target_ue->source_ue_id >= OGS_MIN_POOL_ID &&
|
||||
target_ue->source_ue_id <= OGS_MAX_POOL_ID);
|
||||
source_ue->target_ue_id = OGS_INVALID_POOL_ID;
|
||||
target_ue->source_ue_id = OGS_INVALID_POOL_ID;
|
||||
} else if (ran_ue->source_ue_id >= OGS_MIN_POOL_ID &&
|
||||
ran_ue->source_ue_id <= OGS_MAX_POOL_ID) {
|
||||
target_ue = ran_ue;
|
||||
source_ue = ran_ue->source_ue;
|
||||
source_ue = ran_ue_find_by_id(ran_ue->source_ue_id);
|
||||
|
||||
ogs_assert(source_ue->target_ue);
|
||||
ogs_assert(target_ue->source_ue);
|
||||
source_ue->target_ue = NULL;
|
||||
target_ue->source_ue = NULL;
|
||||
ogs_assert(source_ue->target_ue_id >= OGS_MIN_POOL_ID &&
|
||||
source_ue->target_ue_id <= OGS_MAX_POOL_ID);
|
||||
ogs_assert(target_ue->source_ue_id >= OGS_MIN_POOL_ID &&
|
||||
target_ue->source_ue_id <= OGS_MAX_POOL_ID);
|
||||
source_ue->target_ue_id = OGS_INVALID_POOL_ID;
|
||||
target_ue->source_ue_id = OGS_INVALID_POOL_ID;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2214,13 +2247,12 @@ amf_sess_t *amf_sess_add(amf_ue_t *amf_ue, uint8_t psi)
|
|||
ogs_assert(amf_ue);
|
||||
ogs_assert(psi != OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED);
|
||||
|
||||
ogs_pool_alloc(&amf_sess_pool, &sess);
|
||||
ogs_pool_id_calloc(&amf_sess_pool, &sess);
|
||||
ogs_assert(sess);
|
||||
memset(sess, 0, sizeof *sess);
|
||||
|
||||
sess->sbi.type = OGS_SBI_OBJ_SESS_TYPE;
|
||||
|
||||
sess->amf_ue = amf_ue;
|
||||
sess->amf_ue_id = amf_ue->id;
|
||||
sess->psi = psi;
|
||||
|
||||
sess->s_nssai.sst = 0;
|
||||
|
|
@ -2237,10 +2269,15 @@ amf_sess_t *amf_sess_add(amf_ue_t *amf_ue, uint8_t psi)
|
|||
|
||||
void amf_sess_remove(amf_sess_t *sess)
|
||||
{
|
||||
ogs_assert(sess);
|
||||
ogs_assert(sess->amf_ue);
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
|
||||
ogs_list_remove(&sess->amf_ue->sess_list, sess);
|
||||
ogs_assert(sess);
|
||||
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (amf_ue)
|
||||
ogs_list_remove(&amf_ue->sess_list, sess);
|
||||
else
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
|
||||
/* Free SBI object memory */
|
||||
if (ogs_list_count(&sess->sbi.xact_list))
|
||||
|
|
@ -2277,7 +2314,7 @@ void amf_sess_remove(amf_sess_t *sess)
|
|||
if (sess->nssf.nrf.client)
|
||||
ogs_sbi_client_remove(sess->nssf.nrf.client);
|
||||
|
||||
ogs_pool_free(&amf_sess_pool, sess);
|
||||
ogs_pool_id_free(&amf_sess_pool, sess);
|
||||
|
||||
stats_remove_amf_session();
|
||||
}
|
||||
|
|
@ -2302,14 +2339,14 @@ amf_sess_t *amf_sess_find_by_psi(amf_ue_t *amf_ue, uint8_t psi)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
amf_ue_t *amf_ue_cycle(amf_ue_t *amf_ue)
|
||||
amf_ue_t *amf_ue_find_by_id(ogs_pool_id_t id)
|
||||
{
|
||||
return ogs_pool_cycle(&amf_ue_pool, amf_ue);
|
||||
return ogs_pool_find_by_id(&amf_ue_pool, id);
|
||||
}
|
||||
|
||||
amf_sess_t *amf_sess_cycle(amf_sess_t *sess)
|
||||
amf_sess_t *amf_sess_find_by_id(ogs_pool_id_t id)
|
||||
{
|
||||
return ogs_pool_cycle(&amf_sess_pool, sess);
|
||||
return ogs_pool_find_by_id(&amf_sess_pool, id);
|
||||
}
|
||||
|
||||
void amf_sbi_select_nf(
|
||||
|
|
@ -2748,15 +2785,16 @@ bool amf_update_allowed_nssai(amf_ue_t *amf_ue)
|
|||
ran_ue_t *ran_ue = NULL;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] RAN-NG Context has already been removed",
|
||||
amf_ue->supi);
|
||||
return false;
|
||||
}
|
||||
gnb = amf_gnb_cycle(ran_ue->gnb);
|
||||
|
||||
gnb = amf_gnb_find_by_id(ran_ue->gnb_id);
|
||||
if (!gnb) {
|
||||
ogs_error("gNB has already been removed");
|
||||
ogs_error("[%d] gNB has already been removed", ran_ue->gnb_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -127,6 +127,8 @@ typedef struct amf_context_s {
|
|||
typedef struct amf_gnb_s {
|
||||
ogs_lnode_t lnode;
|
||||
|
||||
ogs_pool_id_t id;
|
||||
|
||||
ogs_fsm_t sm; /* A state machine */
|
||||
|
||||
uint32_t gnb_id; /* gNB_ID received from gNB */
|
||||
|
|
@ -162,6 +164,7 @@ typedef struct amf_gnb_s {
|
|||
struct ran_ue_s {
|
||||
ogs_lnode_t lnode;
|
||||
uint32_t index;
|
||||
ogs_pool_id_t id;
|
||||
|
||||
/* UE identity */
|
||||
#define INVALID_UE_NGAP_ID 0xffffffffffffffffULL /* Initial value of ran_ue_ngap_id */
|
||||
|
|
@ -176,13 +179,14 @@ struct ran_ue_s {
|
|||
|
||||
#define CONTEXT_SETUP_ESTABLISHED(__aMF) \
|
||||
CM_CONNECTED(__aMF) && \
|
||||
((__aMF)->ran_ue->initial_context_setup_response_received == true)
|
||||
(ran_ue_find_by_id((__aMF)->ran_ue_id)-> \
|
||||
initial_context_setup_response_received == true)
|
||||
bool initial_context_setup_response_received;
|
||||
bool ue_ambr_sent;
|
||||
|
||||
/* Handover Info */
|
||||
ran_ue_t *source_ue;
|
||||
ran_ue_t *target_ue;
|
||||
ogs_pool_id_t source_ue_id;
|
||||
ogs_pool_id_t target_ue_id;
|
||||
|
||||
/* Use amf_ue->nr_tai, amf_ue->nr_cgi.
|
||||
* Do not access ran_ue->saved.tai ran_ue->saved.nr_cgi.
|
||||
|
|
@ -214,12 +218,14 @@ struct ran_ue_s {
|
|||
} psimask;
|
||||
|
||||
/* Related Context */
|
||||
amf_gnb_t *gnb;
|
||||
amf_ue_t *amf_ue;
|
||||
ogs_pool_id_t gnb_id;
|
||||
ogs_pool_id_t amf_ue_id;
|
||||
};
|
||||
|
||||
struct amf_ue_s {
|
||||
ogs_sbi_object_t sbi;
|
||||
ogs_pool_id_t id;
|
||||
|
||||
ogs_fsm_t sm;
|
||||
|
||||
struct {
|
||||
|
|
@ -417,53 +423,67 @@ struct amf_ue_s {
|
|||
uint64_t am_policy_control_features; /* SBI Features */
|
||||
|
||||
#define CM_CONNECTED(__aMF) \
|
||||
((__aMF) && ((__aMF)->ran_ue != NULL) && ran_ue_cycle((__aMF)->ran_ue))
|
||||
((__aMF) && \
|
||||
((__aMF)->ran_ue_id >= OGS_MIN_POOL_ID) && \
|
||||
((__aMF)->ran_ue_id <= OGS_MAX_POOL_ID) && \
|
||||
(ran_ue_find_by_id((__aMF)->ran_ue_id)))
|
||||
#define CM_IDLE(__aMF) \
|
||||
((__aMF) && \
|
||||
(((__aMF)->ran_ue == NULL) || (ran_ue_cycle((__aMF)->ran_ue) == NULL)))
|
||||
(((__aMF)->ran_ue_id < OGS_MIN_POOL_ID) || \
|
||||
((__aMF)->ran_ue_id > OGS_MAX_POOL_ID) || \
|
||||
(ran_ue_find_by_id((__aMF)->ran_ue_id) == NULL)))
|
||||
/* NG UE context */
|
||||
ran_ue_t *ran_ue;
|
||||
ogs_pool_id_t ran_ue_id;
|
||||
|
||||
#define HOLDING_NG_CONTEXT(__aMF) \
|
||||
do { \
|
||||
ran_ue_deassociate((__aMF)->ran_ue); \
|
||||
ran_ue_t *ran_ue_holding = NULL; \
|
||||
\
|
||||
(__aMF)->ran_ue_holding = ran_ue_cycle((__aMF)->ran_ue); \
|
||||
if ((__aMF)->ran_ue_holding) { \
|
||||
(__aMF)->ran_ue_holding_id = OGS_INVALID_POOL_ID; \
|
||||
\
|
||||
ran_ue_holding = ran_ue_find_by_id((__aMF)->ran_ue_id); \
|
||||
if (ran_ue_holding) { \
|
||||
ran_ue_deassociate(ran_ue_holding); \
|
||||
\
|
||||
ogs_warn("[%s] Holding NG Context", (__aMF)->suci); \
|
||||
ogs_warn("[%s] RAN_UE_NGAP_ID[%lld] AMF_UE_NGAP_ID[%lld]", \
|
||||
(__aMF)->suci, \
|
||||
(long long)(__aMF)->ran_ue_holding->ran_ue_ngap_id, \
|
||||
(long long)(__aMF)->ran_ue_holding->amf_ue_ngap_id); \
|
||||
(long long)ran_ue_holding->ran_ue_ngap_id, \
|
||||
(long long)ran_ue_holding->amf_ue_ngap_id); \
|
||||
\
|
||||
(__aMF)->ran_ue_holding->ue_ctx_rel_action = \
|
||||
ran_ue_holding->ue_ctx_rel_action = \
|
||||
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE; \
|
||||
ogs_timer_start((__aMF)->ran_ue_holding->t_ng_holding, \
|
||||
ogs_timer_start(ran_ue_holding->t_ng_holding, \
|
||||
amf_timer_cfg(AMF_TIMER_NG_HOLDING)->duration); \
|
||||
\
|
||||
(__aMF)->ran_ue_holding_id = (__aMF)->ran_ue_id; \
|
||||
} else \
|
||||
ogs_error("[%s] NG Context has already been removed", \
|
||||
(__aMF)->suci); \
|
||||
} while(0)
|
||||
#define CLEAR_NG_CONTEXT(__aMF) \
|
||||
do { \
|
||||
if (ran_ue_cycle((__aMF)->ran_ue_holding)) { \
|
||||
ran_ue_t *ran_ue_holding = NULL; \
|
||||
\
|
||||
ran_ue_holding = ran_ue_find_by_id((__aMF)->ran_ue_holding_id); \
|
||||
if (ran_ue_holding) { \
|
||||
int r; \
|
||||
ogs_warn("[%s] Clear NG Context", (__aMF)->suci); \
|
||||
ogs_warn("[%s] RAN_UE_NGAP_ID[%lld] AMF_UE_NGAP_ID[%lld]", \
|
||||
(__aMF)->suci, \
|
||||
(long long)(__aMF)->ran_ue_holding->ran_ue_ngap_id, \
|
||||
(long long)(__aMF)->ran_ue_holding->amf_ue_ngap_id); \
|
||||
(long long)ran_ue_holding->ran_ue_ngap_id, \
|
||||
(long long)ran_ue_holding->amf_ue_ngap_id); \
|
||||
\
|
||||
r = ngap_send_ran_ue_context_release_command( \
|
||||
(__aMF)->ran_ue_holding, \
|
||||
ran_ue_holding, \
|
||||
NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release, \
|
||||
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0); \
|
||||
ogs_expect(r == OGS_OK); \
|
||||
ogs_assert(r != OGS_ERROR); \
|
||||
} \
|
||||
(__aMF)->ran_ue_holding = NULL; \
|
||||
(__aMF)->ran_ue_holding_id = OGS_INVALID_POOL_ID; \
|
||||
} while(0)
|
||||
ran_ue_t *ran_ue_holding;
|
||||
ogs_pool_id_t ran_ue_holding_id;
|
||||
|
||||
#define CLEAR_AMF_UE_ALL_TIMERS(__aMF) \
|
||||
do { \
|
||||
|
|
@ -562,6 +582,7 @@ struct amf_ue_s {
|
|||
|
||||
typedef struct amf_sess_s {
|
||||
ogs_sbi_object_t sbi;
|
||||
ogs_pool_id_t id;
|
||||
|
||||
uint8_t psi; /* PDU Session Identity */
|
||||
uint8_t pti; /* Procedure Trasaction Identity */
|
||||
|
|
@ -656,10 +677,12 @@ typedef struct amf_sess_s {
|
|||
#define AMF_SESS_STORE_N2_TRANSFER(__sESS, __n2Type, __n2Buf) \
|
||||
do { \
|
||||
ogs_assert(__sESS); \
|
||||
ogs_assert((__sESS)->amf_ue); \
|
||||
if ((__sESS)->transfer.__n2Type) { \
|
||||
ogs_warn("[%s:%d] N2 transfer message duplicated. Overwritten", \
|
||||
((__sESS)->amf_ue)->supi, (__sESS)->psi); \
|
||||
amf_ue_t *amf_ue = amf_ue_find_by_id((__sESS)->amf_ue_id); \
|
||||
if (amf_ue) \
|
||||
ogs_warn("[%s:%d] " \
|
||||
"N2 transfer message duplicated. Overwritten", \
|
||||
amf_ue->supi, (__sESS)->psi); \
|
||||
ogs_pkbuf_free((__sESS)->transfer.__n2Type); \
|
||||
} \
|
||||
(__sESS)->transfer.__n2Type = __n2Buf; \
|
||||
|
|
@ -733,18 +756,21 @@ typedef struct amf_sess_s {
|
|||
|
||||
#define AMF_SESS_STORE_5GSM_MESSAGE(__sESS, __tYPE, __n1Buf, __n2Buf) \
|
||||
do { \
|
||||
amf_ue_t *amf_ue = NULL; \
|
||||
ogs_assert(__sESS); \
|
||||
ogs_assert((__sESS)->amf_ue); \
|
||||
amf_ue = amf_ue_find_by_id((__sESS)->amf_ue_id); \
|
||||
if ((__sESS)->gsm_message.n1buf) { \
|
||||
ogs_warn("[%s:%d] N1 message duplicated. Overwritten", \
|
||||
((__sESS)->amf_ue)->supi, (__sESS)->psi); \
|
||||
if (amf_ue) \
|
||||
ogs_warn("[%s:%d] N1 message duplicated. Overwritten", \
|
||||
amf_ue->supi, (__sESS)->psi); \
|
||||
ogs_pkbuf_free((__sESS)->gsm_message.n1buf); \
|
||||
} \
|
||||
(__sESS)->gsm_message.n1buf = __n1Buf; \
|
||||
\
|
||||
if ((__sESS)->gsm_message.n2buf) { \
|
||||
ogs_warn("[%s:%d] N2 message duplicated. Overwritten", \
|
||||
((__sESS)->amf_ue)->supi, (__sESS)->psi); \
|
||||
if (amf_ue) \
|
||||
ogs_warn("[%s:%d] N2 message duplicated. Overwritten", \
|
||||
amf_ue->supi, (__sESS)->psi); \
|
||||
ogs_pkbuf_free((__sESS)->gsm_message.n2buf); \
|
||||
} \
|
||||
(__sESS)->gsm_message.n2buf = __n2Buf; \
|
||||
|
|
@ -789,8 +815,8 @@ typedef struct amf_sess_s {
|
|||
ogs_list_t bearer_list;
|
||||
|
||||
/* Related Context */
|
||||
amf_ue_t *amf_ue;
|
||||
ran_ue_t *ran_ue;
|
||||
ogs_pool_id_t amf_ue_id;
|
||||
ogs_pool_id_t ran_ue_id;
|
||||
|
||||
ogs_s_nssai_t s_nssai;
|
||||
ogs_s_nssai_t mapped_hplmn;
|
||||
|
|
@ -812,7 +838,7 @@ amf_gnb_t *amf_gnb_find_by_addr(ogs_sockaddr_t *addr);
|
|||
amf_gnb_t *amf_gnb_find_by_gnb_id(uint32_t gnb_id);
|
||||
int amf_gnb_set_gnb_id(amf_gnb_t *gnb, uint32_t gnb_id);
|
||||
int amf_gnb_sock_type(ogs_sock_t *sock);
|
||||
amf_gnb_t *amf_gnb_cycle(amf_gnb_t *gnb);
|
||||
amf_gnb_t *amf_gnb_find_by_id(ogs_pool_id_t id);
|
||||
|
||||
ran_ue_t *ran_ue_add(amf_gnb_t *gnb, uint64_t ran_ue_ngap_id);
|
||||
void ran_ue_remove(ran_ue_t *ran_ue);
|
||||
|
|
@ -821,7 +847,7 @@ ran_ue_t *ran_ue_find_by_ran_ue_ngap_id(
|
|||
amf_gnb_t *gnb, uint64_t ran_ue_ngap_id);
|
||||
ran_ue_t *ran_ue_find(uint32_t index);
|
||||
ran_ue_t *ran_ue_find_by_amf_ue_ngap_id(uint64_t amf_ue_ngap_id);
|
||||
ran_ue_t *ran_ue_cycle(ran_ue_t *ran_ue);
|
||||
ran_ue_t *ran_ue_find_by_id(ogs_pool_id_t id);
|
||||
|
||||
void amf_ue_new_guti(amf_ue_t *amf_ue);
|
||||
void amf_ue_confirm_guti(amf_ue_t *amf_ue);
|
||||
|
|
@ -924,8 +950,8 @@ void amf_sess_remove_all(amf_ue_t *amf_ue);
|
|||
amf_sess_t *amf_sess_find_by_psi(amf_ue_t *amf_ue, uint8_t psi);
|
||||
amf_sess_t *amf_sess_find_by_dnn(amf_ue_t *amf_ue, char *dnn);
|
||||
|
||||
amf_ue_t *amf_ue_cycle(amf_ue_t *amf_ue);
|
||||
amf_sess_t *amf_sess_cycle(amf_sess_t *sess);
|
||||
amf_ue_t *amf_ue_find_by_id(ogs_pool_id_t id);
|
||||
amf_sess_t *amf_sess_find_by_id(ogs_pool_id_t id);
|
||||
|
||||
void amf_sbi_select_nf(
|
||||
ogs_sbi_object_t *sbi_object,
|
||||
|
|
|
|||
|
|
@ -74,10 +74,10 @@ typedef struct amf_event_s {
|
|||
ogs_nas_5gs_message_t *message;
|
||||
} nas;
|
||||
|
||||
amf_gnb_t *gnb;
|
||||
ran_ue_t *ran_ue;
|
||||
amf_ue_t *amf_ue;
|
||||
amf_sess_t *sess;
|
||||
ogs_pool_id_t gnb_id;
|
||||
ogs_pool_id_t ran_ue_id;
|
||||
ogs_pool_id_t amf_ue_id;
|
||||
ogs_pool_id_t sess_id;
|
||||
amf_bearer_t *bearer;
|
||||
|
||||
ogs_timer_t *timer;
|
||||
|
|
|
|||
|
|
@ -636,7 +636,7 @@ ogs_pkbuf_t *gmm_build_dl_nas_transport(amf_sess_t *sess,
|
|||
ogs_nas_gprs_timer_3_t *back_off_timer_value = NULL;
|
||||
|
||||
ogs_assert(sess);
|
||||
amf_ue = sess->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
ogs_assert(payload_container_type);
|
||||
ogs_assert(payload_container);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ ogs_nas_5gmm_cause_t gmm_handle_registration_request(amf_ue_t *amf_ue,
|
|||
ogs_nas_ue_security_capability_t *ue_security_capability = NULL;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
ogs_assert(registration_request);
|
||||
|
|
@ -632,7 +632,7 @@ ogs_nas_5gmm_cause_t gmm_handle_service_request(amf_ue_t *amf_ue,
|
|||
ogs_nas_key_set_identifier_t *ngksi = NULL;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
ngksi = &service_request->ngksi;
|
||||
|
|
@ -850,7 +850,7 @@ int gmm_handle_deregistration_request(amf_ue_t *amf_ue,
|
|||
ogs_nas_de_registration_type_t *de_registration_type = NULL;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
ogs_assert(deregistration_request);
|
||||
|
||||
|
|
@ -974,7 +974,7 @@ ogs_nas_5gmm_cause_t gmm_handle_identity_response(amf_ue_t *amf_ue,
|
|||
ogs_assert(identity_response);
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
ogs_assert(identity_response);
|
||||
|
||||
|
|
@ -1040,7 +1040,7 @@ ogs_nas_5gmm_cause_t gmm_handle_security_mode_complete(amf_ue_t *amf_ue,
|
|||
ogs_nas_mobile_identity_imeisv_t *mobile_identity_imeisv = NULL;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
ogs_assert(security_mode_complete);
|
||||
|
||||
|
|
@ -1139,8 +1139,8 @@ int gmm_handle_ul_nas_transport(ran_ue_t *ran_ue, amf_ue_t *amf_ue,
|
|||
ogs_nas_dnn_t *dnn = NULL;
|
||||
ogs_nas_5gsm_header_t *gsm_header = NULL;
|
||||
|
||||
ogs_assert(amf_ue_cycle(amf_ue));
|
||||
ogs_assert(ran_ue_cycle(ran_ue));
|
||||
ogs_assert(amf_ue);
|
||||
ogs_assert(ran_ue);
|
||||
ogs_assert(ul_nas_transport);
|
||||
|
||||
payload_container_type = &ul_nas_transport->payload_container_type;
|
||||
|
|
|
|||
|
|
@ -74,12 +74,12 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
amf_sm_debug(e);
|
||||
|
||||
if (e->sess) {
|
||||
sess = e->sess;
|
||||
amf_ue = sess->amf_ue;
|
||||
sess = amf_sess_find_by_id(e->sess_id);
|
||||
if (sess) {
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
} else {
|
||||
amf_ue = e->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(e->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
}
|
||||
|
||||
|
|
@ -575,7 +575,7 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
xact_count = amf_sess_xact_count(amf_ue);
|
||||
amf_sbi_send_release_all_sessions(
|
||||
amf_ue->ran_ue, amf_ue,
|
||||
ran_ue_find_by_id(amf_ue->ran_ue_id), amf_ue,
|
||||
AMF_RELEASE_SM_CONTEXT_NO_STATE);
|
||||
|
||||
if (!AMF_SESSION_RELEASE_PENDING(amf_ue) &&
|
||||
|
|
@ -630,12 +630,12 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
amf_sm_debug(e);
|
||||
|
||||
if (e->sess) {
|
||||
sess = e->sess;
|
||||
amf_ue = sess->amf_ue;
|
||||
sess = amf_sess_find_by_id(e->sess_id);
|
||||
if (sess) {
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
} else {
|
||||
amf_ue = e->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(e->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
}
|
||||
|
||||
|
|
@ -1142,7 +1142,7 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
if (amf_ue->explict_de_registered.n1_done == true) {
|
||||
r = ngap_send_ran_ue_context_release_command(
|
||||
amf_ue->ran_ue,
|
||||
ran_ue_find_by_id(amf_ue->ran_ue_id),
|
||||
NGAP_Cause_PR_misc,
|
||||
NGAP_CauseMisc_om_intervention,
|
||||
NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
|
||||
|
|
@ -1194,12 +1194,12 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e,
|
|||
|
||||
ogs_assert(e);
|
||||
|
||||
if (e->sess) {
|
||||
sess = e->sess;
|
||||
amf_ue = sess->amf_ue;
|
||||
sess = amf_sess_find_by_id(e->sess_id);
|
||||
if (sess) {
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
} else {
|
||||
amf_ue = e->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(e->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
}
|
||||
|
||||
|
|
@ -1208,7 +1208,7 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e,
|
|||
nas_message = e->nas.message;
|
||||
ogs_assert(nas_message);
|
||||
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
h.type = e->nas.type;
|
||||
|
|
@ -1618,12 +1618,12 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
amf_sm_debug(e);
|
||||
|
||||
if (e->sess) {
|
||||
sess = e->sess;
|
||||
amf_ue = sess->amf_ue;
|
||||
sess = amf_sess_find_by_id(e->sess_id);
|
||||
if (sess) {
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
} else {
|
||||
amf_ue = e->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(e->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
}
|
||||
|
||||
|
|
@ -1636,7 +1636,7 @@ void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
|
|||
nas_message = e->nas.message;
|
||||
ogs_assert(nas_message);
|
||||
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
h.type = e->nas.type;
|
||||
|
|
@ -1908,7 +1908,7 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
amf_sm_debug(e);
|
||||
|
||||
amf_ue = e->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(e->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
switch (e->h.id) {
|
||||
|
|
@ -1924,7 +1924,7 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
|
|||
nas_message = e->nas.message;
|
||||
ogs_assert(nas_message);
|
||||
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
h.type = e->nas.type;
|
||||
|
|
@ -2068,7 +2068,8 @@ 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);
|
||||
r = nas_5gs_send_gmm_reject(amf_ue->ran_ue, amf_ue,
|
||||
r = nas_5gs_send_gmm_reject(
|
||||
ran_ue_find_by_id(amf_ue->ran_ue_id), amf_ue,
|
||||
OGS_5GMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
|
@ -2112,12 +2113,12 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
amf_sm_debug(e);
|
||||
|
||||
if (e->sess) {
|
||||
sess = e->sess;
|
||||
amf_ue = sess->amf_ue;
|
||||
sess = amf_sess_find_by_id(e->sess_id);
|
||||
if (sess) {
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
} else {
|
||||
amf_ue = e->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(e->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
}
|
||||
|
||||
|
|
@ -2143,7 +2144,7 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_error("[%s] HTTP response error [%d]",
|
||||
amf_ue->supi, sbi_message->res_status);
|
||||
r = nas_5gs_send_gmm_reject(
|
||||
amf_ue->ran_ue, amf_ue,
|
||||
ran_ue_find_by_id(amf_ue->ran_ue_id), amf_ue,
|
||||
OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
|
@ -2188,7 +2189,7 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
ogs_error("[%s] HTTP response error [%d]",
|
||||
amf_ue->supi, sbi_message->res_status);
|
||||
r = nas_5gs_send_gmm_reject(
|
||||
amf_ue->ran_ue, amf_ue,
|
||||
ran_ue_find_by_id(amf_ue->ran_ue_id), amf_ue,
|
||||
OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
|
@ -2275,7 +2276,7 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
|
|||
nas_message = e->nas.message;
|
||||
ogs_assert(nas_message);
|
||||
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
h.type = e->nas.type;
|
||||
|
|
@ -2459,12 +2460,12 @@ void gmm_state_ue_context_will_remove(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
amf_sm_debug(e);
|
||||
|
||||
if (e->sess) {
|
||||
sess = e->sess;
|
||||
amf_ue = sess->amf_ue;
|
||||
sess = amf_sess_find_by_id(e->sess_id);
|
||||
if (sess) {
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
} else {
|
||||
amf_ue = e->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(e->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
}
|
||||
|
||||
|
|
@ -2497,12 +2498,12 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
amf_sm_debug(e);
|
||||
|
||||
if (e->sess) {
|
||||
sess = e->sess;
|
||||
amf_ue = sess->amf_ue;
|
||||
sess = amf_sess_find_by_id(e->sess_id);
|
||||
if (sess) {
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
} else {
|
||||
amf_ue = e->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(e->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
}
|
||||
|
||||
|
|
@ -2516,7 +2517,8 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
|||
xact_count = amf_sess_xact_count(amf_ue);
|
||||
|
||||
amf_sbi_send_release_all_sessions(
|
||||
amf_ue->ran_ue, amf_ue, AMF_RELEASE_SM_CONTEXT_NO_STATE);
|
||||
ran_ue_find_by_id(amf_ue->ran_ue_id), amf_ue,
|
||||
AMF_RELEASE_SM_CONTEXT_NO_STATE);
|
||||
|
||||
if (!AMF_SESSION_RELEASE_PENDING(amf_ue) &&
|
||||
amf_sess_xact_count(amf_ue) == xact_count) {
|
||||
|
|
@ -2534,7 +2536,7 @@ void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
|
|||
nas_message = e->nas.message;
|
||||
ogs_assert(nas_message);
|
||||
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
h.type = e->nas.type;
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
|
|||
* 4.3.2 PDU Session Establishment *
|
||||
***********************************/
|
||||
|
||||
ran_ue = ran_ue_cycle(sess->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(sess->ran_ue_id);
|
||||
if (ran_ue) {
|
||||
if (sess->pdu_session_establishment_accept) {
|
||||
ogs_pkbuf_free(sess->pdu_session_establishment_accept);
|
||||
|
|
@ -480,7 +480,8 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
|
|||
ogs_error("[%d:%d] PDU session establishment reject",
|
||||
sess->psi, sess->pti);
|
||||
|
||||
r = nas_5gs_send_gsm_reject(sess->ran_ue, sess,
|
||||
r = nas_5gs_send_gsm_reject(
|
||||
ran_ue_find_by_id(sess->ran_ue_id), sess,
|
||||
OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, n1buf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
|
@ -1003,7 +1004,7 @@ int amf_namf_callback_handle_sdm_data_change_notify(
|
|||
}
|
||||
|
||||
if (amf_ue) {
|
||||
ran_ue_t *ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue_t *ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
/* ran_ue is required for amf_ue_is_rat_restricted() */
|
||||
|
|
@ -1092,6 +1093,7 @@ int amf_namf_comm_handle_ue_context_transfer_request(
|
|||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t sendmsg;
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
|
||||
OpenAPI_ambr_t *UeAmbr = NULL;
|
||||
OpenAPI_list_t *MmContextList = NULL;
|
||||
|
|
@ -1246,8 +1248,9 @@ int amf_namf_comm_handle_ue_context_transfer_request(
|
|||
* Context TRANSFERRED !!!
|
||||
* So, we removed UE context.
|
||||
*/
|
||||
if (amf_ue->ran_ue)
|
||||
ran_ue_remove(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (ran_ue)
|
||||
ran_ue_remove(ran_ue);
|
||||
amf_ue_remove(amf_ue);
|
||||
|
||||
return OGS_OK;
|
||||
|
|
|
|||
|
|
@ -25,16 +25,22 @@
|
|||
int nas_5gs_send_to_gnb(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf)
|
||||
{
|
||||
int rv;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_ran_ue(amf_ue->ran_ue, pkbuf);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] RAN-NG Context has already been removed", amf_ue->suci);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_ran_ue(ran_ue, pkbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
|
|
@ -46,7 +52,7 @@ int nas_5gs_send_to_downlink_nas_transport(
|
|||
int rv;
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
ogs_assert(ran_ue_cycle(ran_ue));
|
||||
ogs_assert(ran_ue);
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
ngapbuf = ngap_build_downlink_nas_transport(ran_ue, pkbuf, false, false);
|
||||
|
|
@ -71,14 +77,14 @@ int nas_5gs_send_registration_accept(amf_ue_t *amf_ue)
|
|||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
|
|
@ -177,8 +183,8 @@ int nas_5gs_send_registration_reject(
|
|||
int rv;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
ogs_assert(ran_ue_cycle(ran_ue));
|
||||
ogs_assert(amf_ue_cycle(amf_ue));
|
||||
ogs_assert(ran_ue);
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
switch (amf_ue->nas.registration.value) {
|
||||
case OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL:
|
||||
|
|
@ -225,14 +231,14 @@ int nas_5gs_send_service_accept(amf_ue_t *amf_ue)
|
|||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
|
|
@ -289,7 +295,7 @@ int nas_5gs_send_service_accept(amf_ue_t *amf_ue)
|
|||
rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
} else {
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue->ran_ue, gmmbuf);
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
}
|
||||
}
|
||||
|
|
@ -303,8 +309,8 @@ int nas_5gs_send_service_reject(
|
|||
int rv;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
ogs_assert(ran_ue_cycle(ran_ue));
|
||||
ogs_assert(amf_ue_cycle(amf_ue));
|
||||
ogs_assert(ran_ue);
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
ogs_debug("[%s] Service reject", amf_ue->supi);
|
||||
|
||||
|
|
@ -327,14 +333,14 @@ int nas_5gs_send_de_registration_accept(amf_ue_t *amf_ue)
|
|||
ran_ue_t *ran_ue = NULL;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
|
|
@ -349,7 +355,7 @@ int nas_5gs_send_de_registration_accept(amf_ue_t *amf_ue)
|
|||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue->ran_ue, gmmbuf);
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("nas_5gs_send_to_downlink_nas_transport() failed");
|
||||
return rv;
|
||||
|
|
@ -374,14 +380,14 @@ int nas_5gs_send_de_registration_request(
|
|||
ran_ue_t *ran_ue = NULL;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
|
|
@ -407,7 +413,7 @@ int nas_5gs_send_de_registration_request(
|
|||
ogs_timer_start(amf_ue->t3522.timer,
|
||||
amf_timer_cfg(AMF_TIMER_T3522)->duration);
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue->ran_ue, gmmbuf);
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
|
|
@ -416,15 +422,17 @@ int nas_5gs_send_de_registration_request(
|
|||
int nas_5gs_send_identity_request(amf_ue_t *amf_ue)
|
||||
{
|
||||
int rv;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
if (!ran_ue_cycle(amf_ue->ran_ue)) {
|
||||
ogs_error("NG context has already been removed");
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
|
|
@ -449,7 +457,7 @@ int nas_5gs_send_identity_request(amf_ue_t *amf_ue)
|
|||
ogs_timer_start(amf_ue->t3570.timer,
|
||||
amf_timer_cfg(AMF_TIMER_T3570)->duration);
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue->ran_ue, gmmbuf);
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
|
|
@ -458,15 +466,17 @@ int nas_5gs_send_identity_request(amf_ue_t *amf_ue)
|
|||
int nas_5gs_send_authentication_request(amf_ue_t *amf_ue)
|
||||
{
|
||||
int rv;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
if (!ran_ue_cycle(amf_ue->ran_ue)) {
|
||||
ogs_error("NG context has already been removed");
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
|
|
@ -493,7 +503,7 @@ int nas_5gs_send_authentication_request(amf_ue_t *amf_ue)
|
|||
|
||||
amf_metrics_inst_global_inc(AMF_METR_GLOB_CTR_AMF_AUTH_REQ);
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue->ran_ue, gmmbuf);
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
|
|
@ -502,15 +512,17 @@ int nas_5gs_send_authentication_request(amf_ue_t *amf_ue)
|
|||
int nas_5gs_send_authentication_reject(amf_ue_t *amf_ue)
|
||||
{
|
||||
int rv;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
if (!ran_ue_cycle(amf_ue->ran_ue)) {
|
||||
ogs_error("NG context has already been removed");
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
|
|
@ -524,7 +536,7 @@ int nas_5gs_send_authentication_reject(amf_ue_t *amf_ue)
|
|||
|
||||
amf_metrics_inst_global_inc(AMF_METR_GLOB_CTR_AMF_AUTH_REJECT);
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue->ran_ue, gmmbuf);
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
|
|
@ -533,15 +545,17 @@ int nas_5gs_send_authentication_reject(amf_ue_t *amf_ue)
|
|||
int nas_5gs_send_security_mode_command(amf_ue_t *amf_ue)
|
||||
{
|
||||
int rv;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
if (!ran_ue_cycle(amf_ue->ran_ue)) {
|
||||
ogs_error("NG context has already been removed");
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
|
|
@ -566,7 +580,7 @@ int nas_5gs_send_security_mode_command(amf_ue_t *amf_ue)
|
|||
ogs_timer_start(amf_ue->t3560.timer,
|
||||
amf_timer_cfg(AMF_TIMER_T3560)->duration);
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue->ran_ue, gmmbuf);
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
|
|
@ -576,15 +590,17 @@ int nas_5gs_send_configuration_update_command(
|
|||
amf_ue_t *amf_ue, gmm_configuration_update_command_param_t *param)
|
||||
{
|
||||
int rv;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
if (!ran_ue_cycle(amf_ue->ran_ue)) {
|
||||
ogs_error("NG context has already been removed");
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
|
|
@ -627,7 +643,7 @@ int nas_5gs_send_configuration_update_command(
|
|||
|
||||
amf_metrics_inst_global_inc(AMF_METR_GLOB_CTR_MM_CONF_UPDATE);
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue->ran_ue, gmmbuf);
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
|
|
@ -645,16 +661,16 @@ int nas_send_pdu_session_setup_request(amf_sess_t *sess,
|
|||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
ogs_assert(sess);
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
if (n1smbuf) ogs_pkbuf_free(n1smbuf);
|
||||
ogs_pkbuf_free(n2smbuf);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_warn("NG context has already been removed");
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
if (n1smbuf) ogs_pkbuf_free(n1smbuf);
|
||||
ogs_pkbuf_free(n2smbuf);
|
||||
return OGS_NOTFOUND;
|
||||
|
|
@ -709,16 +725,16 @@ int nas_send_pdu_session_modification_command(amf_sess_t *sess,
|
|||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
ogs_assert(sess);
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
if (n1smbuf) ogs_pkbuf_free(n1smbuf);
|
||||
ogs_pkbuf_free(n2smbuf);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_warn("[%s] NG context has already been removed", amf_ue->supi);
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
if (n1smbuf) ogs_pkbuf_free(n1smbuf);
|
||||
ogs_pkbuf_free(n2smbuf);
|
||||
return OGS_NOTFOUND;
|
||||
|
|
@ -770,16 +786,16 @@ int nas_send_pdu_session_release_command(amf_sess_t *sess,
|
|||
|
||||
ogs_assert(n2smbuf);
|
||||
ogs_assert(sess);
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
if (n1smbuf) ogs_pkbuf_free(n1smbuf);
|
||||
ogs_pkbuf_free(n2smbuf);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_warn("NG context has already been removed");
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
if (n1smbuf) ogs_pkbuf_free(n1smbuf);
|
||||
ogs_pkbuf_free(n2smbuf);
|
||||
return OGS_NOTFOUND;
|
||||
|
|
@ -862,15 +878,17 @@ int nas_send_pdu_session_release_command(amf_sess_t *sess,
|
|||
int nas_5gs_send_gmm_status(amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t cause)
|
||||
{
|
||||
int rv;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
if (!ran_ue_cycle(amf_ue->ran_ue)) {
|
||||
ogs_error("NG context has already been removed");
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
|
|
@ -882,7 +900,7 @@ int nas_5gs_send_gmm_status(amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t cause)
|
|||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(amf_ue->ran_ue, gmmbuf);
|
||||
rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
|
|
@ -893,13 +911,11 @@ int nas_5gs_send_gmm_reject(
|
|||
{
|
||||
int rv;
|
||||
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(ran_ue);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
|
|
@ -950,11 +966,17 @@ static ogs_nas_5gmm_cause_t gmm_cause_from_sbi(int status)
|
|||
int nas_5gs_send_gmm_reject_from_sbi(amf_ue_t *amf_ue, int status)
|
||||
{
|
||||
int rv;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
rv = nas_5gs_send_gmm_reject(
|
||||
amf_ue->ran_ue, amf_ue, gmm_cause_from_sbi(status));
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
rv = nas_5gs_send_gmm_reject(ran_ue, amf_ue, gmm_cause_from_sbi(status));
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
|
|
@ -969,20 +991,17 @@ int nas_5gs_send_dl_nas_transport(ran_ue_t *ran_ue, amf_sess_t *sess,
|
|||
ogs_pkbuf_t *gmmbuf = NULL;
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
|
||||
ogs_assert(sess);
|
||||
sess = amf_sess_cycle(sess);
|
||||
if (!sess) {
|
||||
ogs_error("Session has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(ran_ue);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
|
|
@ -1025,19 +1044,18 @@ int nas_5gs_send_gsm_reject(ran_ue_t *ran_ue, amf_sess_t *sess,
|
|||
amf_ue_t *amf_ue = NULL;
|
||||
|
||||
ogs_assert(sess);
|
||||
sess = amf_sess_cycle(sess);
|
||||
|
||||
if (!sess) {
|
||||
ogs_error("Session has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(ran_ue);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
|
|
@ -1061,20 +1079,17 @@ int nas_5gs_send_back_gsm_message(
|
|||
ogs_pkbuf_t *pbuf = NULL;
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
|
||||
ogs_assert(sess);
|
||||
sess = amf_sess_cycle(sess);
|
||||
if (!sess) {
|
||||
ogs_error("Session has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(ran_ue);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
|
|
|
|||
|
|
@ -313,9 +313,8 @@ ogs_pkbuf_t *ngap_build_downlink_nas_transport(
|
|||
NGAP_AllowedNSSAI_t *AllowedNSSAI = NULL;
|
||||
|
||||
ogs_assert(gmmbuf);
|
||||
ran_ue = ran_ue_cycle(ran_ue);
|
||||
ogs_assert(ran_ue);
|
||||
amf_ue = amf_ue_cycle(ran_ue->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
ogs_debug("DownlinkNASTransport");
|
||||
|
|
@ -470,9 +469,8 @@ ogs_pkbuf_t *ngap_ue_build_initial_context_setup_request(
|
|||
NGAP_MaskedIMEISV_t *MaskedIMEISV = NULL;
|
||||
NGAP_NAS_PDU_t *NAS_PDU = NULL;
|
||||
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
ogs_debug("InitialContextSetupRequest(UE)");
|
||||
|
|
@ -781,9 +779,8 @@ ogs_pkbuf_t *ngap_build_ue_context_modification_request(amf_ue_t *amf_ue)
|
|||
NGAP_UESecurityCapabilities_t *UESecurityCapabilities = NULL;
|
||||
NGAP_SecurityKey_t *SecurityKey = NULL;
|
||||
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
ogs_debug("UEContextModificationRequest(UE)");
|
||||
|
|
@ -932,9 +929,8 @@ ogs_pkbuf_t *ngap_sess_build_initial_context_setup_request(
|
|||
NGAP_MaskedIMEISV_t *MaskedIMEISV = NULL;
|
||||
|
||||
ogs_assert(sess);
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(ran_ue);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
ogs_debug("InitialContextSetupRequest(Session)");
|
||||
|
|
@ -1222,7 +1218,6 @@ ogs_pkbuf_t *ngap_build_ue_context_release_command(
|
|||
NGAP_UE_NGAP_IDs_t *UE_NGAP_IDs = NULL;
|
||||
NGAP_Cause_t *Cause = NULL;
|
||||
|
||||
ran_ue = ran_ue_cycle(ran_ue);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
ogs_debug("UEContextReleaseCommand");
|
||||
|
|
@ -1298,9 +1293,8 @@ ogs_pkbuf_t *ngap_ue_build_pdu_session_resource_setup_request(
|
|||
NGAP_PDUSessionResourceSetupListSUReq_t *PDUSessionList = NULL;
|
||||
NGAP_PDUSessionResourceSetupItemSUReq_t *PDUSessionItem = NULL;
|
||||
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
ogs_debug("PDUSessionResourceSetupRequest(UE)");
|
||||
|
|
@ -1466,9 +1460,8 @@ ogs_pkbuf_t *ngap_sess_build_pdu_session_resource_setup_request(
|
|||
ogs_assert(n2smbuf);
|
||||
ogs_assert(sess);
|
||||
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(ran_ue);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
ogs_debug("PDUSessionResourceSetupRequest(Session)");
|
||||
|
|
@ -1609,9 +1602,9 @@ ogs_pkbuf_t *ngap_build_pdu_session_resource_modify_request(
|
|||
ogs_assert(n2smbuf);
|
||||
ogs_assert(sess);
|
||||
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
ogs_debug("PDUSessionResourceModifyRequest");
|
||||
|
|
@ -1709,9 +1702,9 @@ ogs_pkbuf_t *ngap_build_pdu_session_resource_release_command(
|
|||
ogs_assert(n2smbuf);
|
||||
ogs_assert(sess);
|
||||
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
ogs_debug("PDUSessionResourceReleaseCommand");
|
||||
|
|
@ -1815,7 +1808,6 @@ ogs_pkbuf_t *ngap_build_paging(amf_ue_t *amf_ue)
|
|||
NGAP_TAIListForPagingItem_t *TAIItem = NULL;
|
||||
NGAP_TAI_t *tAI = NULL;
|
||||
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
ogs_assert(amf_ue);
|
||||
ogs_debug("Paging");
|
||||
|
||||
|
|
@ -1942,9 +1934,8 @@ ogs_pkbuf_t *ngap_build_path_switch_ack(amf_ue_t *amf_ue)
|
|||
NGAP_PDUSessionResourceSwitchedList_t *PDUSessionResourceSwitchedList;
|
||||
NGAP_AllowedNSSAI_t *AllowedNSSAI = NULL;
|
||||
|
||||
amf_ue = amf_ue_cycle(amf_ue);
|
||||
ogs_assert(amf_ue);
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
ogs_debug("PathSwitchAcknowledge");
|
||||
|
|
@ -2110,9 +2101,8 @@ ogs_pkbuf_t *ngap_build_handover_request(ran_ue_t *target_ue)
|
|||
*SourceToTarget_TransparentContainer = NULL;
|
||||
NGAP_GUAMI_t *GUAMI = NULL;
|
||||
|
||||
target_ue = ran_ue_cycle(target_ue);
|
||||
ogs_assert(target_ue);
|
||||
amf_ue = amf_ue_cycle(target_ue->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(target_ue->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
ogs_debug("HandoverRequest");
|
||||
|
|
@ -2410,7 +2400,6 @@ ogs_pkbuf_t *ngap_build_handover_preparation_failure(
|
|||
NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL;
|
||||
NGAP_Cause_t *Cause = NULL;
|
||||
|
||||
source_ue = ran_ue_cycle(source_ue);
|
||||
ogs_assert(source_ue);
|
||||
ogs_assert(cause);
|
||||
|
||||
|
|
@ -2495,9 +2484,8 @@ ogs_pkbuf_t *ngap_build_handover_command(ran_ue_t *source_ue)
|
|||
NGAP_TargetToSource_TransparentContainer_t
|
||||
*TargetToSource_TransparentContainer = NULL;
|
||||
|
||||
source_ue = ran_ue_cycle(source_ue);
|
||||
ogs_assert(source_ue);
|
||||
amf_ue = amf_ue_cycle(source_ue->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(source_ue->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
ogs_debug("HandoverCommand");
|
||||
|
|
@ -2614,7 +2602,6 @@ ogs_pkbuf_t *ngap_build_handover_cancel_ack(ran_ue_t *source_ue)
|
|||
NGAP_AMF_UE_NGAP_ID_t *AMF_UE_NGAP_ID = NULL;
|
||||
NGAP_RAN_UE_NGAP_ID_t *RAN_UE_NGAP_ID = NULL;
|
||||
|
||||
source_ue = ran_ue_cycle(source_ue);
|
||||
ogs_assert(source_ue);
|
||||
|
||||
ogs_debug("HandoverCancelAcknowledge");
|
||||
|
|
@ -2680,7 +2667,6 @@ ogs_pkbuf_t *ngap_build_downlink_ran_status_transfer(
|
|||
NGAP_RANStatusTransfer_TransparentContainer_t
|
||||
*RANStatusTransfer_TransparentContainer = NULL;
|
||||
|
||||
target_ue = ran_ue_cycle(target_ue);
|
||||
ogs_assert(target_ue);
|
||||
ogs_assert(transfer);
|
||||
|
||||
|
|
|
|||
|
|
@ -696,7 +696,7 @@ void ngap_handle_uplink_nas_transport(
|
|||
return;
|
||||
}
|
||||
|
||||
amf_ue = ran_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("Cannot find AMF-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -783,6 +783,7 @@ void ngap_handle_ue_radio_capability_info_indication(
|
|||
int i, r;
|
||||
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
uint64_t amf_ue_ngap_id;
|
||||
|
||||
NGAP_InitiatingMessage_t *initiatingMessage = NULL;
|
||||
|
|
@ -872,9 +873,9 @@ void ngap_handle_ue_radio_capability_info_indication(
|
|||
return;
|
||||
}
|
||||
|
||||
if (ran_ue->amf_ue)
|
||||
OGS_ASN_STORE_DATA(&ran_ue->amf_ue->ueRadioCapability,
|
||||
UERadioCapability);
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
if (amf_ue)
|
||||
OGS_ASN_STORE_DATA(&amf_ue->ueRadioCapability, UERadioCapability);
|
||||
}
|
||||
|
||||
void ngap_handle_initial_context_setup_response(
|
||||
|
|
@ -969,7 +970,7 @@ void ngap_handle_initial_context_setup_response(
|
|||
|
||||
ran_ue->initial_context_setup_response_received = true;
|
||||
|
||||
amf_ue = ran_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("Cannot find AMF-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -1268,7 +1269,7 @@ void ngap_handle_initial_context_setup_failure(
|
|||
* may in principle be adopted. The RAN should ensure
|
||||
* that no hanging resources remain at the RAN.
|
||||
*/
|
||||
amf_ue = ran_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
if (amf_ue) {
|
||||
/*
|
||||
* if T3550 is running, Registration complete will be sent.
|
||||
|
|
@ -1569,7 +1570,7 @@ void ngap_handle_ue_context_release_request(
|
|||
break;
|
||||
}
|
||||
|
||||
amf_ue = ran_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("Cannot find AMF-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -1720,12 +1721,7 @@ void ngap_handle_ue_context_release_action(ran_ue_t *ran_ue)
|
|||
|
||||
ogs_assert(ran_ue);
|
||||
|
||||
if (ran_ue_cycle(ran_ue) == NULL) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return;
|
||||
}
|
||||
|
||||
amf_ue = ran_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
|
||||
ogs_info("UE Context Release [Action:%d]", ran_ue->ue_ctx_rel_action);
|
||||
ogs_info(" RAN_UE_NGAP_ID[%lld] AMF_UE_NGAP_ID[%lld]",
|
||||
|
|
@ -1821,12 +1817,14 @@ void ngap_handle_ue_context_release_action(ran_ue_t *ran_ue)
|
|||
ogs_error("No UE(amf-ue) context");
|
||||
return;
|
||||
}
|
||||
if (!amf_ue->ran_ue) {
|
||||
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("No NG context");
|
||||
return;
|
||||
}
|
||||
|
||||
r = ngap_send_handover_cancel_ack(amf_ue->ran_ue);
|
||||
r = ngap_send_handover_cancel_ack(ran_ue);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
break;
|
||||
|
|
@ -1945,7 +1943,7 @@ void ngap_handle_pdu_session_resource_setup_response(
|
|||
(long long)ran_ue->ran_ue_ngap_id,
|
||||
(long long)ran_ue->amf_ue_ngap_id);
|
||||
|
||||
amf_ue = ran_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("Cannot find AMF-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -2267,7 +2265,7 @@ void ngap_handle_pdu_session_resource_modify_response(
|
|||
(long long)ran_ue->ran_ue_ngap_id,
|
||||
(long long)ran_ue->amf_ue_ngap_id);
|
||||
|
||||
amf_ue = ran_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("Cannot find AMF-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -2454,7 +2452,7 @@ void ngap_handle_pdu_session_resource_release_response(
|
|||
(long long)ran_ue->ran_ue_ngap_id,
|
||||
(long long)ran_ue->amf_ue_ngap_id);
|
||||
|
||||
amf_ue = ran_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("Cannot find AMF-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -2802,7 +2800,7 @@ void ngap_handle_path_switch_request(
|
|||
return;
|
||||
}
|
||||
|
||||
amf_ue = ran_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("Cannot find AMF-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -3133,7 +3131,7 @@ void ngap_handle_handover_required(
|
|||
(long long)source_ue->ran_ue_ngap_id,
|
||||
(long long)source_ue->amf_ue_ngap_id);
|
||||
|
||||
amf_ue = source_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(source_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("Cannot find AMF-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -3251,7 +3249,7 @@ void ngap_handle_handover_required(
|
|||
return;
|
||||
}
|
||||
|
||||
target_ue = ran_ue_cycle(source_ue->target_ue);
|
||||
target_ue = ran_ue_find_by_id(source_ue->target_ue_id);
|
||||
if (target_ue) {
|
||||
/*
|
||||
* Issue #3014
|
||||
|
|
@ -3521,7 +3519,7 @@ void ngap_handle_handover_request_ack(
|
|||
|
||||
target_ue->ran_ue_ngap_id = *RAN_UE_NGAP_ID;
|
||||
|
||||
source_ue = target_ue->source_ue;
|
||||
source_ue = ran_ue_find_by_id(target_ue->source_ue_id);
|
||||
if (!source_ue) {
|
||||
ogs_error("Cannot find Source-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -3533,7 +3531,7 @@ void ngap_handle_handover_request_ack(
|
|||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
amf_ue = target_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(target_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("Cannot find AMF-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -3728,7 +3726,7 @@ void ngap_handle_handover_failure(
|
|||
return;
|
||||
}
|
||||
|
||||
source_ue = target_ue->source_ue;
|
||||
source_ue = ran_ue_find_by_id(target_ue->source_ue_id);
|
||||
if (!source_ue) {
|
||||
ogs_error("Cannot find Source-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -3853,7 +3851,7 @@ void ngap_handle_handover_cancel(
|
|||
return;
|
||||
}
|
||||
|
||||
target_ue = source_ue->target_ue;
|
||||
target_ue = ran_ue_find_by_id(source_ue->target_ue_id);
|
||||
if (!target_ue) {
|
||||
ogs_error("Cannot find Source-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -3865,7 +3863,7 @@ void ngap_handle_handover_cancel(
|
|||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
amf_ue = source_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(source_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("Cannot find AMF-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -4005,7 +4003,7 @@ void ngap_handle_uplink_ran_status_transfer(
|
|||
return;
|
||||
}
|
||||
|
||||
target_ue = source_ue->target_ue;
|
||||
target_ue = ran_ue_find_by_id(source_ue->target_ue_id);
|
||||
if (!target_ue) {
|
||||
ogs_error("Cannot find Source-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -4017,7 +4015,7 @@ void ngap_handle_uplink_ran_status_transfer(
|
|||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
amf_ue = source_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(source_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("Cannot find AMF-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -4127,7 +4125,7 @@ void ngap_handle_handover_notification(
|
|||
return;
|
||||
}
|
||||
|
||||
source_ue = target_ue->source_ue;
|
||||
source_ue = ran_ue_find_by_id(target_ue->source_ue_id);
|
||||
if (!source_ue) {
|
||||
ogs_error("Cannot find Source-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -4139,7 +4137,7 @@ void ngap_handle_handover_notification(
|
|||
ogs_assert(r != OGS_ERROR);
|
||||
return;
|
||||
}
|
||||
amf_ue = target_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(target_ue->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("Cannot find AMF-UE Context [%lld]",
|
||||
(long long)amf_ue_ngap_id);
|
||||
|
|
@ -4663,7 +4661,7 @@ void ngap_handle_ng_reset(
|
|||
/* RAN_UE Context where PartOfNG_interface was requested */
|
||||
ran_ue->part_of_ng_reset_requested = true;
|
||||
|
||||
amf_ue = ran_ue->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
/*
|
||||
* Issues #1928
|
||||
*
|
||||
|
|
|
|||
|
|
@ -51,12 +51,7 @@ int ngap_send_to_gnb(amf_gnb_t *gnb, ogs_pkbuf_t *pkbuf, uint16_t stream_no)
|
|||
char buf[OGS_ADDRSTRLEN];
|
||||
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
if (!amf_gnb_cycle(gnb)) {
|
||||
ogs_error("gNB has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ogs_assert(gnb);
|
||||
|
||||
ogs_assert(gnb->sctp.sock);
|
||||
if (gnb->sctp.sock->fd == INVALID_SOCKET) {
|
||||
|
|
@ -83,15 +78,24 @@ 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;
|
||||
amf_gnb_t *gnb = NULL;
|
||||
|
||||
ogs_assert(pkbuf);
|
||||
|
||||
if (!ran_ue_cycle(ran_ue)) {
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_gnb(ran_ue->gnb, pkbuf, ran_ue->gnb_ostream_id);
|
||||
gnb = amf_gnb_find_by_id(ran_ue->gnb_id);
|
||||
if (!gnb) {
|
||||
ogs_error("[%d] gNB has already been removed", ran_ue->gnb_id);
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
rv = ngap_send_to_gnb(gnb, pkbuf, ran_ue->gnb_ostream_id);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
return rv;
|
||||
|
|
@ -112,8 +116,7 @@ int ngap_delayed_send_to_ran_ue(
|
|||
ogs_app()->timer_mgr, amf_timer_ng_delayed_send, e);
|
||||
ogs_assert(e->timer);
|
||||
e->pkbuf = pkbuf;
|
||||
e->ran_ue = ran_ue;
|
||||
e->gnb = ran_ue->gnb;
|
||||
e->ran_ue_id = ran_ue->id;
|
||||
|
||||
ogs_timer_start(e->timer, duration);
|
||||
|
||||
|
|
@ -136,7 +139,7 @@ int ngap_send_to_5gsm(amf_ue_t *amf_ue, ogs_pkbuf_t *esmbuf)
|
|||
|
||||
e = amf_event_new(AMF_EVENT_5GSM_MESSAGE);
|
||||
ogs_assert(e);
|
||||
e->amf_ue = amf_ue;
|
||||
e->amf_ue_id = amf_ue->id;
|
||||
e->pkbuf = esmbuf;
|
||||
rv = ogs_queue_push(ogs_app()->queue, e);
|
||||
if (rv != OGS_OK) {
|
||||
|
|
@ -153,6 +156,8 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
|
|||
{
|
||||
int rv;
|
||||
|
||||
amf_ue_t *amf_ue = NULL;
|
||||
|
||||
ogs_nas_5gs_security_header_t *sh = NULL;
|
||||
ogs_nas_security_header_type_t security_header_type;
|
||||
|
||||
|
|
@ -163,6 +168,8 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
|
|||
ogs_assert(ran_ue);
|
||||
ogs_assert(nasPdu);
|
||||
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
|
||||
/* The Packet Buffer(pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||
nasbuf = ogs_pkbuf_alloc(NULL, OGS_NAS_HEADROOM+nasPdu->size);
|
||||
|
|
@ -204,8 +211,8 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
|
|||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
if (ran_ue->amf_ue) {
|
||||
if (nas_5gs_security_decode(ran_ue->amf_ue,
|
||||
if (amf_ue) {
|
||||
if (nas_5gs_security_decode(amf_ue,
|
||||
security_header_type, nasbuf) != OGS_OK) {
|
||||
ogs_error("nas_eps_security_decode failed()");
|
||||
ran_ue_remove(ran_ue);
|
||||
|
|
@ -249,7 +256,7 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
|
|||
ogs_pkbuf_free(nasbuf);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
e->ran_ue = ran_ue;
|
||||
e->ran_ue_id = ran_ue->id;
|
||||
e->ngap.code = procedureCode;
|
||||
e->nas.type = security_header_type.type;
|
||||
e->pkbuf = nasbuf;
|
||||
|
|
@ -262,7 +269,6 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
|
|||
return rv;
|
||||
} else if (h->extended_protocol_discriminator ==
|
||||
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GSM) {
|
||||
amf_ue_t *amf_ue = ran_ue->amf_ue;
|
||||
if (!amf_ue) {
|
||||
ogs_error("No UE Context");
|
||||
ogs_pkbuf_free(nasbuf);
|
||||
|
|
@ -288,12 +294,9 @@ int ngap_send_ng_setup_response(amf_gnb_t *gnb)
|
|||
int rv;
|
||||
ogs_pkbuf_t *ngap_buffer;
|
||||
|
||||
ogs_debug("NG-Setup response");
|
||||
ogs_assert(gnb);
|
||||
|
||||
if (!amf_gnb_cycle(gnb)) {
|
||||
ogs_error("gNB has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ogs_debug("NG-Setup response");
|
||||
|
||||
ngap_buffer = ngap_build_ng_setup_response();
|
||||
if (!ngap_buffer) {
|
||||
|
|
@ -313,12 +316,9 @@ int ngap_send_ng_setup_failure(
|
|||
int rv;
|
||||
ogs_pkbuf_t *ngap_buffer;
|
||||
|
||||
ogs_debug("NG-Setup failure");
|
||||
ogs_assert(gnb);
|
||||
|
||||
if (!amf_gnb_cycle(gnb)) {
|
||||
ogs_error("gNB has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ogs_debug("NG-Setup failure");
|
||||
|
||||
ngap_buffer = ngap_build_ng_setup_failure(
|
||||
group, cause, NGAP_TimeToWait_v10s);
|
||||
|
|
@ -338,12 +338,9 @@ int ngap_send_ran_configuration_update_ack(amf_gnb_t *gnb)
|
|||
int rv;
|
||||
ogs_pkbuf_t *ngap_buffer;
|
||||
|
||||
ogs_debug("RANConfigurationUpdateAcknowledge");
|
||||
ogs_assert(gnb);
|
||||
|
||||
if (!amf_gnb_cycle(gnb)) {
|
||||
ogs_error("gNB has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ogs_debug("RANConfigurationUpdateAcknowledge");
|
||||
|
||||
ngap_buffer = ngap_build_ran_configuration_update_ack();
|
||||
if (!ngap_buffer) {
|
||||
|
|
@ -363,12 +360,9 @@ int ngap_send_ran_configuration_update_failure(
|
|||
int rv;
|
||||
ogs_pkbuf_t *ngap_buffer;
|
||||
|
||||
ogs_debug("RANConfigurationUpdateFailure");
|
||||
ogs_assert(gnb);
|
||||
|
||||
if (!amf_gnb_cycle(gnb)) {
|
||||
ogs_error("gNB has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ogs_debug("RANConfigurationUpdateFailure");
|
||||
|
||||
ngap_buffer = ngap_build_ran_configuration_update_failure(
|
||||
group, cause, NGAP_TimeToWait_v10s);
|
||||
|
|
@ -390,7 +384,7 @@ int ngap_send_ran_ue_context_release_command(
|
|||
int rv;
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
if (!ran_ue_cycle(ran_ue)) {
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
|
@ -427,13 +421,14 @@ int ngap_send_amf_ue_context_release_command(
|
|||
{
|
||||
int rv;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
rv = ngap_send_ran_ue_context_release_command(
|
||||
amf_ue->ran_ue, group, cause, action, duration);
|
||||
ran_ue_find_by_id(amf_ue->ran_ue_id),
|
||||
group, cause, action, duration);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
ogs_debug(" SUPI[%s]", amf_ue->supi);
|
||||
|
||||
|
|
@ -449,7 +444,7 @@ int ngap_send_paging(amf_ue_t *amf_ue)
|
|||
|
||||
ogs_debug("NG-Paging");
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
|
@ -503,10 +498,7 @@ int ngap_send_downlink_ran_configuration_transfer(
|
|||
int rv;
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
if (!amf_gnb_cycle(target_gnb)) {
|
||||
ogs_error("gNB has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ogs_assert(target_gnb);
|
||||
ogs_assert(transfer);
|
||||
|
||||
ngapbuf = ngap_build_downlink_ran_configuration_transfer(transfer);
|
||||
|
|
@ -529,20 +521,18 @@ int ngap_send_path_switch_ack(amf_sess_t *sess)
|
|||
ran_ue_t *ran_ue = NULL;
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
ogs_assert(sess);
|
||||
sess = amf_sess_cycle(sess);
|
||||
if (!sess) {
|
||||
ogs_error("Session has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
return OGS_NOTFOUND;
|
||||
|
|
@ -567,18 +557,18 @@ int ngap_send_handover_request(amf_ue_t *amf_ue)
|
|||
ran_ue_t *source_ue = NULL, *target_ue = NULL;
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
source_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
source_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!source_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
target_ue = ran_ue_cycle(source_ue->target_ue);
|
||||
target_ue = ran_ue_find_by_id(source_ue->target_ue_id);
|
||||
if (!target_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
|
|
@ -602,7 +592,7 @@ int ngap_send_handover_preparation_failure(
|
|||
int rv;
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
if (!ran_ue_cycle(source_ue)) {
|
||||
if (!source_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
|
@ -628,12 +618,12 @@ int ngap_send_handover_command(amf_ue_t *amf_ue)
|
|||
ran_ue_t *source_ue = NULL;
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
if (!amf_ue_cycle(amf_ue)) {
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
source_ue = ran_ue_cycle(amf_ue->ran_ue);
|
||||
source_ue = ran_ue_find_by_id(amf_ue->ran_ue_id);
|
||||
if (!source_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
|
|
@ -656,7 +646,7 @@ int ngap_send_handover_cancel_ack(ran_ue_t *source_ue)
|
|||
int rv;
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
if (!ran_ue_cycle(source_ue)) {
|
||||
if (!source_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
|
@ -680,7 +670,7 @@ int ngap_send_downlink_ran_status_transfer(
|
|||
int rv;
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
if (!ran_ue_cycle(target_ue)) {
|
||||
if (!target_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
|
@ -707,10 +697,7 @@ int ngap_send_error_indication(
|
|||
int rv;
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
if (!amf_gnb_cycle(gnb)) {
|
||||
ogs_error("gNB has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ogs_assert(gnb);
|
||||
|
||||
ngapbuf = ogs_ngap_build_error_indication(
|
||||
ran_ue_ngap_id, amf_ue_ngap_id, group, cause);
|
||||
|
|
@ -729,15 +716,21 @@ int ngap_send_error_indication2(
|
|||
ran_ue_t *ran_ue, NGAP_Cause_PR group, long cause)
|
||||
{
|
||||
int rv;
|
||||
amf_gnb_t *gnb = NULL;
|
||||
|
||||
ran_ue = ran_ue_cycle(ran_ue);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
gnb = amf_gnb_find_by_id(ran_ue->gnb_id);
|
||||
if (!gnb) {
|
||||
ogs_error("[%d] gNB has already been removed", ran_ue->gnb_id);
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
|
||||
rv = ngap_send_error_indication(
|
||||
ran_ue->gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
|
||||
gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
|
||||
group, cause);
|
||||
ogs_expect(rv == OGS_OK);
|
||||
|
||||
|
|
@ -751,10 +744,7 @@ int ngap_send_ng_reset_ack(
|
|||
int rv;
|
||||
ogs_pkbuf_t *ngapbuf = NULL;
|
||||
|
||||
if (!amf_gnb_cycle(gnb)) {
|
||||
ogs_error("gNB has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
ogs_assert(gnb);
|
||||
|
||||
ngapbuf = ogs_ngap_build_ng_reset_ack(partOfNG_Interface);
|
||||
if (!ngapbuf) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ void ngap_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
amf_sm_debug(e);
|
||||
|
||||
gnb = e->gnb;
|
||||
gnb = amf_gnb_find_by_id(e->gnb_id);
|
||||
ogs_assert(gnb);
|
||||
|
||||
switch (e->h.id) {
|
||||
|
|
@ -191,10 +191,10 @@ void ngap_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
case AMF_EVENT_NGAP_TIMER:
|
||||
switch (e->h.timer_id) {
|
||||
case AMF_TIMER_NG_DELAYED_SEND:
|
||||
ogs_assert(e->ran_ue);
|
||||
ogs_assert(e->pkbuf);
|
||||
|
||||
r = ngap_send_to_ran_ue(e->ran_ue, e->pkbuf);
|
||||
r = ngap_send_to_ran_ue(
|
||||
ran_ue_find_by_id(e->ran_ue_id), e->pkbuf);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
||||
|
|
|
|||
|
|
@ -84,13 +84,15 @@ 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) {
|
||||
r = nas_5gs_send_back_gsm_message(sess->ran_ue, sess,
|
||||
r = nas_5gs_send_back_gsm_message(
|
||||
ran_ue_find_by_id(sess->ran_ue_id), sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
|
||||
AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
} else {
|
||||
r = ngap_send_error_indication2(sess->ran_ue,
|
||||
r = ngap_send_error_indication2(
|
||||
ran_ue_find_by_id(sess->ran_ue_id),
|
||||
NGAP_Cause_PR_transport,
|
||||
NGAP_CauseTransport_transport_resource_unavailable);
|
||||
ogs_expect(r == OGS_OK);
|
||||
|
|
|
|||
|
|
@ -42,21 +42,20 @@ int amf_nnssf_nsselection_handle_get(
|
|||
ogs_assert(recvmsg);
|
||||
ogs_assert(!SESSION_CONTEXT_IN_SMF(sess));
|
||||
|
||||
sess = amf_sess_cycle(sess);
|
||||
if (!sess) {
|
||||
ogs_error("Session has already been removed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf_ue) Context has already been removed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(sess->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(sess->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
ogs_error("[%s] RAN-NG Context has already been removed", amf_ue->supi);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ ogs_sbi_request_t *amf_npcf_am_policy_control_build_create(
|
|||
|
||||
ogs_assert(amf_ue);
|
||||
ogs_assert(amf_ue->supi);
|
||||
ogs_assert(ran_ue_cycle(amf_ue->ran_ue));
|
||||
ogs_assert(ran_ue_find_by_id(amf_ue->ran_ue_id));
|
||||
|
||||
memset(&message, 0, sizeof(message));
|
||||
message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context(
|
|||
ogs_sbi_nf_instance_t *pcf_nf_instance = NULL;
|
||||
|
||||
ogs_assert(sess);
|
||||
amf_ue = sess->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
ogs_assert(amf_ue->nas.access_type);
|
||||
ogs_assert(ran_ue_cycle(amf_ue->ran_ue));
|
||||
ogs_assert(ran_ue_find_by_id(amf_ue->ran_ue_id));
|
||||
|
||||
memset(&message, 0, sizeof(message));
|
||||
message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
|
||||
|
|
@ -274,7 +274,7 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_update_sm_context(
|
|||
ogs_assert(param);
|
||||
ogs_assert(sess);
|
||||
ogs_assert(sess->sm_context.resource_uri);
|
||||
amf_ue = sess->amf_ue;
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
memset(&message, 0, sizeof(message));
|
||||
|
|
@ -407,8 +407,6 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_release_sm_context(
|
|||
|
||||
ogs_assert(sess);
|
||||
ogs_assert(sess->sm_context.resource_uri);
|
||||
amf_ue = sess->amf_ue;
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
memset(&message, 0, sizeof(message));
|
||||
message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
|
||||
|
|
@ -432,6 +430,13 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_release_sm_context(
|
|||
}
|
||||
|
||||
memset(&ueLocation, 0, sizeof(ueLocation));
|
||||
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf_ue) Context has already been removed");
|
||||
goto end;
|
||||
}
|
||||
|
||||
ueLocation.nr_location = ogs_sbi_build_nr_location(
|
||||
&amf_ue->nr_tai, &amf_ue->nr_cgi);
|
||||
if (!ueLocation.nr_location) {
|
||||
|
|
|
|||
|
|
@ -33,20 +33,19 @@ int amf_nsmf_pdusession_handle_create_sm_context(
|
|||
ran_ue_t *ran_ue = NULL;
|
||||
|
||||
ogs_assert(recvmsg);
|
||||
ogs_assert(sess);
|
||||
sess = amf_sess_cycle(sess);
|
||||
|
||||
if (!sess) {
|
||||
ogs_error("Session has already been removed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf_ue) Context has already been removed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(sess->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(sess->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] RAN-NG Context has already been removed", amf_ue->supi);
|
||||
return OGS_ERROR;
|
||||
|
|
@ -255,20 +254,19 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
ran_ue_t *ran_ue = NULL;
|
||||
|
||||
ogs_assert(recvmsg);
|
||||
ogs_assert(sess);
|
||||
sess = amf_sess_cycle(sess);
|
||||
|
||||
if (!sess) {
|
||||
ogs_error("Session has already been removed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf_ue) Context has already been removed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(sess->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(sess->ran_ue_id);
|
||||
|
||||
if (recvmsg->res_status == OGS_SBI_HTTP_STATUS_NO_CONTENT ||
|
||||
recvmsg->res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||
|
|
@ -711,9 +709,9 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
if (AMF_SESSION_SYNC_DONE(amf_ue, state)) {
|
||||
ran_ue_t *source_ue = NULL, *target_ue = NULL;
|
||||
|
||||
source_ue = sess->ran_ue;
|
||||
source_ue = ran_ue_find_by_id(sess->ran_ue_id);
|
||||
ogs_assert(source_ue);
|
||||
target_ue = ran_ue_cycle(source_ue->target_ue);
|
||||
target_ue = ran_ue_find_by_id(source_ue->target_ue_id);
|
||||
if (target_ue) {
|
||||
r = ngap_send_ran_ue_context_release_command(
|
||||
target_ue,
|
||||
|
|
@ -783,7 +781,9 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
amf_ue_deassociate(amf_ue);
|
||||
|
||||
if (ran_ue) {
|
||||
amf_gnb_t *gnb = ran_ue->gnb;
|
||||
amf_gnb_t *gnb = NULL;
|
||||
|
||||
gnb = amf_gnb_find_by_id(ran_ue->gnb_id);
|
||||
ogs_assert(gnb);
|
||||
|
||||
ogs_debug(" SUPI[%s]", amf_ue->supi);
|
||||
|
|
@ -839,7 +839,9 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
amf_ue_deassociate(amf_ue);
|
||||
|
||||
if (ran_ue) {
|
||||
amf_gnb_t *gnb = ran_ue->gnb;
|
||||
amf_gnb_t *gnb = NULL;
|
||||
|
||||
gnb = amf_gnb_find_by_id(ran_ue->gnb_id);
|
||||
ogs_assert(gnb);
|
||||
|
||||
ogs_debug(" SUPI[%s]", amf_ue->supi);
|
||||
|
|
@ -936,8 +938,16 @@ int amf_nsmf_pdusession_handle_update_sm_context(
|
|||
ogs_pkbuf_t *n2smbuf = NULL;
|
||||
#endif
|
||||
|
||||
amf_ue = sess->amf_ue;
|
||||
ogs_assert(amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("[%d:%d] UE context has already been removed [%d]",
|
||||
sess->psi, sess->pti, recvmsg->res_status);
|
||||
r = ngap_send_error_indication2(ran_ue,
|
||||
NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
SmContextUpdateError = recvmsg->SmContextUpdateError;
|
||||
if (!SmContextUpdateError) {
|
||||
|
|
@ -1072,20 +1082,18 @@ int amf_nsmf_pdusession_handle_release_sm_context(amf_sess_t *sess, int state)
|
|||
amf_ue_t *amf_ue = NULL;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
|
||||
ogs_assert(sess);
|
||||
sess = amf_sess_cycle(sess);
|
||||
if (!sess) {
|
||||
ogs_error("Session has already been removed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf_ue) Context has already been removed");
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
ran_ue = ran_ue_cycle(sess->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(sess->ran_ue_id);
|
||||
|
||||
/*
|
||||
* To check if Reactivation Request has been used.
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ int amf_nudm_sdm_handle_provisioned(
|
|||
if (amf_update_allowed_nssai(amf_ue) == false) {
|
||||
ogs_error("No Allowed-NSSAI");
|
||||
r = nas_5gs_send_gmm_reject(
|
||||
amf_ue->ran_ue, amf_ue,
|
||||
ran_ue_find_by_id(amf_ue->ran_ue_id), amf_ue,
|
||||
OGS_5GMM_CAUSE_NO_NETWORK_SLICES_AVAILABLE);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
|
@ -154,7 +154,7 @@ int amf_nudm_sdm_handle_provisioned(
|
|||
if (amf_ue_is_rat_restricted(amf_ue)) {
|
||||
ogs_error("Registration rejected due to RAT restrictions");
|
||||
r = nas_5gs_send_gmm_reject(
|
||||
amf_ue->ran_ue, amf_ue,
|
||||
ran_ue_find_by_id(amf_ue->ran_ue_id), amf_ue,
|
||||
OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ int amf_ue_sbi_discover_and_send(
|
|||
}
|
||||
|
||||
xact = ogs_sbi_xact_add(
|
||||
&amf_ue->sbi, service_type, discovery_option,
|
||||
amf_ue->id, &amf_ue->sbi, service_type, discovery_option,
|
||||
(ogs_sbi_build_f)build, amf_ue, data);
|
||||
if (!xact) {
|
||||
ogs_error("amf_ue_sbi_discover_and_send() failed");
|
||||
|
|
@ -169,21 +169,18 @@ int amf_sess_sbi_discover_and_send(
|
|||
ogs_assert(build);
|
||||
|
||||
if (ran_ue) {
|
||||
sess->ran_ue = ran_ue_cycle(ran_ue);
|
||||
if (!sess->ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
sess->ran_ue_id = ran_ue->id;
|
||||
} else
|
||||
sess->ran_ue = NULL;
|
||||
sess->ran_ue_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
xact = ogs_sbi_xact_add(
|
||||
&sess->sbi, service_type, discovery_option,
|
||||
sess->id, &sess->sbi, service_type, discovery_option,
|
||||
(ogs_sbi_build_f)build, sess, data);
|
||||
if (!xact) {
|
||||
ogs_error("amf_sess_sbi_discover_and_send() failed");
|
||||
r = nas_5gs_send_back_gsm_message(sess->ran_ue, sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
|
||||
r = nas_5gs_send_back_gsm_message(
|
||||
ran_ue_find_by_id(sess->ran_ue_id), sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return OGS_ERROR;
|
||||
|
|
@ -195,8 +192,9 @@ int amf_sess_sbi_discover_and_send(
|
|||
if (rv != OGS_OK) {
|
||||
ogs_error("amf_sess_sbi_discover_and_send() failed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
r = nas_5gs_send_back_gsm_message(sess->ran_ue, sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
|
||||
r = nas_5gs_send_back_gsm_message(
|
||||
ran_ue_find_by_id(sess->ran_ue_id), sess,
|
||||
OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
|
||||
ogs_expect(r == OGS_OK);
|
||||
ogs_assert(r != OGS_ERROR);
|
||||
return rv;
|
||||
|
|
@ -211,7 +209,7 @@ static int client_discover_cb(
|
|||
ogs_sbi_message_t message;
|
||||
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
ogs_pool_id_t xact_id = 0;
|
||||
ogs_pool_id_t xact_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
|
||||
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
|
||||
ogs_sbi_discovery_option_t *discovery_option = NULL;
|
||||
|
|
@ -230,16 +228,13 @@ static int client_discover_cb(
|
|||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
sess = (amf_sess_t *)xact->sbi_object;
|
||||
ogs_assert(sess);
|
||||
|
||||
service_type = xact->service_type;
|
||||
ogs_assert(service_type);
|
||||
requester_nf_type = xact->requester_nf_type;
|
||||
ogs_assert(requester_nf_type);
|
||||
discovery_option = xact->discovery_option;
|
||||
|
||||
sess = amf_sess_cycle(sess);
|
||||
sess = amf_sess_find_by_id(xact->sbi_object_id);
|
||||
if (!sess) {
|
||||
ogs_error("Session has already been removed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
|
|
@ -249,7 +244,7 @@ static int client_discover_cb(
|
|||
}
|
||||
|
||||
ogs_assert(sess->sbi.type == OGS_SBI_OBJ_SESS_TYPE);
|
||||
amf_ue = amf_ue_cycle(sess->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(sess->amf_ue_id);
|
||||
if (!amf_ue) {
|
||||
ogs_error("UE(amf-ue) context has already been removed");
|
||||
ogs_sbi_xact_remove(xact);
|
||||
|
|
@ -257,7 +252,7 @@ static int client_discover_cb(
|
|||
ogs_sbi_response_free(response);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ran_ue = ran_ue_cycle(sess->ran_ue);
|
||||
ran_ue = ran_ue_find_by_id(sess->ran_ue_id);
|
||||
if (!ran_ue) {
|
||||
ogs_error("[%s] NG context has already been removed", amf_ue->supi);
|
||||
ogs_sbi_xact_remove(xact);
|
||||
|
|
@ -368,16 +363,13 @@ int amf_sess_sbi_discover_by_nsi(
|
|||
ogs_sbi_service_type_to_name(service_type));
|
||||
|
||||
if (ran_ue) {
|
||||
sess->ran_ue = ran_ue_cycle(ran_ue);
|
||||
if (!sess->ran_ue) {
|
||||
ogs_error("NG context has already been removed");
|
||||
return OGS_NOTFOUND;
|
||||
}
|
||||
sess->ran_ue_id = ran_ue->id;
|
||||
} else
|
||||
sess->ran_ue = NULL;
|
||||
sess->ran_ue_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
xact = ogs_sbi_xact_add(
|
||||
&sess->sbi, service_type, discovery_option, NULL, NULL, NULL);
|
||||
sess->id, &sess->sbi,
|
||||
service_type, discovery_option, NULL, NULL, NULL);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_sbi_xact_add() failed");
|
||||
return OGS_ERROR;
|
||||
|
|
@ -459,7 +451,7 @@ void amf_sbi_send_deactivate_all_ue_in_gnb(amf_gnb_t *gnb, int state)
|
|||
ogs_list_for_each_safe(&gnb->ran_ue_list, ran_ue_next, ran_ue) {
|
||||
int old_xact_count = 0, new_xact_count = 0;
|
||||
|
||||
amf_ue = amf_ue_cycle(ran_ue->amf_ue);
|
||||
amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id);
|
||||
|
||||
if (amf_ue) {
|
||||
old_xact_count = amf_sess_xact_count(amf_ue);
|
||||
|
|
|
|||
|
|
@ -49,9 +49,6 @@ static amf_timer_cfg_t g_amf_timer_cfg[MAX_NUM_OF_AMF_TIMER] = {
|
|||
{ .have = true, .duration = ogs_time_from_sec(30) },
|
||||
};
|
||||
|
||||
static void gmm_timer_event_send(
|
||||
amf_timer_e timer_id, amf_ue_t *amf_ue);
|
||||
|
||||
amf_timer_cfg_t *amf_timer_cfg(amf_timer_e id)
|
||||
{
|
||||
ogs_assert(id < MAX_NUM_OF_AMF_TIMER);
|
||||
|
|
@ -124,16 +121,17 @@ void amf_timer_ng_delayed_send(void *data)
|
|||
}
|
||||
|
||||
static void gmm_timer_event_send(
|
||||
amf_timer_e timer_id, amf_ue_t *amf_ue)
|
||||
amf_timer_e timer_id, void *data)
|
||||
{
|
||||
int rv;
|
||||
amf_event_t *e = NULL;
|
||||
ogs_assert(amf_ue);
|
||||
|
||||
ogs_assert(data);
|
||||
|
||||
e = amf_event_new(AMF_EVENT_5GMM_TIMER);
|
||||
ogs_assert(e);
|
||||
e->h.timer_id = timer_id;
|
||||
e->amf_ue = amf_ue;
|
||||
e->amf_ue_id = OGS_POINTER_TO_UINT(data);
|
||||
|
||||
rv = ogs_queue_push(ogs_app()->queue, e);
|
||||
if (rv != OGS_OK) {
|
||||
|
|
@ -172,16 +170,14 @@ void amf_timer_ng_holding_timer_expire(void *data)
|
|||
{
|
||||
int rv;
|
||||
amf_event_t *e = NULL;
|
||||
ran_ue_t *ran_ue = NULL;
|
||||
|
||||
ogs_assert(data);
|
||||
ran_ue = data;
|
||||
|
||||
e = amf_event_new(AMF_EVENT_NGAP_TIMER);
|
||||
ogs_assert(e);
|
||||
|
||||
e->h.timer_id = AMF_TIMER_NG_HOLDING;
|
||||
e->ran_ue = ran_ue;
|
||||
e->ran_ue_id = OGS_POINTER_TO_UINT(data);
|
||||
|
||||
rv = ogs_queue_push(ogs_app()->queue, e);
|
||||
if (rv != OGS_OK) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
|
|||
int rv;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
|
@ -47,7 +47,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
|
|||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
ogs_pool_id_t sbi_xact_id = 0;
|
||||
ogs_pool_id_t sbi_xact_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
ausf_ue_t *ausf_ue = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ int ausf_sbi_discover_and_send(
|
|||
ogs_assert(build);
|
||||
|
||||
xact = ogs_sbi_xact_add(
|
||||
&ausf_ue->sbi, service_type, discovery_option,
|
||||
0, &ausf_ue->sbi, service_type, discovery_option,
|
||||
(ogs_sbi_build_f)build, ausf_ue, data);
|
||||
if (!xact) {
|
||||
ogs_error("ausf_sbi_discover_and_send() failed");
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
|
|||
ausf_ue_t *ausf_ue = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
|
||||
ogs_assert(s);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ void bsf_state_operational(ogs_fsm_t *s, bsf_event_t *e)
|
|||
bsf_sess_t *sess = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
|
@ -52,7 +52,7 @@ void bsf_state_operational(ogs_fsm_t *s, bsf_event_t *e)
|
|||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
ogs_pool_id_t sbi_xact_id = 0;
|
||||
ogs_pool_id_t sbi_xact_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
bsf_sm_debug(e);
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ int bsf_sbi_discover_and_send(
|
|||
ogs_assert(build);
|
||||
|
||||
xact = ogs_sbi_xact_add(
|
||||
&sess->sbi, service_type, discovery_option,
|
||||
0, &sess->sbi, service_type, discovery_option,
|
||||
(ogs_sbi_build_f)build, sess, data);
|
||||
if (!xact) {
|
||||
ogs_error("bsf_sbi_discover_and_send() failed");
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e)
|
|||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
|
||||
ogs_assert(s);
|
||||
|
|
@ -185,7 +185,7 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
|
|||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
|
|||
{
|
||||
int rv;
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ void nssf_state_operational(ogs_fsm_t *s, nssf_event_t *e)
|
|||
const char *api_version = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ void pcf_state_operational(ogs_fsm_t *s, pcf_event_t *e)
|
|||
int rv;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
|
@ -49,7 +49,7 @@ void pcf_state_operational(ogs_fsm_t *s, pcf_event_t *e)
|
|||
|
||||
ogs_sbi_object_t *sbi_object = NULL;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
ogs_pool_id_t sbi_xact_id = 0;
|
||||
ogs_pool_id_t sbi_xact_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ static int pcf_sbi_discover_and_send(
|
|||
ogs_assert(build);
|
||||
|
||||
xact = ogs_sbi_xact_add(
|
||||
sbi_object, service_type, discovery_option,
|
||||
0, sbi_object, service_type, discovery_option,
|
||||
build, context, data);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_sbi_xact_add() failed");
|
||||
|
|
@ -194,7 +194,8 @@ int pcf_sess_sbi_discover_only(
|
|||
ogs_assert(sess);
|
||||
ogs_assert(service_type);
|
||||
|
||||
xact = ogs_sbi_xact_add(&sess->sbi, service_type, NULL, NULL, NULL, NULL);
|
||||
xact = ogs_sbi_xact_add(
|
||||
0, &sess->sbi, service_type, NULL, NULL, NULL, NULL);
|
||||
if (!xact) {
|
||||
ogs_error("ogs_sbi_xact_add() failed");
|
||||
return OGS_ERROR;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ static int request_handler(ogs_sbi_request_t *request, void *data)
|
|||
ogs_sbi_client_t *client = NULL, *nrf_client = NULL, *next_scp = NULL;
|
||||
ogs_sbi_client_t *sepp_client = NULL;
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
|
||||
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
|
||||
|
|
@ -631,7 +631,7 @@ static int response_handler(
|
|||
{
|
||||
scp_assoc_t *assoc = data;
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
ogs_assert(assoc);
|
||||
|
||||
|
|
@ -689,7 +689,7 @@ static int nf_discover_handler(
|
|||
|
||||
scp_assoc_t *assoc = data;
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
|
||||
|
|
@ -846,7 +846,7 @@ static int sepp_discover_handler(
|
|||
|
||||
scp_assoc_t *assoc = data;
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void scp_state_operational(ogs_fsm_t *s, scp_event_t *e)
|
|||
int rv;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
|
@ -48,7 +48,7 @@ void scp_state_operational(ogs_fsm_t *s, scp_event_t *e)
|
|||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
ogs_pool_id_t sbi_xact_id = 0;
|
||||
ogs_pool_id_t sbi_xact_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
scp_sm_debug(e);
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void sepp_handshake_state_will_establish(ogs_fsm_t *s, sepp_event_t *e)
|
|||
sepp_node_t *sepp_node = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
|
||||
ogs_assert(s);
|
||||
|
|
@ -291,7 +291,7 @@ void sepp_handshake_state_established(ogs_fsm_t *s, sepp_event_t *e)
|
|||
sepp_node_t *sepp_node = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
|
||||
ogs_assert(s);
|
||||
|
|
@ -438,7 +438,7 @@ void sepp_handshake_state_terminated(ogs_fsm_t *s, sepp_event_t *e)
|
|||
sepp_node_t *sepp_node = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
|
||||
ogs_assert(s);
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ static int request_handler(ogs_sbi_request_t *request, void *data)
|
|||
ogs_hash_index_t *hi;
|
||||
ogs_sbi_client_t *client = NULL, *scp_client = NULL;
|
||||
ogs_sbi_stream_t *stream = data;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_server_t *server = NULL;
|
||||
|
||||
ogs_sbi_request_t sepp_request;
|
||||
|
|
@ -419,7 +419,7 @@ static int response_handler(
|
|||
{
|
||||
sepp_assoc_t *assoc = data;
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
ogs_assert(assoc);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ void sepp_state_operational(ogs_fsm_t *s, sepp_event_t *e)
|
|||
sepp_node_t *sepp_node = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
ogs_sbi_server_t *server = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ void smf_gsm_state_initial(ogs_fsm_t *s, smf_event_t *e)
|
|||
ogs_nas_5gs_message_t *nas_message = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *sbi_message = NULL;
|
||||
|
||||
ogs_assert(s);
|
||||
|
|
@ -463,7 +463,7 @@ void smf_gsm_state_wait_5gc_sm_policy_association(ogs_fsm_t *s, smf_event_t *e)
|
|||
smf_sess_t *sess = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *sbi_message = NULL;
|
||||
|
||||
int state = 0;
|
||||
|
|
@ -759,7 +759,7 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
|
|||
ogs_nas_5gs_message_t *nas_message = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *sbi_message = NULL;
|
||||
|
||||
ogs_gtp1_message_t *gtp1_message = NULL;
|
||||
|
|
@ -1315,7 +1315,7 @@ void smf_gsm_state_wait_pfcp_deletion(ogs_fsm_t *s, smf_event_t *e)
|
|||
smf_sess_t *sess = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *sbi_message = NULL;
|
||||
|
||||
ogs_pfcp_xact_t *pfcp_xact = NULL;
|
||||
|
|
@ -1657,7 +1657,7 @@ void smf_gsm_state_wait_5gc_n1_n2_release(ogs_fsm_t *s, smf_event_t *e)
|
|||
ogs_nas_5gs_message_t *nas_message = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *sbi_message = NULL;
|
||||
|
||||
ogs_assert(s);
|
||||
|
|
@ -2028,7 +2028,7 @@ void smf_gsm_state_5gc_session_will_deregister(ogs_fsm_t *s, smf_event_t *e)
|
|||
smf_sess_t *sess = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *sbi_message = NULL;
|
||||
|
||||
ogs_assert(s);
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ int smf_sbi_discover_and_send(
|
|||
}
|
||||
|
||||
xact = ogs_sbi_xact_add(
|
||||
&sess->sbi, service_type, discovery_option,
|
||||
0, &sess->sbi, service_type, discovery_option,
|
||||
(ogs_sbi_build_f)build, sess, data);
|
||||
if (!xact) {
|
||||
ogs_error("smf_sbi_discover_and_send() failed");
|
||||
|
|
@ -256,7 +256,7 @@ void smf_namf_comm_send_n1_n2_message_transfer(
|
|||
discovery_option, sess->serving_nf_id);
|
||||
|
||||
xact = ogs_sbi_xact_add(
|
||||
&sess->sbi, OGS_SBI_SERVICE_TYPE_NAMF_COMM, discovery_option,
|
||||
0, &sess->sbi, OGS_SBI_SERVICE_TYPE_NAMF_COMM, discovery_option,
|
||||
(ogs_sbi_build_f)smf_namf_comm_build_n1_n2_message_transfer,
|
||||
sess, param);
|
||||
if (!xact) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
|
|||
ogs_pfcp_message_t *pfcp_message = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_request_t *sbi_request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
|
@ -78,7 +78,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
|
|||
ogs_sbi_response_t *sbi_response = NULL;
|
||||
ogs_sbi_message_t sbi_message;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
ogs_pool_id_t sbi_xact_id = 0;
|
||||
ogs_pool_id_t sbi_xact_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
ogs_nas_5gs_message_t nas_message;
|
||||
ogs_pkbuf_t *pkbuf = NULL;
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ static int udm_sbi_discover_and_send(
|
|||
ogs_assert(build);
|
||||
|
||||
xact = ogs_sbi_xact_add(
|
||||
sbi_object, service_type, discovery_option,
|
||||
0, sbi_object, service_type, discovery_option,
|
||||
(ogs_sbi_build_f)build, context, data);
|
||||
if (!xact) {
|
||||
ogs_error("udm_sbi_discover_and_send() failed");
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void udm_sess_state_operational(ogs_fsm_t *s, udm_event_t *e)
|
|||
udm_sess_t *sess = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
|
||||
ogs_assert(s);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
|
|||
const char *api_version = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
|
@ -48,7 +48,7 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
|
|||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_message_t message;
|
||||
ogs_sbi_xact_t *sbi_xact = NULL;
|
||||
ogs_pool_id_t sbi_xact_id = 0;
|
||||
ogs_pool_id_t sbi_xact_id = OGS_INVALID_POOL_ID;
|
||||
|
||||
udm_ue_t *udm_ue = NULL;
|
||||
udm_sess_t *sess = NULL;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ void udm_ue_state_operational(ogs_fsm_t *s, udm_event_t *e)
|
|||
udm_ue_t *udm_ue = NULL;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_message_t *message = NULL;
|
||||
int r;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e)
|
|||
int rv;
|
||||
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_pool_id_t stream_id = 0;
|
||||
ogs_pool_id_t stream_id = OGS_INVALID_POOL_ID;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void af_sbi_discover_and_send(
|
|||
ogs_assert(build);
|
||||
|
||||
xact = ogs_sbi_xact_add(
|
||||
&sess->sbi, service_type, discovery_option,
|
||||
0, &sess->sbi, service_type, discovery_option,
|
||||
(ogs_sbi_build_f)build, sess, data);
|
||||
if (!xact) {
|
||||
ogs_error("af_sbi_discover_and_send() failed");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue