forked from acouzens/open5gs
default configuration is changed for packaging.
Even though nextepc can support link-local address, User may not want to setup link-local address automatically. So we remove link-link address in default configuration
This commit is contained in:
parent
7e84bd1aaf
commit
79ec7d8bc0
|
@ -198,8 +198,9 @@ status_t sock_bind(sock_id id, c_sockaddr_t *addr)
|
|||
|
||||
if (bind(sock->fd, &addr->sa, addrlen) != 0)
|
||||
{
|
||||
d_error("socket bind [%s]:%d failed(%d:%s)",
|
||||
CORE_ADDR(addr, buf), CORE_PORT(addr), errno, strerror(errno));
|
||||
d_error("socket bind(%d) [%s]:%d failed(%d:%s)",
|
||||
addr->c_sa_family, CORE_ADDR(addr, buf), CORE_PORT(addr),
|
||||
errno, strerror(errno));
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,8 +103,6 @@ mme:
|
|||
# - addr: ::1
|
||||
#
|
||||
gtpc:
|
||||
- addr: 127.0.0.1
|
||||
- addr: ::1
|
||||
|
||||
#
|
||||
# <GUMMEI>
|
||||
|
@ -223,7 +221,6 @@ sgw:
|
|||
gtpc:
|
||||
addr:
|
||||
- 127.0.0.2
|
||||
- fe80::2%@LO_DEV@
|
||||
|
||||
#
|
||||
# <GTP-U Server>>
|
||||
|
@ -246,44 +243,49 @@ pgw:
|
|||
# o Only first node is attempted. others are ignored.
|
||||
# o if HSS provide PGW addresss(per-UE), it overwrites configuration.
|
||||
#
|
||||
# o Two PGW are defined. 127.0.0.3:2123 is attempted. [fe80::3%@LO_DEV@]:2123 is ignored.
|
||||
# o Two PGW are defined. 127.0.0.1:2123 is attempted. [::1]:2123 is ignored.
|
||||
# gtpc:
|
||||
# - addr: 127.0.0.3
|
||||
# - addr: fe80::3%@LO_DEV@
|
||||
# - addr: 127.0.0.1
|
||||
# - addr: ::1
|
||||
#
|
||||
# o One PGW is defined. if prefer_ipv4 is not true, [fe80::2%@LO_DEV@] is selected.
|
||||
# o One PGW is defined. if prefer_ipv4 is not true, [::1] is selected.
|
||||
# gtpc:
|
||||
# - addr:
|
||||
# - 127.0.0.3
|
||||
# - fe80::3%@LO_DEV@
|
||||
# - 127.0.0.1
|
||||
# - ::1
|
||||
#
|
||||
# ------------------------ PGW --------------------------
|
||||
#
|
||||
# o Specify local addresses the GTP-C server must bind to
|
||||
#
|
||||
# o GTP-C Server(127.0.0.3:2123, [fe80::3%@LO_DEV@]:2123)
|
||||
# o GTP-C Server(127.0.0.1:2123, [::1]:2123)
|
||||
# gtpc:
|
||||
# addr:
|
||||
# - 127.0.0.3
|
||||
# - fe80::3%@LO_DEV@
|
||||
# - 127.0.0.1
|
||||
# - ::1
|
||||
#
|
||||
# o Same configuration(127.0.0.1:2123, [::1]:2123) as below.
|
||||
# gtpc:
|
||||
# - addr: 127.0.0.1
|
||||
# - addr: ::1
|
||||
#
|
||||
gtpc:
|
||||
addr:
|
||||
- 127.0.0.3
|
||||
- fe80::3%@LO_DEV@
|
||||
- 127.0.0.1
|
||||
- ::1
|
||||
|
||||
#
|
||||
# <GTP-U Server>>
|
||||
#
|
||||
# o Specify local addresses the GTP-U server must bind to
|
||||
#
|
||||
# o GTP-U Server(127.0.0.3:2152, [::3]:2152)
|
||||
# o GTP-U Server(127.0.0.1:2152, [::1]:2152)
|
||||
# gtpu:
|
||||
# - addr: 127.0.0.3
|
||||
# - addr: fe80::3%@LO_DEV@
|
||||
# - addr: 127.0.0.1
|
||||
# - addr: ::1
|
||||
gtpu:
|
||||
- addr: 127.0.0.3
|
||||
- addr: fe80::3%@LO_DEV@
|
||||
- addr: 127.0.0.1
|
||||
- addr: ::1
|
||||
|
||||
#
|
||||
# <UE Pool>
|
||||
|
|
|
@ -33,6 +33,7 @@ AM_CPPFLAGS = \
|
|||
AM_CFLAGS = \
|
||||
-Wall -Werror \
|
||||
-Wno-unused-function -Wno-unused-variable \
|
||||
@OSCPPFLAGS@ \
|
||||
$(NULL)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#define TRACE_MODULE _testpacket
|
||||
|
||||
#include "core_debug.h"
|
||||
#include "core_pkbuf.h"
|
||||
#include "core_lib.h"
|
||||
|
||||
#include "s1ap_build.h"
|
||||
|
@ -18,6 +17,50 @@
|
|||
|
||||
extern int test_only_control_plane;
|
||||
|
||||
#define TEST_ENB_ADDR "127.0.0.5"
|
||||
#if LINUX == 1
|
||||
#define TEST_ENB_ADDR6 "fe80::1%lo"
|
||||
#else
|
||||
#define TEST_ENB_ADDR6 "fe80::1%lo0"
|
||||
#endif
|
||||
static c_sockaddr_t *test_enb_addr = NULL;
|
||||
static c_sockaddr_t *test_enb_addr6 = NULL;
|
||||
|
||||
status_t testpacket_init()
|
||||
{
|
||||
status_t rv;
|
||||
|
||||
rv = core_getaddrinfo(&test_enb_addr,
|
||||
AF_INET, TEST_ENB_ADDR, GTPV1_U_UDP_PORT, 0);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
|
||||
/* There is no default link-local address,
|
||||
* If you want to test it, you need set the IPv6 address in some interface */
|
||||
#if LINUX != 1
|
||||
rv = core_getaddrinfo(&test_enb_addr6,
|
||||
AF_INET6, TEST_ENB_ADDR6, GTPV1_U_UDP_PORT, 0);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
#endif
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t testpacket_final()
|
||||
{
|
||||
if (test_enb_addr)
|
||||
{
|
||||
core_freeaddrinfo(test_enb_addr);
|
||||
test_enb_addr = NULL;
|
||||
}
|
||||
if (test_enb_addr6)
|
||||
{
|
||||
core_freeaddrinfo(test_enb_addr6);
|
||||
test_enb_addr6 = NULL;
|
||||
}
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t tests1ap_enb_connect(sock_id *new)
|
||||
{
|
||||
status_t rv;
|
||||
|
@ -52,34 +95,26 @@ status_t testgtpu_enb_connect(sock_id *new)
|
|||
{
|
||||
char buf[INET_ADDRSTRLEN];
|
||||
status_t rv;
|
||||
mme_context_t *mme = mme_self();
|
||||
c_sockaddr_t addr;
|
||||
c_sockaddr_t *addr = NULL;
|
||||
int family = AF_UNSPEC;
|
||||
|
||||
if (test_only_control_plane) return CORE_OK;
|
||||
|
||||
d_assert(mme, return CORE_ERROR,);
|
||||
|
||||
family = AF_INET6;
|
||||
if (context_self()->parameter.no_ipv6) family = AF_INET;
|
||||
else if (context_self()->parameter.prefer_ipv4) family = AF_INET;
|
||||
else if (test_enb_addr6 == NULL) family = AF_INET;
|
||||
|
||||
rv = udp_socket(new, family);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
|
||||
if (family == AF_INET)
|
||||
{
|
||||
d_assert(mme->gtpc_addr, return CORE_ERROR,);
|
||||
memcpy(&addr, mme->gtpc_addr, sizeof(c_sockaddr_t));
|
||||
addr.c_sa_port = htons(GTPV1_U_UDP_PORT);
|
||||
}
|
||||
if (family == AF_INET) addr = test_enb_addr;
|
||||
else if (family == AF_INET6) addr = test_enb_addr6;
|
||||
else
|
||||
{
|
||||
d_assert(mme->gtpc_addr6, return CORE_ERROR,);
|
||||
memcpy(&addr, mme->gtpc_addr6, sizeof(c_sockaddr_t));
|
||||
addr.c_sa_port = htons(GTPV1_U_UDP_PORT);
|
||||
}
|
||||
rv = sock_bind(*new, &addr);
|
||||
d_assert(0, return CORE_ERROR,);
|
||||
|
||||
d_assert(addr, return CORE_ERROR,);
|
||||
rv = sock_bind(*new, addr);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
|
||||
return CORE_OK;
|
||||
|
@ -732,8 +767,7 @@ status_t tests1ap_build_initial_context_setup_response(
|
|||
core_calloc(1, sizeof(S1ap_E_RABSetupItemCtxtSURes_t));
|
||||
e_rab->e_RAB_ID = ebi;
|
||||
|
||||
rv = gtp_sockaddr_to_f_teid(
|
||||
mme_self()->gtpc_addr, mme_self()->gtpc_addr6, &f_teid, &len);
|
||||
rv = gtp_sockaddr_to_f_teid(test_enb_addr, test_enb_addr6, &f_teid, &len);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
rv = gtp_f_teid_to_ip(&f_teid, &ip);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
|
@ -1174,9 +1208,8 @@ status_t tests1ap_build_e_rab_setup_response(
|
|||
e_rab = (S1ap_E_RABSetupItemBearerSURes_t *)
|
||||
core_calloc(1, sizeof(S1ap_E_RABSetupItemBearerSURes_t));
|
||||
e_rab->e_RAB_ID = ebi;
|
||||
|
||||
rv = gtp_sockaddr_to_f_teid(
|
||||
mme_self()->gtpc_addr, mme_self()->gtpc_addr6, &f_teid, &len);
|
||||
|
||||
rv = gtp_sockaddr_to_f_teid(test_enb_addr, test_enb_addr6, &f_teid, &len);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
rv = gtp_f_teid_to_ip(&f_teid, &ip);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
|
@ -1426,7 +1459,7 @@ status_t tests1ap_build_path_switch_request(
|
|||
e_rab->e_RAB_ID = ebi+i;
|
||||
|
||||
rv = gtp_sockaddr_to_f_teid(
|
||||
mme_self()->gtpc_addr, mme_self()->gtpc_addr6, &f_teid, &len);
|
||||
test_enb_addr, test_enb_addr6, &f_teid, &len);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
rv = gtp_f_teid_to_ip(&f_teid, &ip);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
|
@ -1597,7 +1630,7 @@ CORE_DECLARE(status_t) tests1ap_build_handover_request_ack(
|
|||
e_rab->e_RAB_ID = ebi+i;
|
||||
|
||||
rv = gtp_sockaddr_to_f_teid(
|
||||
mme_self()->gtpc_addr, mme_self()->gtpc_addr6, &f_teid, &len);
|
||||
test_enb_addr, test_enb_addr6, &f_teid, &len);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
rv = gtp_f_teid_to_ip(&f_teid, &ip);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
|
|
|
@ -2,11 +2,17 @@
|
|||
#define __TESTS1AP_H__
|
||||
|
||||
#include "core_network.h"
|
||||
#include "core_pkbuf.h"
|
||||
|
||||
#include "s1ap_message.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
CORE_DECLARE(status_t) testpacket_init();
|
||||
CORE_DECLARE(status_t) testpacket_final();
|
||||
|
||||
CORE_DECLARE(status_t) tests1ap_enb_connect(sock_id *new);
|
||||
CORE_DECLARE(status_t) tests1ap_enb_close(sock_id id);
|
||||
CORE_DECLARE(status_t) tests1ap_enb_send(sock_id id, pkbuf_t *sendbuf);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "app.h"
|
||||
#include "context.h"
|
||||
#include "mme_context.h"
|
||||
#include "testpacket.h"
|
||||
#include "abts.h"
|
||||
#include "testutil.h"
|
||||
|
||||
|
@ -40,6 +40,7 @@ void test_terminate(void)
|
|||
{
|
||||
d_trace_global_on();
|
||||
|
||||
testpacket_final();
|
||||
app_terminate();
|
||||
core_terminate();
|
||||
}
|
||||
|
@ -54,6 +55,7 @@ status_t test_initialize(char *config_path)
|
|||
|
||||
core_initialize();
|
||||
rv = app_initialize(config_path, NULL);
|
||||
testpacket_init();
|
||||
if (rv == CORE_OK)
|
||||
{
|
||||
while(1)
|
||||
|
|
Loading…
Reference in New Issue