forked from acouzens/open5gs
fix: AMF sets default DNN if UE does not send it.
This commit is contained in:
parent
171f15f684
commit
371e22c96b
|
@ -1157,6 +1157,11 @@ void amf_ue_remove(amf_ue_t *amf_ue)
|
|||
ogs_free(amf_ue->msisdn[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < amf_ue->num_of_subscribed_dnn; i++) {
|
||||
ogs_assert(amf_ue->subscribed_dnn[i]);
|
||||
ogs_free(amf_ue->subscribed_dnn[i]);
|
||||
}
|
||||
|
||||
if (amf_ue->policy_association_id)
|
||||
ogs_free(amf_ue->policy_association_id);
|
||||
|
||||
|
|
|
@ -342,6 +342,8 @@ struct amf_ue_s {
|
|||
uint8_t selected_int_algorithm;
|
||||
|
||||
ogs_bitrate_t subscribed_ue_ambr; /* UE-AMBR */
|
||||
int num_of_subscribed_dnn;
|
||||
char *subscribed_dnn[OGS_MAX_NUM_OF_DNN];
|
||||
|
||||
#define CM_CONNECTED(__aMF) \
|
||||
((__aMF) && ((__aMF)->ran_ue != NULL) && ran_ue_cycle((__aMF)->ran_ue))
|
||||
|
|
|
@ -802,6 +802,17 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
|
|||
sess->dnn = ogs_strdup(dnn->value);
|
||||
}
|
||||
|
||||
if (!sess->dnn) {
|
||||
if (amf_ue->num_of_subscribed_dnn) {
|
||||
sess->dnn = ogs_strdup(amf_ue->subscribed_dnn[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!sess->dnn) {
|
||||
ogs_fatal("No DNN : Set default DNN using WebUI");
|
||||
ogs_assert_if_reached();
|
||||
}
|
||||
|
||||
amf_sess_sbi_discover_and_send(OpenAPI_nf_type_SMF,
|
||||
sess, AMF_UPDATE_SM_CONTEXT_NO_STATE, NULL,
|
||||
amf_nsmf_pdu_session_build_create_sm_context);
|
||||
|
|
|
@ -31,25 +31,17 @@ int amf_nudm_sdm_handle_provisioned(
|
|||
SWITCH(recvmsg->h.resource.component[1])
|
||||
CASE(OGS_SBI_RESOURCE_NAME_AM_DATA)
|
||||
if (recvmsg->AccessAndMobilitySubscriptionData) {
|
||||
OpenAPI_ambr_rm_t *subscribed_ue_ambr =
|
||||
recvmsg->AccessAndMobilitySubscriptionData->
|
||||
subscribed_ue_ambr;
|
||||
OpenAPI_list_t *gpsiList =
|
||||
OpenAPI_list_t *GpsiList =
|
||||
recvmsg->AccessAndMobilitySubscriptionData->gpsis;
|
||||
OpenAPI_ambr_rm_t *SubscribedUeAmbr =
|
||||
recvmsg->AccessAndMobilitySubscriptionData->subscribed_ue_ambr;
|
||||
OpenAPI_list_t *SubscribedDnnList =
|
||||
recvmsg->AccessAndMobilitySubscriptionData->subscribed_dnn_list;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (subscribed_ue_ambr) {
|
||||
amf_ue->subscribed_ue_ambr.uplink =
|
||||
ogs_sbi_bitrate_from_string(
|
||||
subscribed_ue_ambr->uplink);
|
||||
amf_ue->subscribed_ue_ambr.downlink =
|
||||
ogs_sbi_bitrate_from_string(
|
||||
subscribed_ue_ambr->downlink);
|
||||
}
|
||||
|
||||
if (gpsiList) {
|
||||
if (GpsiList) {
|
||||
amf_ue->num_of_msisdn = 0;
|
||||
OpenAPI_list_for_each(gpsiList, node) {
|
||||
OpenAPI_list_for_each(GpsiList, node) {
|
||||
if (node->data) {
|
||||
char *gpsi = NULL;
|
||||
|
||||
|
@ -72,6 +64,23 @@ int amf_nudm_sdm_handle_provisioned(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SubscribedUeAmbr) {
|
||||
amf_ue->subscribed_ue_ambr.uplink =
|
||||
ogs_sbi_bitrate_from_string(SubscribedUeAmbr->uplink);
|
||||
amf_ue->subscribed_ue_ambr.downlink =
|
||||
ogs_sbi_bitrate_from_string(SubscribedUeAmbr->downlink);
|
||||
}
|
||||
|
||||
if (SubscribedDnnList) {
|
||||
OpenAPI_list_for_each(SubscribedDnnList, node) {
|
||||
if (node->data) {
|
||||
amf_ue->subscribed_dnn[amf_ue->num_of_subscribed_dnn] =
|
||||
ogs_strdup(node->data);
|
||||
amf_ue->num_of_subscribed_dnn++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
amf_ue_sbi_discover_and_send(OpenAPI_nf_type_UDM, amf_ue,
|
||||
|
|
|
@ -368,46 +368,58 @@ bool udr_nudr_dr_handle_subscription_provisioned(
|
|||
CASE(OGS_SBI_RESOURCE_NAME_AM_DATA)
|
||||
OpenAPI_access_and_mobility_subscription_data_t
|
||||
AccessAndMobilitySubscriptionData;
|
||||
OpenAPI_ambr_rm_t subscribed_ue_ambr;
|
||||
OpenAPI_list_t *gpsiList = NULL;
|
||||
OpenAPI_list_t *GpsiList = NULL;
|
||||
OpenAPI_ambr_rm_t SubscribedUeAmbr;
|
||||
OpenAPI_list_t *SubscribedDnnList = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
subscribed_ue_ambr.uplink = ogs_sbi_bitrate_to_string(
|
||||
subscription_data.ambr.uplink, OGS_SBI_BITRATE_KBPS);
|
||||
subscribed_ue_ambr.downlink = ogs_sbi_bitrate_to_string(
|
||||
subscription_data.ambr.downlink, OGS_SBI_BITRATE_KBPS);
|
||||
|
||||
gpsiList = OpenAPI_list_create();
|
||||
GpsiList = OpenAPI_list_create();
|
||||
|
||||
for (i = 0; i < subscription_data.num_of_msisdn; i++) {
|
||||
char *gpsi = ogs_msprintf("%s-%s",
|
||||
OGS_ID_GPSI_TYPE_MSISDN, subscription_data.msisdn[i].bcd);
|
||||
ogs_assert(gpsi);
|
||||
OpenAPI_list_add(gpsiList, gpsi);
|
||||
OpenAPI_list_add(GpsiList, gpsi);
|
||||
}
|
||||
|
||||
SubscribedUeAmbr.uplink = ogs_sbi_bitrate_to_string(
|
||||
subscription_data.ambr.uplink, OGS_SBI_BITRATE_KBPS);
|
||||
SubscribedUeAmbr.downlink = ogs_sbi_bitrate_to_string(
|
||||
subscription_data.ambr.downlink, OGS_SBI_BITRATE_KBPS);
|
||||
|
||||
SubscribedDnnList = OpenAPI_list_create();
|
||||
for (i = 0; i < subscription_data.num_of_pdn; i++) {
|
||||
OpenAPI_list_add(SubscribedDnnList, subscription_data.pdn[i].dnn);
|
||||
}
|
||||
|
||||
memset(&AccessAndMobilitySubscriptionData, 0,
|
||||
sizeof(AccessAndMobilitySubscriptionData));
|
||||
AccessAndMobilitySubscriptionData.subscribed_ue_ambr =
|
||||
&subscribed_ue_ambr;
|
||||
&SubscribedUeAmbr;
|
||||
|
||||
memset(&sendmsg, 0, sizeof(sendmsg));
|
||||
sendmsg.AccessAndMobilitySubscriptionData =
|
||||
&AccessAndMobilitySubscriptionData;
|
||||
|
||||
if (gpsiList->count)
|
||||
AccessAndMobilitySubscriptionData.gpsis = gpsiList;
|
||||
if (GpsiList->count)
|
||||
AccessAndMobilitySubscriptionData.gpsis = GpsiList;
|
||||
if (SubscribedDnnList->count)
|
||||
AccessAndMobilitySubscriptionData.subscribed_dnn_list =
|
||||
SubscribedDnnList;
|
||||
|
||||
response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_OK);
|
||||
ogs_assert(response);
|
||||
ogs_sbi_server_send_response(stream, response);
|
||||
|
||||
ogs_free(subscribed_ue_ambr.uplink);
|
||||
ogs_free(subscribed_ue_ambr.downlink);
|
||||
OpenAPI_list_for_each(gpsiList, node) {
|
||||
OpenAPI_list_for_each(GpsiList, node) {
|
||||
if (node->data) ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(gpsiList);
|
||||
OpenAPI_list_free(GpsiList);
|
||||
|
||||
ogs_free(SubscribedUeAmbr.uplink);
|
||||
ogs_free(SubscribedUeAmbr.downlink);
|
||||
|
||||
OpenAPI_list_free(SubscribedDnnList);
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
/* Send PDU session establishment request */
|
||||
sess->ul_nas_transport_param.request_type =
|
||||
OGS_NAS_5GS_REQUEST_TYPE_INITIAL;
|
||||
sess->ul_nas_transport_param.dnn = 1;
|
||||
sess->ul_nas_transport_param.dnn = 0;
|
||||
sess->ul_nas_transport_param.s_nssai = 1;
|
||||
|
||||
gsmbuf = testgsm_build_pdu_session_establishment_request(sess);
|
||||
|
|
Loading…
Reference in New Issue