From 2031f7d8a1ed9d969be9a5a14bf7d097deb5aaff Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Fri, 1 Nov 2024 15:32:46 +0900 Subject: [PATCH] [SBI] Make 'global' configuration optional instead of mandatory (#3466) Previously, the global configuration section was required for NF to start, which differed from earlier versions where it was optional. This commit modifies the implementation to make the global section optional again, allowing NF to start without explicitly defining global settings. This change restores the previous behavior and improves usability for users who do not need to customize global settings. --- lib/app/ogs-config.c | 5 +---- lib/app/ogs-config.h | 1 + lib/app/ogs-init.c | 5 +++++ lib/core/ogs-epoll.c | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/app/ogs-config.c b/lib/app/ogs-config.c index 9a374770a..68287bc14 100644 --- a/lib/app/ogs-config.c +++ b/lib/app/ogs-config.c @@ -105,7 +105,7 @@ ogs_app_local_conf_t *ogs_local_conf(void) return &local_conf; } -static int global_conf_prepare(void) +int ogs_app_global_conf_prepare(void) { global_conf.sockopt.no_delay = true; @@ -165,9 +165,6 @@ int ogs_app_parse_global_conf(ogs_yaml_iter_t *parent) ogs_assert(parent); - rv = global_conf_prepare(); - if (rv != OGS_OK) return rv; - ogs_yaml_iter_recurse(parent, &global_iter); while (ogs_yaml_iter_next(&global_iter)) { const char *global_key = ogs_yaml_iter_key(&global_iter); diff --git a/lib/app/ogs-config.h b/lib/app/ogs-config.h index 3280208ea..2086d9b98 100644 --- a/lib/app/ogs-config.h +++ b/lib/app/ogs-config.h @@ -174,6 +174,7 @@ ogs_app_global_conf_t *ogs_global_conf(void); ogs_app_local_conf_t *ogs_local_conf(void); int ogs_app_count_nf_conf_sections(const char *conf_section); +int ogs_app_global_conf_prepare(void); int ogs_app_parse_global_conf(ogs_yaml_iter_t *parent); int ogs_app_parse_local_conf(const char *local); diff --git a/lib/app/ogs-init.c b/lib/app/ogs-init.c index 20f0872d3..7beb2b3df 100644 --- a/lib/app/ogs-init.c +++ b/lib/app/ogs-init.c @@ -257,9 +257,14 @@ static int read_config(void) static int context_prepare(void) { + int rv; + #define USRSCTP_LOCAL_UDP_PORT 9899 ogs_app()->usrsctp.udp_port = USRSCTP_LOCAL_UDP_PORT; + rv = ogs_app_global_conf_prepare(); + if (rv != OGS_OK) return rv; + return OGS_OK; } diff --git a/lib/core/ogs-epoll.c b/lib/core/ogs-epoll.c index cc9569a68..326ae2c0c 100644 --- a/lib/core/ogs-epoll.c +++ b/lib/core/ogs-epoll.c @@ -75,7 +75,8 @@ static void epoll_init(ogs_pollset_t *pollset) context->epfd = epoll_create(pollset->capacity); if (context->epfd < 0) { - ogs_log_message(OGS_LOG_FATAL, ogs_errno, "epoll_create() failed"); + ogs_log_message(OGS_LOG_FATAL, ogs_errno, + "epoll_create() failed [%d]", pollset->capacity); ogs_assert_if_reached(); return; }