Merge remote-tracking branch 'origin/episys-merge-nsa' into integration_2021_wk51_d
This commit is contained in:
@@ -222,7 +222,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
|
||||
* - END-MARKER
|
||||
*/
|
||||
case NW_GTPV1U_ULP_API_RECV_TPDU: {
|
||||
uint8_t buffer[4096];
|
||||
uint8_t buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
|
||||
uint32_t buffer_len;
|
||||
struct rrc_eNB_ue_context_s *ue_context_p;
|
||||
uint16_t msgType = NW_GTP_GPDU;
|
||||
@@ -908,7 +908,8 @@ gtpv1u_create_s1u_tunnel(
|
||||
|
||||
do {
|
||||
s1u_teid = gtpv1u_new_teid();
|
||||
LOG_D(GTPU, "gtpv1u_create_s1u_tunnel() 0x%x %u(dec)\n", s1u_teid, s1u_teid);
|
||||
LOG_I(GTPU, "gtpv1u_data_g %p\n", RC.gtpv1u_data_g);
|
||||
LOG_I(GTPU, "gtpv1u_create_s1u_tunnel() 0x%x %u(dec)\n", s1u_teid, s1u_teid);
|
||||
stack_req.apiInfo.createTunnelEndPointInfo.teid = s1u_teid;
|
||||
stack_req.apiInfo.createTunnelEndPointInfo.hUlpSession = 0;
|
||||
stack_req.apiInfo.createTunnelEndPointInfo.hStackSession = 0;
|
||||
|
||||
@@ -262,10 +262,10 @@ void display_usim_data(const char *filename) {
|
||||
kasme[USIM_K_ASME_SIZE] = '\0';
|
||||
memcpy(kasme, data.securityctx.Kasme.value, USIM_K_ASME_SIZE);
|
||||
printf("\tKasme\t: \"%s\"\n", kasme);
|
||||
printf("\tulNAScount\t: 0x%.8x\n",
|
||||
/*printf("\tulNAScount\t: 0x%.8x\n",
|
||||
*(uint32_t*) data.securityctx.ulNAScount.value);
|
||||
printf("\tdlNAScount\t: 0x%.8x\n",
|
||||
*(uint32_t*) data.securityctx.dlNAScount.value);
|
||||
*(uint32_t*) data.securityctx.dlNAScount.value);*/
|
||||
printf("\talgorithmID\t: 0x%.2x\n\n",
|
||||
data.securityctx.algorithmID.value[0]);
|
||||
|
||||
|
||||
@@ -249,7 +249,9 @@ int usim_api_authenticate_test(usim_data_t *usim_data,
|
||||
LOG_TRACE(INFO,
|
||||
"USIM-API - Comparing the XMAC with the MAC included in AUTN Succeeded");
|
||||
/* Verify that the received sequence number SQN is in the correct range */
|
||||
rc = _usim_api_check_sqn(*(uint32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]);
|
||||
uint32_t v;
|
||||
memcpy(&v, sqn, sizeof(v));
|
||||
rc = _usim_api_check_sqn(v, sqn[USIM_API_SQN_SIZE - 1]);
|
||||
}
|
||||
|
||||
|
||||
@@ -392,7 +394,9 @@ int usim_api_authenticate(usim_data_t *usim_data, const OctetString* rand_pP, co
|
||||
LOG_TRACE(INFO,
|
||||
"USIM-API - Comparing the XMAC with the MAC included in AUTN Succeeded");
|
||||
/* Verify that the received sequence number SQN is in the correct range */
|
||||
rc = _usim_api_check_sqn(*(uint32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]);
|
||||
uint32_t v;
|
||||
memcpy(&v, sqn, sizeof(v));
|
||||
rc = _usim_api_check_sqn(v, sqn[USIM_API_SQN_SIZE - 1]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -356,7 +356,7 @@ int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_typ
|
||||
int pid = RETURNerror;
|
||||
char apn_first_char[4];
|
||||
|
||||
LOG_VAR(char, str[128]);
|
||||
char str[128] __attribute__((unused));
|
||||
|
||||
if (isprint(apn->value[0])) {
|
||||
apn_first_char[0] = '\0';
|
||||
|
||||
@@ -51,6 +51,7 @@ Description Defines functions used to handle EPS bearer contexts.
|
||||
#include "assertions.h"
|
||||
#include "pdcp.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
@@ -262,8 +263,7 @@ int esm_ebr_context_create(
|
||||
netmask = 32;
|
||||
strcpy(broadcast, ipv4_addr);
|
||||
}
|
||||
|
||||
res = sprintf(command_line,
|
||||
LOG_D(NAS, "setting commandline string: "
|
||||
"ip address add %s/%d broadcast %s dev %s%d && "
|
||||
"ip link set %s%d up && "
|
||||
"ip rule add from %s/32 table %d && "
|
||||
@@ -276,26 +276,67 @@ int esm_ebr_context_create(
|
||||
ipv4_addr, ueid + 10000,
|
||||
UE_NAS_USE_TUN ? "oaitun_ue" : "oip",
|
||||
ueid + 1, ueid + 10000);
|
||||
if (!get_softmodem_params()->nsa)
|
||||
{
|
||||
res = sprintf(command_line,
|
||||
"ip address add %s/%d broadcast %s dev %s%d && "
|
||||
"ip link set %s%d up && "
|
||||
"ip rule add from %s/32 table %d && "
|
||||
"ip rule add to %s/32 table %d && "
|
||||
"ip route add default dev %s%d table %d",
|
||||
ipv4_addr, netmask, broadcast,
|
||||
UE_NAS_USE_TUN ? "oaitun_ue" : "oip", ueid + 1,
|
||||
UE_NAS_USE_TUN ? "oaitun_ue" : "oip", ueid + 1,
|
||||
ipv4_addr, ueid + 10000,
|
||||
ipv4_addr, ueid + 10000,
|
||||
UE_NAS_USE_TUN ? "oaitun_ue" : "oip",
|
||||
ueid + 1, ueid + 10000);
|
||||
|
||||
if ( res<0 ) {
|
||||
LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string");
|
||||
}
|
||||
if ( res<0 ) {
|
||||
LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string");
|
||||
}
|
||||
|
||||
LOG_TRACE(INFO, "ESM-PROC - executing %s ",
|
||||
/* Calling system() here disrupts UE's realtime processing in some cases.
|
||||
* This may be because of the call to fork(), which, for some
|
||||
* unidentified reason, interacts badly with other (realtime) threads.
|
||||
* background_system() is a replacement mechanism relying on a
|
||||
* background process that does the system() and reports result to
|
||||
* the parent process (lte-softmodem, oaisim, ...). The background
|
||||
* process is created very early in the life of the parent process.
|
||||
* The processes interact through standard pipes. See
|
||||
* common/utils/system.c for details.
|
||||
*/
|
||||
|
||||
LOG_TRACE(INFO, "ESM-PROC - executing %s ",
|
||||
command_line);
|
||||
if (background_system(command_line) != 0)
|
||||
{
|
||||
LOG_TRACE(ERROR, "ESM-PROC - failed command '%s'", command_line);
|
||||
}
|
||||
}
|
||||
else if (get_softmodem_params()->nsa) {
|
||||
res = sprintf(command_line,
|
||||
"ip address add %s/%d broadcast %s dev %s%d && "
|
||||
"ip link set %s%d up && "
|
||||
"ip rule add from %s/32 table %d && "
|
||||
"ip rule add to %s/32 table %d && "
|
||||
"ip route add default dev %s%d table %d",
|
||||
ipv4_addr, netmask, broadcast,
|
||||
UE_NAS_USE_TUN ? "oaitun_nru" : "oip", ueid + 1,
|
||||
UE_NAS_USE_TUN ? "oaitun_nru" : "oip", ueid + 1,
|
||||
ipv4_addr, ueid + 10000,
|
||||
ipv4_addr, ueid + 10000,
|
||||
UE_NAS_USE_TUN ? "oaitun_nru" : "oip",
|
||||
ueid + 1, ueid + 10000);
|
||||
|
||||
/* Calling system() here disrupts UE's realtime processing in some cases.
|
||||
* This may be because of the call to fork(), which, for some
|
||||
* unidentified reason, interacts badly with other (realtime) threads.
|
||||
* background_system() is a replacement mechanism relying on a
|
||||
* background process that does the system() and reports result to
|
||||
* the parent process (lte-softmodem, oaisim, ...). The background
|
||||
* process is created very early in the life of the parent process.
|
||||
* The processes interact through standard pipes. See
|
||||
* common/utils/system.c for details.
|
||||
*/
|
||||
if (background_system(command_line) != 0)
|
||||
LOG_TRACE(ERROR, "ESM-PROC - failed command '%s'", command_line);
|
||||
if ( res<0 ) {
|
||||
LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string");
|
||||
}
|
||||
LOG_D(NAS, "Sending NAS_OAI_TUN_NSA msg to LTE UE via itti\n");
|
||||
MessageDef *msg_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_OAI_TUN_NSA);
|
||||
memcpy(NAS_OAI_TUN_NSA(msg_p).buffer, command_line, sizeof(NAS_OAI_TUN_NSA(msg_p).buffer));
|
||||
itti_send_msg_to_task(TASK_RRC_UE, 0, msg_p);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
# include "intertask_interface.h"
|
||||
# include "nas_ue_task.h"
|
||||
# include "common/utils/LOG/log.h"
|
||||
|
||||
# include "vendor_ext.h"
|
||||
# include "user_defs.h"
|
||||
# include "user_api.h"
|
||||
# include "nas_parser.h"
|
||||
@@ -42,6 +42,8 @@
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern uint16_t NB_UE_INST;
|
||||
|
||||
uint16_t ue_idx_standalone = 0xFFFF;
|
||||
|
||||
char *make_port_str_from_ueid(const char *base_port_str, int ueid);
|
||||
|
||||
static int nas_ue_process_events(nas_user_container_t *users, struct epoll_event *events, int nb_events)
|
||||
@@ -96,41 +98,89 @@ void *nas_ue_task(void *args_p)
|
||||
|
||||
itti_mark_task_ready (TASK_NAS_UE);
|
||||
MSC_START_USE();
|
||||
LOG_I(NAS, "ue_idx_standalone val:: %u\n", ue_idx_standalone);
|
||||
/* Initialize UE NAS (EURECOM-NAS) */
|
||||
for (int i=0; i < users->count; i++)
|
||||
// Intead of for loop for standalone mode
|
||||
if (ue_idx_standalone == 0xFFFF)
|
||||
{
|
||||
nas_user_t *user = &users->item[i];
|
||||
user->ueid=i;
|
||||
for (int i = 0; i < users->count; i++)
|
||||
{
|
||||
nas_user_t *user = &users->item[i];
|
||||
user->ueid = i;
|
||||
|
||||
/* Get USIM data application filename */
|
||||
user->usim_data_store = memory_get_path_from_ueid(USIM_API_NVRAM_DIRNAME, USIM_API_NVRAM_FILENAME, user->ueid);
|
||||
if ( user->usim_data_store == NULL ) {
|
||||
LOG_E(NAS, "[UE %d] - Failed to get USIM data application filename", user->ueid);
|
||||
exit(EXIT_FAILURE);
|
||||
/* Get USIM data application filename */
|
||||
user->usim_data_store = memory_get_path_from_ueid(USIM_API_NVRAM_DIRNAME, USIM_API_NVRAM_FILENAME, user->ueid);
|
||||
if (user->usim_data_store == NULL)
|
||||
{
|
||||
LOG_E(NAS, "[UE %d] - Failed to get USIM data application filename", user->ueid);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Get UE's data pathname */
|
||||
user->user_nvdata_store = memory_get_path_from_ueid(USER_NVRAM_DIRNAME, USER_NVRAM_FILENAME, user->ueid);
|
||||
if (user->user_nvdata_store == NULL)
|
||||
{
|
||||
LOG_E(NAS, "[UE %d] - Failed to get USIM nvdata filename", user->ueid);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Get EMM data pathname */
|
||||
user->emm_nvdata_store = memory_get_path_from_ueid(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME, user->ueid);
|
||||
if (user->emm_nvdata_store == NULL)
|
||||
{
|
||||
LOG_E(NAS, "[UE %d] - Failed to get EMM nvdata filename", user->ueid);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Initialize user interface (to exchange AT commands with user process) */
|
||||
nas_user_api_id_initialize(user);
|
||||
/* allocate needed structures */
|
||||
user->user_at_commands = calloc_or_fail(sizeof(user_at_commands_t));
|
||||
user->at_response = calloc_or_fail(sizeof(at_response_t));
|
||||
user->lowerlayer_data = calloc_or_fail(sizeof(lowerlayer_data_t));
|
||||
/* Initialize NAS user */
|
||||
nas_user_initialize(user, &user_api_emm_callback, &user_api_esm_callback, FIRMWARE_VERSION);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// use new parameter passed into lte-uesoftmodem which instead of looping
|
||||
// calls functions on specific UE index.
|
||||
|
||||
/* Get UE's data pathname */
|
||||
user->user_nvdata_store = memory_get_path_from_ueid(USER_NVRAM_DIRNAME, USER_NVRAM_FILENAME, user->ueid);
|
||||
if ( user->user_nvdata_store == NULL ) {
|
||||
LOG_E(NAS, "[UE %d] - Failed to get USIM nvdata filename", user->ueid);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
nas_user_t *user = &users->item[0];
|
||||
user->ueid = ue_idx_standalone;
|
||||
LOG_I(NAS, "[UE %d] Configuring\n", user->ueid);
|
||||
|
||||
/* Get EMM data pathname */
|
||||
user->emm_nvdata_store = memory_get_path_from_ueid(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME, user->ueid);
|
||||
if ( user->emm_nvdata_store == NULL ) {
|
||||
LOG_E(NAS, "[UE %d] - Failed to get EMM nvdata filename", user->ueid);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Initialize user interface (to exchange AT commands with user process) */
|
||||
nas_user_api_id_initialize(user);
|
||||
/* allocate needed structures */
|
||||
user->user_at_commands = calloc_or_fail(sizeof(user_at_commands_t));
|
||||
user->at_response = calloc_or_fail(sizeof(at_response_t));
|
||||
user->lowerlayer_data = calloc_or_fail(sizeof(lowerlayer_data_t));
|
||||
/* Initialize NAS user */
|
||||
nas_user_initialize (user, &user_api_emm_callback, &user_api_esm_callback, FIRMWARE_VERSION);
|
||||
/* Get USIM data application filename */ //
|
||||
user->usim_data_store = memory_get_path_from_ueid(USIM_API_NVRAM_DIRNAME, USIM_API_NVRAM_FILENAME, user->ueid);
|
||||
if (user->usim_data_store == NULL)
|
||||
{
|
||||
LOG_E(NAS, "[UE %d] - Failed to get USIM data application filename", user->ueid);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
/* Get UE's data pathname */
|
||||
user->user_nvdata_store = memory_get_path_from_ueid(USER_NVRAM_DIRNAME, USER_NVRAM_FILENAME, user->ueid);
|
||||
if (user->user_nvdata_store == NULL)
|
||||
{
|
||||
LOG_E(NAS, "[UE %d] - Failed to get USIM nvdata filename", user->ueid);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
/* Get EMM data pathname */
|
||||
user->emm_nvdata_store = memory_get_path_from_ueid(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME, user->ueid);
|
||||
if (user->emm_nvdata_store == NULL)
|
||||
{
|
||||
LOG_E(NAS, "[UE %d] - Failed to get EMM nvdata filename", user->ueid);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
/* Initialize user interface (to exchange AT commands with user process) */
|
||||
nas_user_api_id_initialize(user);
|
||||
/* allocate needed structures */
|
||||
user->user_at_commands = calloc_or_fail(sizeof(user_at_commands_t));
|
||||
user->at_response = calloc_or_fail(sizeof(at_response_t));
|
||||
user->lowerlayer_data = calloc_or_fail(sizeof(lowerlayer_data_t));
|
||||
/* Initialize NAS user */
|
||||
nas_user_initialize(user, &user_api_emm_callback, &user_api_esm_callback, FIRMWARE_VERSION);
|
||||
user->ueid = 0;
|
||||
}
|
||||
|
||||
/* Set UE activation state */
|
||||
|
||||
@@ -235,7 +235,7 @@ udp_eNB_send_to(
|
||||
|
||||
void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP)
|
||||
{
|
||||
uint8_t l_buffer[2048];
|
||||
uint8_t l_buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
|
||||
int n;
|
||||
socklen_t from_len;
|
||||
struct sockaddr_in addr;
|
||||
@@ -246,10 +246,13 @@ void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP)
|
||||
if (1) {
|
||||
from_len = (socklen_t)sizeof(struct sockaddr_in);
|
||||
|
||||
if ((n = recvfrom(udp_sock_pP->sd, l_buffer, sizeof(l_buffer), 0,
|
||||
if ((n = recvfrom(udp_sock_pP->sd, l_buffer, sizeof(l_buffer), MSG_TRUNC,
|
||||
(struct sockaddr *)&addr, &from_len)) < 0) {
|
||||
LOG_E(UDP_, "Recvfrom failed %s\n", strerror(errno));
|
||||
return;
|
||||
} else if (n > sizeof(l_buffer)) {
|
||||
LOG_E(UDP_, "%s(%d). Message truncated. %d\n", __FUNCTION__, __LINE__, n);
|
||||
return;
|
||||
} else if (n == 0) {
|
||||
LOG_W(UDP_, "Recvfrom returned 0\n");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user