forked from acouzens/open5gs
[ALL] Init updated for an Invalid IP (#938)
This commit is contained in:
parent
e459a85bc1
commit
793a82020f
|
@ -26,10 +26,10 @@ ogs_sock_t *ogs_gtp_server(ogs_socknode_t *node)
|
|||
ogs_assert(node);
|
||||
|
||||
gtp = ogs_udp_server(node);
|
||||
ogs_assert(gtp);
|
||||
|
||||
ogs_info("gtp_server() [%s]:%d",
|
||||
OGS_ADDR(node->addr, buf), OGS_PORT(node->addr));
|
||||
if (gtp) {
|
||||
ogs_info("gtp_server() [%s]:%d",
|
||||
OGS_ADDR(node->addr, buf), OGS_PORT(node->addr));
|
||||
}
|
||||
|
||||
return gtp;
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ ogs_sock_t *ogs_pfcp_server(ogs_socknode_t *node)
|
|||
ogs_assert(node);
|
||||
|
||||
pfcp = ogs_udp_server(node);
|
||||
ogs_assert(pfcp);
|
||||
|
||||
ogs_info("pfcp_server() [%s]:%d",
|
||||
OGS_ADDR(node->addr, buf), OGS_PORT(node->addr));
|
||||
if (pfcp) {
|
||||
ogs_info("pfcp_server() [%s]:%d",
|
||||
OGS_ADDR(node->addr, buf), OGS_PORT(node->addr));
|
||||
}
|
||||
|
||||
return pfcp;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ typedef int _MHD_Result;
|
|||
static void server_init(int num_of_session_pool, int num_of_stream_pool);
|
||||
static void server_final(void);
|
||||
|
||||
static void server_start(ogs_sbi_server_t *server,
|
||||
static int server_start(ogs_sbi_server_t *server,
|
||||
int (*cb)(ogs_sbi_request_t *request, void *data));
|
||||
static void server_stop(ogs_sbi_server_t *server);
|
||||
|
||||
|
@ -191,7 +191,7 @@ static void session_remove_all(ogs_sbi_server_t *server)
|
|||
session_remove(sbi_sess);
|
||||
}
|
||||
|
||||
static void server_start(ogs_sbi_server_t *server,
|
||||
static int server_start(ogs_sbi_server_t *server,
|
||||
int (*cb)(ogs_sbi_request_t *request, void *data))
|
||||
{
|
||||
char buf[OGS_ADDRSTRLEN];
|
||||
|
@ -254,7 +254,7 @@ static void server_start(ogs_sbi_server_t *server,
|
|||
MHD_OPTION_END);
|
||||
if (!server->mhd) {
|
||||
ogs_error("Cannot start SBI server");
|
||||
return;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
/* Setup poll for server listening socket */
|
||||
|
@ -270,6 +270,8 @@ static void server_start(ogs_sbi_server_t *server,
|
|||
ogs_info("mhd_server() [%s]:%d", hostname, OGS_PORT(addr));
|
||||
else
|
||||
ogs_info("mhd_server() [%s]:%d", OGS_ADDR(addr, buf), OGS_PORT(addr));
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
static void server_stop(ogs_sbi_server_t *server)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
static void server_init(int num_of_session_pool, int num_of_stream_pool);
|
||||
static void server_final(void);
|
||||
|
||||
static void server_start(ogs_sbi_server_t *server,
|
||||
static int server_start(ogs_sbi_server_t *server,
|
||||
int (*cb)(ogs_sbi_request_t *request, void *data));
|
||||
static void server_stop(ogs_sbi_server_t *server);
|
||||
|
||||
|
@ -112,7 +112,7 @@ static void server_final(void)
|
|||
ogs_pool_final(&session_pool);
|
||||
}
|
||||
|
||||
static void server_start(ogs_sbi_server_t *server,
|
||||
static int server_start(ogs_sbi_server_t *server,
|
||||
int (*cb)(ogs_sbi_request_t *request, void *data))
|
||||
{
|
||||
char buf[OGS_ADDRSTRLEN];
|
||||
|
@ -126,7 +126,7 @@ static void server_start(ogs_sbi_server_t *server,
|
|||
sock = ogs_tcp_server(&server->node);
|
||||
if (!sock) {
|
||||
ogs_error("Cannot start SBI server");
|
||||
return;
|
||||
return OGS_ERROR;
|
||||
}
|
||||
|
||||
/* Setup callback function */
|
||||
|
@ -143,6 +143,8 @@ static void server_start(ogs_sbi_server_t *server,
|
|||
else
|
||||
ogs_info("nghttp2_server() [%s]:%d",
|
||||
OGS_ADDR(addr, buf), OGS_PORT(addr));
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
static void server_stop(ogs_sbi_server_t *server)
|
||||
|
|
|
@ -108,13 +108,16 @@ void ogs_sbi_server_set_advertise(
|
|||
server->advertise = addr;
|
||||
}
|
||||
|
||||
void ogs_sbi_server_start_all(
|
||||
int ogs_sbi_server_start_all(
|
||||
int (*cb)(ogs_sbi_request_t *request, void *data))
|
||||
{
|
||||
ogs_sbi_server_t *server = NULL, *next_server = NULL;
|
||||
|
||||
ogs_list_for_each_safe(&ogs_sbi_self()->server_list, next_server, server)
|
||||
ogs_sbi_server_actions.start(server, cb);
|
||||
if (ogs_sbi_server_actions.start(server, cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
void ogs_sbi_server_stop_all(void)
|
||||
|
|
|
@ -49,7 +49,7 @@ typedef struct ogs_sbi_server_actions_s {
|
|||
void (*init)(int num_of_session_pool, int num_of_stream_pool);
|
||||
void (*cleanup)(void);
|
||||
|
||||
void (*start)(ogs_sbi_server_t *server,
|
||||
int (*start)(ogs_sbi_server_t *server,
|
||||
int (*cb)(ogs_sbi_request_t *request, void *data));
|
||||
void (*stop)(ogs_sbi_server_t *server);
|
||||
|
||||
|
@ -69,7 +69,7 @@ void ogs_sbi_server_remove_all(void);
|
|||
void ogs_sbi_server_set_advertise(
|
||||
ogs_sbi_server_t *server, int family, ogs_sockaddr_t *advertise);
|
||||
|
||||
void ogs_sbi_server_start_all(
|
||||
int ogs_sbi_server_start_all(
|
||||
int (*cb)(ogs_sbi_request_t *request, void *data));
|
||||
void ogs_sbi_server_stop_all(void);
|
||||
|
||||
|
|
|
@ -80,22 +80,9 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
|
|||
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = amf_sbi_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish SBI path");
|
||||
}
|
||||
|
||||
rv = ngap_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("Can't establish NGAP path");
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
ngap_close();
|
||||
amf_sbi_close();
|
||||
break;
|
||||
|
||||
case AMF_EVT_SBI_SERVER:
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "context.h"
|
||||
#include "sbi-path.h"
|
||||
#include "ngap-path.h"
|
||||
|
||||
static ogs_thread_t *thread;
|
||||
static void amf_main(void *data);
|
||||
|
@ -44,6 +45,12 @@ int amf_initialize()
|
|||
ogs_app()->logger.domain, ogs_app()->logger.level);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = amf_sbi_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = ngap_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
thread = ogs_thread_create(amf_main, NULL);
|
||||
if (!thread) return OGS_ERROR;
|
||||
|
||||
|
@ -77,6 +84,9 @@ void amf_terminate(void)
|
|||
{
|
||||
if (!initialized) return;
|
||||
|
||||
ngap_close();
|
||||
amf_sbi_close();
|
||||
|
||||
/* Daemon terminating */
|
||||
event_termination();
|
||||
ogs_thread_destroy(thread);
|
||||
|
|
|
@ -32,10 +32,10 @@ int ngap_open(void)
|
|||
ogs_socknode_t *node = NULL;
|
||||
|
||||
ogs_list_for_each(&amf_self()->ngap_list, node)
|
||||
ngap_server(node);
|
||||
if (ngap_server(node) == NULL) return OGS_ERROR;
|
||||
|
||||
ogs_list_for_each(&amf_self()->ngap_list6, node)
|
||||
ngap_server(node);
|
||||
if (ngap_server(node) == NULL) return OGS_ERROR;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
|
|
@ -39,14 +39,15 @@ ogs_sock_t *ngap_server(ogs_socknode_t *node)
|
|||
|
||||
#if HAVE_USRSCTP
|
||||
sock = ogs_sctp_server(SOCK_SEQPACKET, node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return NULL;
|
||||
usrsctp_set_non_blocking((struct socket *)sock, 1);
|
||||
usrsctp_set_upcall((struct socket *)sock, usrsctp_recv_handler, NULL);
|
||||
#else
|
||||
sock = ogs_sctp_server(SOCK_STREAM, node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return NULL;
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, lksctp_accept_handler, sock);
|
||||
ogs_assert(node->poll);
|
||||
#endif
|
||||
|
||||
ogs_info("ngap_server() [%s]:%d",
|
||||
|
|
|
@ -71,7 +71,8 @@ int amf_sbi_open(void)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
ogs_sbi_server_start_all(server_cb);
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
/*
|
||||
* The connection between NF and NRF is a little special.
|
||||
|
|
|
@ -55,15 +55,9 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
|
|||
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = ausf_sbi_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish SBI path");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
ausf_sbi_close();
|
||||
break;
|
||||
|
||||
case AUSF_EVT_SBI_SERVER:
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "context.h"
|
||||
#include "sbi-path.h"
|
||||
|
||||
static ogs_thread_t *thread;
|
||||
static void ausf_main(void *data);
|
||||
|
@ -41,6 +41,9 @@ int ausf_initialize()
|
|||
ogs_app()->logger.domain, ogs_app()->logger.level);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = ausf_sbi_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
thread = ogs_thread_create(ausf_main, NULL);
|
||||
if (!thread) return OGS_ERROR;
|
||||
|
||||
|
@ -74,6 +77,8 @@ void ausf_terminate(void)
|
|||
{
|
||||
if (!initialized) return;
|
||||
|
||||
ausf_sbi_close();
|
||||
|
||||
/* Daemon terminating */
|
||||
event_termination();
|
||||
ogs_thread_destroy(thread);
|
||||
|
|
|
@ -69,7 +69,8 @@ int ausf_sbi_open(void)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
ogs_sbi_server_start_all(server_cb);
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
/*
|
||||
* The connection between NF and NRF is a little special.
|
||||
|
|
|
@ -159,17 +159,19 @@ int mme_gtp_open(void)
|
|||
|
||||
ogs_list_for_each(&ogs_gtp_self()->gtpc_list, node) {
|
||||
sock = ogs_gtp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, _gtpv2_c_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
ogs_list_for_each(&ogs_gtp_self()->gtpc_list6, node) {
|
||||
sock = ogs_gtp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, _gtpv2_c_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
|
||||
OGS_SETUP_GTPC_SERVER;
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
#include "mme-timer.h"
|
||||
|
||||
#include "mme-fd-path.h"
|
||||
#include "s1ap-path.h"
|
||||
#include "sgsap-path.h"
|
||||
#include "mme-gtp-path.h"
|
||||
|
||||
static ogs_thread_t *thread;
|
||||
static void mme_main(void *data);
|
||||
|
@ -58,6 +61,15 @@ int mme_initialize()
|
|||
rv = mme_fd_init();
|
||||
if (rv != OGS_OK) return OGS_ERROR;
|
||||
|
||||
rv = mme_gtp_open();
|
||||
if (rv != OGS_OK) return OGS_ERROR;
|
||||
|
||||
rv = sgsap_open();
|
||||
if (rv != OGS_OK) return OGS_ERROR;
|
||||
|
||||
rv = s1ap_open();
|
||||
if (rv != OGS_OK) return OGS_ERROR;
|
||||
|
||||
thread = ogs_thread_create(mme_main, NULL);
|
||||
if (!thread) return OGS_ERROR;
|
||||
|
||||
|
@ -70,6 +82,10 @@ void mme_terminate(void)
|
|||
{
|
||||
if (!initialized) return;
|
||||
|
||||
mme_gtp_close();
|
||||
sgsap_close();
|
||||
s1ap_close();
|
||||
|
||||
mme_event_term();
|
||||
|
||||
ogs_thread_destroy(thread);
|
||||
|
|
|
@ -135,29 +135,9 @@ void mme_state_operational(ogs_fsm_t *s, mme_event_t *e)
|
|||
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = mme_gtp_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("Can't establish S11-GTP path");
|
||||
break;
|
||||
}
|
||||
rv = sgsap_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("Can't establish SGsAP path");
|
||||
break;
|
||||
}
|
||||
rv = s1ap_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("Can't establish S1AP path");
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
mme_gtp_close();
|
||||
sgsap_close();
|
||||
s1ap_close();
|
||||
|
||||
break;
|
||||
|
||||
case MME_EVT_S1AP_LO_ACCEPT:
|
||||
|
|
|
@ -33,10 +33,10 @@ int s1ap_open(void)
|
|||
ogs_socknode_t *node = NULL;
|
||||
|
||||
ogs_list_for_each(&mme_self()->s1ap_list, node)
|
||||
s1ap_server(node);
|
||||
if (s1ap_server(node) == NULL) return OGS_ERROR;
|
||||
|
||||
ogs_list_for_each(&mme_self()->s1ap_list6, node)
|
||||
s1ap_server(node);
|
||||
if (s1ap_server(node) == NULL) return OGS_ERROR;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
|
|
@ -40,14 +40,15 @@ ogs_sock_t *s1ap_server(ogs_socknode_t *node)
|
|||
|
||||
#if HAVE_USRSCTP
|
||||
sock = ogs_sctp_server(SOCK_SEQPACKET, node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return NULL;
|
||||
usrsctp_set_non_blocking((struct socket *)sock, 1);
|
||||
usrsctp_set_upcall((struct socket *)sock, usrsctp_recv_handler, NULL);
|
||||
#else
|
||||
sock = ogs_sctp_server(SOCK_STREAM, node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return NULL;
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, lksctp_accept_handler, sock);
|
||||
ogs_assert(node->poll);
|
||||
#endif
|
||||
|
||||
ogs_info("s1ap_server() [%s]:%d",
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "context.h"
|
||||
#include "sbi-path.h"
|
||||
|
||||
static ogs_thread_t *thread;
|
||||
static void nrf_main(void *data);
|
||||
|
@ -41,6 +41,9 @@ int nrf_initialize()
|
|||
ogs_app()->logger.domain, ogs_app()->logger.level);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = nrf_sbi_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
thread = ogs_thread_create(nrf_main, NULL);
|
||||
if (!thread) return OGS_ERROR;
|
||||
|
||||
|
@ -72,6 +75,8 @@ void nrf_terminate(void)
|
|||
{
|
||||
if (!initialized) return;
|
||||
|
||||
nrf_sbi_close();
|
||||
|
||||
/* Daemon terminating */
|
||||
event_termination();
|
||||
ogs_thread_destroy(thread);
|
||||
|
|
|
@ -53,14 +53,9 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
|
|||
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = nrf_sbi_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish SBI path");
|
||||
}
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
nrf_sbi_close();
|
||||
break;
|
||||
|
||||
case NRF_EVT_SBI_SERVER:
|
||||
|
|
|
@ -69,7 +69,8 @@ static int client_notify_cb(ogs_sbi_response_t *response, void *data)
|
|||
|
||||
int nrf_sbi_open(void)
|
||||
{
|
||||
ogs_sbi_server_start_all(server_cb);
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "context.h"
|
||||
#include "sbi-path.h"
|
||||
|
||||
static ogs_thread_t *thread;
|
||||
static void nssf_main(void *data);
|
||||
|
@ -41,6 +41,9 @@ int nssf_initialize()
|
|||
ogs_app()->logger.domain, ogs_app()->logger.level);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = nssf_sbi_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
thread = ogs_thread_create(nssf_main, NULL);
|
||||
if (!thread) return OGS_ERROR;
|
||||
|
||||
|
@ -74,6 +77,8 @@ void nssf_terminate(void)
|
|||
{
|
||||
if (!initialized) return;
|
||||
|
||||
nssf_sbi_close();
|
||||
|
||||
/* Daemon terminating */
|
||||
event_termination();
|
||||
ogs_thread_destroy(thread);
|
||||
|
|
|
@ -56,15 +56,9 @@ void nssf_state_operational(ogs_fsm_t *s, nssf_event_t *e)
|
|||
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = nssf_sbi_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish SBI path");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
nssf_sbi_close();
|
||||
break;
|
||||
|
||||
case NSSF_EVT_SBI_SERVER:
|
||||
|
|
|
@ -69,7 +69,8 @@ int nssf_sbi_open(void)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
ogs_sbi_server_start_all(server_cb);
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
/*
|
||||
* The connection between NF and NRF is a little special.
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "context.h"
|
||||
#include "sbi-path.h"
|
||||
|
||||
static ogs_thread_t *thread;
|
||||
static void pcf_main(void *data);
|
||||
|
@ -44,6 +44,9 @@ int pcf_initialize()
|
|||
rv = ogs_dbi_init(ogs_app()->db_uri);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = pcf_sbi_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
thread = ogs_thread_create(pcf_main, NULL);
|
||||
if (!thread) return OGS_ERROR;
|
||||
|
||||
|
@ -77,6 +80,8 @@ void pcf_terminate(void)
|
|||
{
|
||||
if (!initialized) return;
|
||||
|
||||
pcf_sbi_close();
|
||||
|
||||
/* Daemon terminating */
|
||||
event_termination();
|
||||
ogs_thread_destroy(thread);
|
||||
|
|
|
@ -58,15 +58,9 @@ void pcf_state_operational(ogs_fsm_t *s, pcf_event_t *e)
|
|||
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = pcf_sbi_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish SBI path");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
pcf_sbi_close();
|
||||
break;
|
||||
|
||||
case PCF_EVT_SBI_SERVER:
|
||||
|
|
|
@ -69,7 +69,8 @@ int pcf_sbi_open(void)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
ogs_sbi_server_start_all(server_cb);
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
/*
|
||||
* The connection between NF and NRF is a little special.
|
||||
|
|
|
@ -107,17 +107,19 @@ int sgwc_gtp_open(void)
|
|||
|
||||
ogs_list_for_each(&ogs_gtp_self()->gtpc_list, node) {
|
||||
sock = ogs_gtp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, _gtpv2_c_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
ogs_list_for_each(&ogs_gtp_self()->gtpc_list6, node) {
|
||||
sock = ogs_gtp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, _gtpv2_c_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
|
||||
OGS_SETUP_GTPC_SERVER;
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
#include "context.h"
|
||||
|
||||
#include "gtp-path.h"
|
||||
#include "pfcp-path.h"
|
||||
|
||||
static ogs_thread_t *thread;
|
||||
static void sgwc_main(void *data);
|
||||
|
||||
|
@ -53,6 +56,12 @@ int sgwc_initialize()
|
|||
ogs_app()->logger.domain, ogs_app()->logger.level);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = sgwc_gtp_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = sgwc_pfcp_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
thread = ogs_thread_create(sgwc_main, NULL);
|
||||
if (!thread) return OGS_ERROR;
|
||||
|
||||
|
@ -65,6 +74,9 @@ void sgwc_terminate(void)
|
|||
{
|
||||
if (!initialized) return;
|
||||
|
||||
sgwc_gtp_close();
|
||||
sgwc_pfcp_close();
|
||||
|
||||
sgwc_event_term();
|
||||
|
||||
ogs_thread_destroy(thread);
|
||||
|
|
|
@ -131,17 +131,19 @@ int sgwc_pfcp_open(void)
|
|||
/* PFCP Server */
|
||||
ogs_list_for_each(&ogs_pfcp_self()->pfcp_list, node) {
|
||||
sock = ogs_pfcp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, pfcp_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
ogs_list_for_each(&ogs_pfcp_self()->pfcp_list6, node) {
|
||||
sock = ogs_pfcp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, pfcp_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
|
||||
OGS_SETUP_PFCP_SERVER;
|
||||
|
|
|
@ -80,21 +80,9 @@ void sgwc_state_operational(ogs_fsm_t *s, sgwc_event_t *e)
|
|||
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = sgwc_gtp_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("Can't establish SGW path");
|
||||
break;
|
||||
}
|
||||
rv = sgwc_pfcp_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish N4-PFCP path");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
sgwc_gtp_close();
|
||||
sgwc_pfcp_close();
|
||||
break;
|
||||
|
||||
case SGWC_EVT_SXA_MESSAGE:
|
||||
|
|
|
@ -251,7 +251,7 @@ int sgwu_gtp_open(void)
|
|||
|
||||
ogs_list_for_each(&ogs_gtp_self()->gtpu_list, node) {
|
||||
sock = ogs_gtp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
if (sock->family == AF_INET)
|
||||
ogs_gtp_self()->gtpu_sock = sock;
|
||||
|
@ -260,6 +260,7 @@ int sgwu_gtp_open(void)
|
|||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, _gtpv1_u_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
|
||||
OGS_SETUP_GTPU_SERVER;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "context.h"
|
||||
#include "gtp-path.h"
|
||||
#include "pfcp-path.h"
|
||||
|
||||
static ogs_thread_t *thread;
|
||||
static void sgwu_main(void *data);
|
||||
|
@ -52,6 +53,12 @@ int sgwu_initialize()
|
|||
ogs_app()->logger.domain, ogs_app()->logger.level);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = sgwu_pfcp_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = sgwu_gtp_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
thread = ogs_thread_create(sgwu_main, NULL);
|
||||
if (!thread) return OGS_ERROR;
|
||||
|
||||
|
@ -64,6 +71,9 @@ void sgwu_terminate(void)
|
|||
{
|
||||
if (!initialized) return;
|
||||
|
||||
sgwu_pfcp_close();
|
||||
sgwu_gtp_close();
|
||||
|
||||
sgwu_event_term();
|
||||
|
||||
ogs_thread_destroy(thread);
|
||||
|
|
|
@ -131,17 +131,19 @@ int sgwu_pfcp_open(void)
|
|||
/* PFCP Server */
|
||||
ogs_list_for_each(&ogs_pfcp_self()->pfcp_list, node) {
|
||||
sock = ogs_pfcp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, pfcp_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
ogs_list_for_each(&ogs_pfcp_self()->pfcp_list6, node) {
|
||||
sock = ogs_pfcp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, pfcp_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
|
||||
OGS_SETUP_PFCP_SERVER;
|
||||
|
|
|
@ -51,19 +51,8 @@ void sgwu_state_operational(ogs_fsm_t *s, sgwu_event_t *e)
|
|||
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = sgwu_pfcp_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish N4-PFCP path");
|
||||
}
|
||||
rv = sgwu_gtp_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("Can't establish SGW path");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
sgwu_pfcp_close();
|
||||
sgwu_gtp_close();
|
||||
break;
|
||||
case SGWU_EVT_SXA_MESSAGE:
|
||||
ogs_assert(e);
|
||||
|
|
|
@ -229,24 +229,26 @@ int smf_gtp_open(void)
|
|||
|
||||
ogs_list_for_each(&ogs_gtp_self()->gtpc_list, node) {
|
||||
sock = ogs_gtp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, _gtpv2_c_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
ogs_list_for_each(&ogs_gtp_self()->gtpc_list6, node) {
|
||||
sock = ogs_gtp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, _gtpv2_c_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
|
||||
OGS_SETUP_GTPC_SERVER;
|
||||
|
||||
ogs_list_for_each(&ogs_gtp_self()->gtpu_list, node) {
|
||||
sock = ogs_gtp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
if (sock->family == AF_INET)
|
||||
ogs_gtp_self()->gtpu_sock = sock;
|
||||
|
@ -255,6 +257,7 @@ int smf_gtp_open(void)
|
|||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, _gtpv1_u_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
|
||||
OGS_SETUP_GTPU_SERVER;
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
#include "context.h"
|
||||
#include "fd-path.h"
|
||||
#include "gtp-path.h"
|
||||
#include "pfcp-path.h"
|
||||
#include "sbi-path.h"
|
||||
|
||||
static ogs_thread_t *thread;
|
||||
static void smf_main(void *data);
|
||||
|
@ -64,6 +67,15 @@ int smf_initialize()
|
|||
rv = smf_fd_init();
|
||||
if (rv != 0) return OGS_ERROR;
|
||||
|
||||
rv = smf_gtp_open();
|
||||
if (rv != 0) return OGS_ERROR;
|
||||
|
||||
rv = smf_pfcp_open();
|
||||
if (rv != 0) return OGS_ERROR;
|
||||
|
||||
rv = smf_sbi_open();
|
||||
if (rv != 0) return OGS_ERROR;
|
||||
|
||||
thread = ogs_thread_create(smf_main, NULL);
|
||||
if (!thread) return OGS_ERROR;
|
||||
|
||||
|
@ -97,6 +109,10 @@ void smf_terminate(void)
|
|||
{
|
||||
if (!initialized) return;
|
||||
|
||||
smf_gtp_close();
|
||||
smf_pfcp_close();
|
||||
smf_sbi_close();
|
||||
|
||||
/* Daemon terminating */
|
||||
event_termination();
|
||||
ogs_thread_destroy(thread);
|
||||
|
|
|
@ -133,17 +133,19 @@ int smf_pfcp_open(void)
|
|||
/* PFCP Server */
|
||||
ogs_list_for_each(&ogs_pfcp_self()->pfcp_list, node) {
|
||||
sock = ogs_pfcp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, pfcp_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
ogs_list_for_each(&ogs_pfcp_self()->pfcp_list6, node) {
|
||||
sock = ogs_pfcp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, pfcp_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
|
||||
OGS_SETUP_PFCP_SERVER;
|
||||
|
|
|
@ -71,7 +71,8 @@ int smf_sbi_open(void)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
ogs_sbi_server_start_all(server_cb);
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
/*
|
||||
* The connection between NF and NRF is a little special.
|
||||
|
|
|
@ -80,26 +80,9 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
|
|||
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = smf_gtp_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish S11-GTP path");
|
||||
}
|
||||
|
||||
rv = smf_pfcp_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish N4-PFCP path");
|
||||
}
|
||||
|
||||
rv = smf_sbi_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish SBI path");
|
||||
}
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
smf_gtp_close();
|
||||
smf_pfcp_close();
|
||||
smf_sbi_close();
|
||||
break;
|
||||
|
||||
case SMF_EVT_S5C_MESSAGE:
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "context.h"
|
||||
#include "sbi-path.h"
|
||||
|
||||
static ogs_thread_t *thread;
|
||||
static void udm_main(void *data);
|
||||
|
@ -41,6 +41,9 @@ int udm_initialize()
|
|||
ogs_app()->logger.domain, ogs_app()->logger.level);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = udm_sbi_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
thread = ogs_thread_create(udm_main, NULL);
|
||||
if (!thread) return OGS_ERROR;
|
||||
|
||||
|
@ -74,6 +77,8 @@ void udm_terminate(void)
|
|||
{
|
||||
if (!initialized) return;
|
||||
|
||||
udm_sbi_close();
|
||||
|
||||
/* Daemon terminating */
|
||||
event_termination();
|
||||
ogs_thread_destroy(thread);
|
||||
|
|
|
@ -69,7 +69,8 @@ int udm_sbi_open(void)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
ogs_sbi_server_start_all(server_cb);
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
/*
|
||||
* The connection between NF and NRF is a little special.
|
||||
|
|
|
@ -56,15 +56,9 @@ void udm_state_operational(ogs_fsm_t *s, udm_event_t *e)
|
|||
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = udm_sbi_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish SBI path");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
udm_sbi_close();
|
||||
break;
|
||||
|
||||
case UDM_EVT_SBI_SERVER:
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "context.h"
|
||||
#include "sbi-path.h"
|
||||
|
||||
static ogs_thread_t *thread;
|
||||
static void udr_main(void *data);
|
||||
|
@ -44,6 +44,9 @@ int udr_initialize()
|
|||
rv = ogs_dbi_init(ogs_app()->db_uri);
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = udr_sbi_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
thread = ogs_thread_create(udr_main, NULL);
|
||||
if (!thread) return OGS_ERROR;
|
||||
|
||||
|
@ -77,6 +80,8 @@ void udr_terminate(void)
|
|||
{
|
||||
if (!initialized) return;
|
||||
|
||||
udr_sbi_close();
|
||||
|
||||
/* Daemon terminating */
|
||||
event_termination();
|
||||
ogs_thread_destroy(thread);
|
||||
|
|
|
@ -69,7 +69,8 @@ int udr_sbi_open(void)
|
|||
{
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
|
||||
ogs_sbi_server_start_all(server_cb);
|
||||
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
|
||||
return OGS_ERROR;
|
||||
|
||||
/*
|
||||
* The connection between NF and NRF is a little special.
|
||||
|
|
|
@ -55,15 +55,9 @@ void udr_state_operational(ogs_fsm_t *s, udr_event_t *e)
|
|||
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = udr_sbi_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish SBI path");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
udr_sbi_close();
|
||||
break;
|
||||
|
||||
case UDR_EVT_SBI_SERVER:
|
||||
|
|
|
@ -414,7 +414,7 @@ int upf_gtp_open(void)
|
|||
|
||||
ogs_list_for_each(&ogs_gtp_self()->gtpu_list, node) {
|
||||
sock = ogs_gtp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
if (sock->family == AF_INET)
|
||||
ogs_gtp_self()->gtpu_sock = sock;
|
||||
|
@ -423,6 +423,7 @@ int upf_gtp_open(void)
|
|||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, _gtpv1_u_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
|
||||
OGS_SETUP_GTPU_SERVER;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "context.h"
|
||||
#include "gtp-path.h"
|
||||
#include "pfcp-path.h"
|
||||
|
||||
static ogs_thread_t *thread;
|
||||
static void upf_main(void *data);
|
||||
|
@ -55,6 +56,12 @@ int upf_initialize()
|
|||
rv = ogs_pfcp_ue_pool_generate();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = upf_pfcp_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
rv = upf_gtp_open();
|
||||
if (rv != OGS_OK) return rv;
|
||||
|
||||
thread = ogs_thread_create(upf_main, NULL);
|
||||
if (!thread) return OGS_ERROR;
|
||||
|
||||
|
@ -67,6 +74,9 @@ void upf_terminate(void)
|
|||
{
|
||||
if (!initialized) return;
|
||||
|
||||
upf_pfcp_close();
|
||||
upf_gtp_close();
|
||||
|
||||
upf_event_term();
|
||||
|
||||
ogs_thread_destroy(thread);
|
||||
|
|
|
@ -134,17 +134,19 @@ int upf_pfcp_open(void)
|
|||
/* PFCP Server */
|
||||
ogs_list_for_each(&ogs_pfcp_self()->pfcp_list, node) {
|
||||
sock = ogs_pfcp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, pfcp_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
ogs_list_for_each(&ogs_pfcp_self()->pfcp_list6, node) {
|
||||
sock = ogs_pfcp_server(node);
|
||||
ogs_assert(sock);
|
||||
if (!sock) return OGS_ERROR;
|
||||
|
||||
node->poll = ogs_pollset_add(ogs_app()->pollset,
|
||||
OGS_POLLIN, sock->fd, pfcp_recv_cb, sock);
|
||||
ogs_assert(node->poll);
|
||||
}
|
||||
|
||||
OGS_SETUP_PFCP_SERVER;
|
||||
|
|
|
@ -54,19 +54,9 @@ void upf_state_operational(ogs_fsm_t *s, upf_event_t *e)
|
|||
|
||||
switch (e->id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
rv = upf_pfcp_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish N4-PFCP path");
|
||||
}
|
||||
rv = upf_gtp_open();
|
||||
if (rv != OGS_OK) {
|
||||
ogs_fatal("Can't establish GTP-U path");
|
||||
}
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
upf_pfcp_close();
|
||||
upf_gtp_close();
|
||||
break;
|
||||
|
||||
case UPF_EVT_N4_MESSAGE:
|
||||
|
|
Loading…
Reference in New Issue