forked from acouzens/open5gs
parent
ced37a6201
commit
12c656efd0
|
@ -669,26 +669,6 @@ ogs_slice_data_t *ogs_slice_find_by_s_nssai(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ogs_slice_data_t *ogs_slice_find_by_dnn(
|
||||
ogs_slice_data_t *slice_data, int num_of_slice_data, char *dnn)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
ogs_assert(slice_data);
|
||||
ogs_assert(num_of_slice_data);
|
||||
ogs_assert(dnn);
|
||||
|
||||
/* Compare DNN */
|
||||
for (i = 0; i < num_of_slice_data; i++) {
|
||||
for (j = 0; j < slice_data[i].num_of_session; j++) {
|
||||
if (strcmp(slice_data[i].session[j].name, dnn) == 0)
|
||||
return slice_data + i;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ogs_subscription_data_free(ogs_subscription_data_t *subscription_data)
|
||||
{
|
||||
int i, j;
|
||||
|
|
|
@ -653,8 +653,6 @@ typedef struct ogs_slice_data_s {
|
|||
ogs_slice_data_t *ogs_slice_find_by_s_nssai(
|
||||
ogs_slice_data_t *slice_data, int num_of_slice_data,
|
||||
ogs_s_nssai_t *s_nssai);
|
||||
ogs_slice_data_t *ogs_slice_find_by_dnn(
|
||||
ogs_slice_data_t *slice_data, int num_of_slice_data, char *dnn);
|
||||
|
||||
typedef struct ogs_subscription_data_s {
|
||||
#define OGS_ACCESS_RESTRICTION_UTRAN_NOT_ALLOWED (1)
|
||||
|
|
|
@ -951,11 +951,6 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
|
||||
switch (payload_container_type->value) {
|
||||
case OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION:
|
||||
nas_s_nssai = &ul_nas_transport->s_nssai;
|
||||
ogs_assert(nas_s_nssai);
|
||||
dnn = &ul_nas_transport->dnn;
|
||||
ogs_assert(dnn);
|
||||
|
||||
gsm_header = (ogs_nas_5gsm_header_t *)payload_container->buffer;
|
||||
ogs_assert(gsm_header);
|
||||
|
||||
|
@ -991,43 +986,78 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
if (gsm_header->message_type ==
|
||||
OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST) {
|
||||
|
||||
if (ul_nas_transport->presencemask &
|
||||
OGS_NAS_5GS_UL_NAS_TRANSPORT_S_NSSAI_PRESENT) {
|
||||
ogs_nas_s_nssai_ie_t ie;
|
||||
if (ogs_nas_parse_s_nssai(&ie, nas_s_nssai) != 0) {
|
||||
selected_slice = ogs_slice_find_by_s_nssai(
|
||||
amf_ue->slice, amf_ue->num_of_slice,
|
||||
(ogs_s_nssai_t *)&ie);
|
||||
int i, j, k;
|
||||
|
||||
nas_s_nssai = &ul_nas_transport->s_nssai;
|
||||
ogs_assert(nas_s_nssai);
|
||||
dnn = &ul_nas_transport->dnn;
|
||||
ogs_assert(dnn);
|
||||
|
||||
|
||||
for (i = 0; i < amf_ue->num_of_slice; i++) {
|
||||
if (ul_nas_transport->presencemask &
|
||||
OGS_NAS_5GS_UL_NAS_TRANSPORT_S_NSSAI_PRESENT) {
|
||||
ogs_nas_s_nssai_ie_t ie;
|
||||
if (ogs_nas_parse_s_nssai(&ie, nas_s_nssai) != 0) {
|
||||
if (ie.sst == amf_ue->slice[i].s_nssai.sst &&
|
||||
ie.sd.v == amf_ue->slice[i].s_nssai.sd.v) {
|
||||
|
||||
/* PASS */
|
||||
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (j = 0; j < amf_ue->allowed_nssai.num_of_s_nssai; j++) {
|
||||
if (amf_ue->slice[i].s_nssai.sst ==
|
||||
amf_ue->allowed_nssai.s_nssai[j].sst &&
|
||||
amf_ue->slice[i].s_nssai.sd.v ==
|
||||
amf_ue->allowed_nssai.s_nssai[j].sd.v) {
|
||||
|
||||
if (ul_nas_transport->presencemask &
|
||||
OGS_NAS_5GS_UL_NAS_TRANSPORT_DNN_PRESENT) {
|
||||
if (sess->dnn)
|
||||
ogs_free(sess->dnn);
|
||||
sess->dnn = ogs_strdup(dnn->value);
|
||||
ogs_assert(sess->dnn);
|
||||
if (ul_nas_transport->presencemask &
|
||||
OGS_NAS_5GS_UL_NAS_TRANSPORT_DNN_PRESENT) {
|
||||
|
||||
if (!selected_slice) {
|
||||
selected_slice = ogs_slice_find_by_dnn(
|
||||
amf_ue->slice, amf_ue->num_of_slice, sess->dnn);
|
||||
}
|
||||
}
|
||||
for (k = 0;
|
||||
k < amf_ue->slice[i].num_of_session; k++) {
|
||||
if (!strcmp(dnn->value,
|
||||
amf_ue->slice[i].session[k].name)) {
|
||||
|
||||
if (!selected_slice) {
|
||||
int i;
|
||||
for (i = 0; i < amf_ue->num_of_slice; i++) {
|
||||
if (amf_ue->slice[i].default_indicator == true) {
|
||||
selected_slice = &amf_ue->slice[i];
|
||||
selected_slice = amf_ue->slice + i;
|
||||
ogs_assert(selected_slice);
|
||||
|
||||
if (sess->dnn)
|
||||
ogs_free(sess->dnn);
|
||||
sess->dnn = ogs_strdup(dnn->value);
|
||||
ogs_assert(sess->dnn);
|
||||
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
selected_slice = amf_ue->slice + i;
|
||||
ogs_assert(selected_slice);
|
||||
|
||||
if (selected_slice->num_of_session) {
|
||||
if (sess->dnn)
|
||||
ogs_free(sess->dnn);
|
||||
sess->dnn = ogs_strdup(
|
||||
selected_slice->session[0].name);
|
||||
ogs_assert(sess->dnn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!selected_slice) {
|
||||
ogs_error("[%s] No S-NSSAI", amf_ue->supi);
|
||||
if (!selected_slice || !sess->dnn) {
|
||||
ogs_warn("[%s] DNN Not Supporetd OR "
|
||||
"Not Subscribed in the Slice", amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_status(amf_ue,
|
||||
OGS_5GMM_CAUSE_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE));
|
||||
nas_5gs_send_gmm_status(amf_ue, OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE));
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -1035,20 +1065,6 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
sess->s_nssai.sst = selected_slice->s_nssai.sst;
|
||||
sess->s_nssai.sd.v = selected_slice->s_nssai.sd.v;
|
||||
|
||||
if (!sess->dnn) {
|
||||
if (selected_slice->num_of_session) {
|
||||
sess->dnn = ogs_strdup(selected_slice->session[0].name);
|
||||
ogs_assert(sess->dnn);
|
||||
}
|
||||
}
|
||||
|
||||
if (!sess->dnn) {
|
||||
ogs_error("[%s] No DNN", amf_ue->supi);
|
||||
ogs_assert(OGS_OK ==
|
||||
nas_5gs_send_gmm_status(amf_ue, OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE));
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
ogs_info("UE SUPI[%s] DNN[%s] S_NSSAI[SST:%d SD:0x%x]",
|
||||
amf_ue->supi, sess->dnn, sess->s_nssai.sst, sess->s_nssai.sd.v);
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ void testgmm_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf)
|
|||
case OGS_NAS_5GS_DL_NAS_TRANSPORT:
|
||||
testgmm_handle_dl_nas_transport(test_ue, &message.gmm.dl_nas_transport);
|
||||
break;
|
||||
case OGS_NAS_5GS_5GMM_STATUS:
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown message[%d]", message.gmm.h.message_type);
|
||||
break;
|
||||
|
|
|
@ -1923,10 +1923,16 @@ static void test5_func(abts_case *tc, void *data)
|
|||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive PDU session establishment reject */
|
||||
/* Receive 5GMM Status */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(test_ue, recvbuf);
|
||||
ABTS_INT_EQUAL(tc,
|
||||
NGAP_ProcedureCode_id_DownlinkNASTransport,
|
||||
test_ue->ngap_procedure_code);
|
||||
ABTS_INT_EQUAL(tc,
|
||||
OGS_NAS_5GS_5GMM_STATUS,
|
||||
test_ue->gmm_message_type);
|
||||
|
||||
/* Send De-registration request */
|
||||
gmmbuf = testgmm_build_de_registration_request(test_ue, 1, true, true);
|
||||
|
@ -2194,10 +2200,16 @@ static void test6_func(abts_case *tc, void *data)
|
|||
rv = testgnb_ngap_send(ngap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Receive PDU session establishment reject */
|
||||
/* Receive 5GMM Status */
|
||||
recvbuf = testgnb_ngap_read(ngap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
testngap_recv(test_ue, recvbuf);
|
||||
ABTS_INT_EQUAL(tc,
|
||||
NGAP_ProcedureCode_id_DownlinkNASTransport,
|
||||
test_ue->ngap_procedure_code);
|
||||
ABTS_INT_EQUAL(tc,
|
||||
OGS_NAS_5GS_5GMM_STATUS,
|
||||
test_ue->gmm_message_type);
|
||||
|
||||
/* Remove All Test Session */
|
||||
test_sess_remove(sess6);
|
||||
|
|
Loading…
Reference in New Issue