Follow-up on #1757

This commit is contained in:
Sukchan Lee 2022-09-23 20:42:04 +09:00
parent d3d4e5ce60
commit 2b8db5d488
13 changed files with 38 additions and 22 deletions

View File

@ -81,7 +81,7 @@ extern "C" {
#define OGS_MAX_PCO_LEN 251
#define OGS_MAX_FQDN_LEN 256
#define MAX_NUM_OF_SERVED_GUAMI 8
#define OGS_MAX_NUM_OF_SERVED_GUAMI 8
#define OGS_MAX_NUM_OF_SERVED_TAI 16
#define OGS_MAX_NUM_OF_ALGORITHM 8

View File

@ -1189,6 +1189,11 @@ ogs_sbi_nf_info_t *ogs_sbi_nf_info_add(
return nf_info;
}
static void amf_info_free(ogs_sbi_amf_info_t *amf_info)
{
/* Nothing */
}
static void smf_info_free(ogs_sbi_smf_info_t *smf_info)
{
int i, j;
@ -1214,6 +1219,9 @@ void ogs_sbi_nf_info_remove(ogs_list_t *list, ogs_sbi_nf_info_t *nf_info)
ogs_list_remove(list, nf_info);
switch(nf_info->nf_type) {
case OpenAPI_nf_type_AMF:
amf_info_free(&nf_info->amf);
break;
case OpenAPI_nf_type_SMF:
smf_info_free(&nf_info->smf);
break;

View File

@ -260,7 +260,7 @@ typedef struct ogs_sbi_amf_info_s {
int amf_region_id;
int num_of_guami;
ogs_guami_t guami[MAX_NUM_OF_SERVED_GUAMI];
ogs_guami_t guami[OGS_MAX_NUM_OF_SERVED_GUAMI];
int num_of_nr_tai;
ogs_5gs_tai_t nr_tai[OGS_MAX_NUM_OF_TAI];

View File

@ -891,7 +891,17 @@ static void free_amf_info(OpenAPI_amf_info_t *AmfInfo)
guamiAmfInfoList = AmfInfo->guami_list;
OpenAPI_list_for_each(guamiAmfInfoList, node) {
guamiAmfInfoItem = node->data;
ogs_assert(guamiAmfInfoItem);
if (guamiAmfInfoItem) {
if (guamiAmfInfoItem->plmn_id) {
if (guamiAmfInfoItem->plmn_id->mcc)
ogs_free(guamiAmfInfoItem->plmn_id->mcc);
if (guamiAmfInfoItem->plmn_id->mnc)
ogs_free(guamiAmfInfoItem->plmn_id->mnc);
ogs_free(guamiAmfInfoItem->plmn_id);
}
if (guamiAmfInfoItem->amf_id)
ogs_free(guamiAmfInfoItem->amf_id);
}
ogs_free(guamiAmfInfoItem);
}

View File

@ -180,8 +180,6 @@ int amf_context_parse_config(void)
int rv;
yaml_document_t *document = NULL;
ogs_yaml_iter_t root_iter;
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_nf_info_t *nf_info = NULL;
document = ogs_app()->document;
ogs_assert(document);
@ -332,7 +330,7 @@ int amf_context_parse_config(void)
const char *region = NULL, *set = NULL;
const char *pointer = NULL;
ogs_assert(self.num_of_served_guami <
MAX_NUM_OF_SERVED_GUAMI);
OGS_MAX_NUM_OF_SERVED_GUAMI);
if (ogs_yaml_iter_type(&guami_array) ==
YAML_MAPPING_NODE) {
@ -833,6 +831,17 @@ int amf_context_parse_config(void)
}
}
rv = amf_context_validation();
if (rv != OGS_OK) return rv;
return OGS_OK;
}
int amf_context_nf_info(void)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_nf_info_t *nf_info = NULL;
int served_i, next_new_i, info_i;
bool next_found;
served_i = 0;
@ -916,9 +925,6 @@ int amf_context_parse_config(void)
}
} while (next_found);
rv = amf_context_validation();
if (rv != OGS_OK) return rv;
return OGS_OK;
}

View File

@ -48,7 +48,7 @@ typedef uint32_t amf_m_tmsi_t;
typedef struct amf_context_s {
/* Served GUAMI */
uint8_t num_of_served_guami;
ogs_guami_t served_guami[MAX_NUM_OF_SERVED_GUAMI];
ogs_guami_t served_guami[OGS_MAX_NUM_OF_SERVED_GUAMI];
/* Served TAI */
uint8_t num_of_served_tai;
@ -611,6 +611,7 @@ void amf_context_final(void);
amf_context_t *amf_self(void);
int amf_context_parse_config(void);
int amf_context_nf_info(void);
amf_gnb_t *amf_gnb_add(ogs_sock_t *sock, ogs_sockaddr_t *addr);
void amf_gnb_remove(amf_gnb_t *gnb);

View File

@ -43,6 +43,9 @@ int amf_initialize()
rv = amf_context_parse_config();
if (rv != OGS_OK) return rv;
rv = amf_context_nf_info();
if (rv != OGS_OK) return rv;
rv = amf_m_tmsi_pool_generate();
if (rv != OGS_OK) return rv;

View File

@ -30,8 +30,6 @@
extern "C" {
#endif
#define MAX_NUM_OF_SERVED_GUAMI 8
extern int __ausf_log_domain;
#undef OGS_LOG_DOMAIN

View File

@ -29,8 +29,6 @@
extern "C" {
#endif
#define MAX_NUM_OF_SERVED_GUAMI 8
extern int __nssf_log_domain;
#undef OGS_LOG_DOMAIN

View File

@ -31,8 +31,6 @@
extern "C" {
#endif
#define MAX_NUM_OF_SERVED_GUAMI 8
extern int __pcf_log_domain;
#undef OGS_LOG_DOMAIN

View File

@ -30,8 +30,6 @@
extern "C" {
#endif
#define MAX_NUM_OF_SERVED_GUAMI 8
extern int __udm_log_domain;
#undef OGS_LOG_DOMAIN

View File

@ -30,8 +30,6 @@
extern "C" {
#endif
#define MAX_NUM_OF_SERVED_GUAMI 8
extern int __udr_log_domain;
#undef OGS_LOG_DOMAIN

View File

@ -36,8 +36,6 @@ extern "C" {
#define TEST_PING_IPV4 "10.45.0.1"
#define TEST_PING_IPV6 "2001:db8:cafe::1"
#define MAX_NUM_OF_SERVED_GUAMI 8
#define TEST_MSISDN "491725670014"
#define TEST_ADDITIONAL_MSISDN "491725670015"