Commit b3829736 authored by gauthier's avatar gauthier

For EPC, tested scenario is IMSI attach with EURECOM NAS UE, (not GUTI)

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5282 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 72fd579b
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
// Messages files used between tasks // Messages files used between tasks
#include "gtpv1_u_messages_def.h" #include "gtpv1_u_messages_def.h"
#include "ip_forward_messages_def.h" #include "ip_forward_messages_def.h"
#include "mme_app_messages_def.h"
#include "nas_messages_def.h" #include "nas_messages_def.h"
#include "s11_messages_def.h" #include "s11_messages_def.h"
#include "s1ap_messages_def.h" #include "s1ap_messages_def.h"
...@@ -13,3 +12,4 @@ ...@@ -13,3 +12,4 @@
#include "sctp_messages_def.h" #include "sctp_messages_def.h"
#include "sgw_lite_def.h" #include "sgw_lite_def.h"
#include "udp_messages_def.h" #include "udp_messages_def.h"
#include "mme_app_messages_def.h"
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "gtpv1_u_messages_types.h" #include "gtpv1_u_messages_types.h"
#include "ip_forward_messages_types.h" #include "ip_forward_messages_types.h"
#include "mme_app_messages_types.h"
#include "s11_messages_types.h" #include "s11_messages_types.h"
#include "s1ap_messages_types.h" #include "s1ap_messages_types.h"
#include "nas_messages_types.h" #include "nas_messages_types.h"
...@@ -23,5 +22,6 @@ ...@@ -23,5 +22,6 @@
#include "sctp_messages_types.h" #include "sctp_messages_types.h"
#include "sgw_lite_messages_types.h" #include "sgw_lite_messages_types.h"
#include "udp_messages_types.h" #include "udp_messages_types.h"
#include "mme_app_messages_types.h"
#endif /* MESSAGES_TYPES_H_ */ #endif /* MESSAGES_TYPES_H_ */
//WARNING: Do not include this header directly. Use intertask_interface.h instead. //WARNING: Do not include this header directly. Use intertask_interface.h instead.
MESSAGE_DEF(MME_APP_CONNECTION_ESTABLISHMENT_IND , MESSAGE_PRIORITY_MED, mme_app_connection_establishment_ind_t , mme_app_connection_establishment_ind)
MESSAGE_DEF(MME_APP_CONNECTION_ESTABLISHMENT_CNF , MESSAGE_PRIORITY_MED, mme_app_connection_establishment_cnf_t , mme_app_connection_establishment_cnf)
MESSAGE_DEF(MME_APP_INITIAL_CONTEXT_SETUP_RSP , MESSAGE_PRIORITY_MED, mme_app_initial_context_setup_rsp_t , mme_app_initial_context_setup_rsp)
...@@ -2,5 +2,38 @@ ...@@ -2,5 +2,38 @@
#define MME_APP_MESSAGES_TYPES_H_ #define MME_APP_MESSAGES_TYPES_H_
#define MME_APP_CONNECTION_ESTABLISHMENT_IND(mSGpTR) (mSGpTR)->ittiMsg.mme_app_connection_establishment_ind
#define MME_APP_CONNECTION_ESTABLISHMENT_CNF(mSGpTR) (mSGpTR)->ittiMsg.mme_app_connection_establishment_cnf
#define MME_APP_INITIAL_CONTEXT_SETUP_RSP(mSGpTR) (mSGpTR)->ittiMsg.mme_app_initial_context_setup_rsp
typedef struct mme_app_connection_establishment_ind_s {
uint32_t mme_ue_s1ap_id;
nas_establish_ind_t nas;
/* Transparent message from s1ap to be forwarded to MME_APP or
* to S1AP if connection establishment is rejected by NAS.
*/
s1ap_initial_ue_message_t transparent;
} mme_app_connection_establishment_ind_t;
typedef struct mme_app_connection_establishment_cnf_s {
ebi_t eps_bearer_id;
FTeid_t bearer_s1u_sgw_fteid;
qci_t bearer_qos_qci;
priority_level_t bearer_qos_prio_level;
pre_emp_vulnerability_t bearer_qos_pre_emp_vulnerability;
pre_emp_capability_t bearer_qos_pre_emp_capability;
ambr_t ambr;
nas_conn_est_cnf_t nas_conn_est_cnf;
} mme_app_connection_establishment_cnf_t;
typedef struct mme_app_initial_context_setup_rsp_s {
uint32_t mme_ue_s1ap_id;
ebi_t eps_bearer_id;
FTeid_t bearer_s1u_enb_fteid;
} mme_app_initial_context_setup_rsp_t;
#endif /* MME_APP_MESSAGES_TYPES_H_ */ #endif /* MME_APP_MESSAGES_TYPES_H_ */
...@@ -35,9 +35,10 @@ MESSAGE_DEF(NAS_RAB_RELEASE_REQ, MESSAGE_PRIORITY_MED, nas_rab_ ...@@ -35,9 +35,10 @@ MESSAGE_DEF(NAS_RAB_RELEASE_REQ, MESSAGE_PRIORITY_MED, nas_rab_
MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_REQ, MESSAGE_PRIORITY_MED, nas_auth_param_req_t, nas_auth_param_req) MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_REQ, MESSAGE_PRIORITY_MED, nas_auth_param_req_t, nas_auth_param_req)
/* MME app -> NAS layer messages */ /* MME app -> NAS layer messages */
MESSAGE_DEF(NAS_BEARER_PARAM, MESSAGE_PRIORITY_MED, nas_bearer_param_t, nas_bearer_param) MESSAGE_DEF(NAS_PDN_CONNECTIVITY_RSP, MESSAGE_PRIORITY_MED, nas_pdn_connectivity_rsp_t, nas_pdn_connectivity_rsp)
MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_RSP, MESSAGE_PRIORITY_MED, nas_auth_param_rsp_t, nas_auth_param_rsp) MESSAGE_DEF(NAS_PDN_CONNECTIVITY_FAIL, MESSAGE_PRIORITY_MED, nas_pdn_connectivity_fail_t, nas_pdn_connectivity_fail)
MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_FAIL, MESSAGE_PRIORITY_MED, nas_auth_param_fail_t, nas_auth_param_fail) MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_RSP, MESSAGE_PRIORITY_MED, nas_auth_param_rsp_t, nas_auth_param_rsp)
MESSAGE_DEF(NAS_AUTHENTICATION_PARAM_FAIL, MESSAGE_PRIORITY_MED, nas_auth_param_fail_t, nas_auth_param_fail)
#if defined(DISABLE_USE_NAS) #if defined(DISABLE_USE_NAS)
MESSAGE_DEF(NAS_ATTACH_REQ, MESSAGE_PRIORITY_MED, nas_attach_req_t, nas_attach_req) MESSAGE_DEF(NAS_ATTACH_REQ, MESSAGE_PRIORITY_MED, nas_attach_req_t, nas_attach_req)
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#define NAS_DL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_req #define NAS_DL_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_req
#define NAS_DL_DATA_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_cnf #define NAS_DL_DATA_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_dl_data_cnf
#define NAS_PDN_CONNECTIVITY_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_pdn_connectivity_req #define NAS_PDN_CONNECTIVITY_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_pdn_connectivity_req
#define NAS_PDN_CONNECTIVITY_RSP(mSGpTR) (mSGpTR)->ittiMsg.nas_pdn_connectivity_rsp
#define NAS_PDN_CONNECTIVITY_FAIL(mSGpTR) (mSGpTR)->ittiMsg.nas_pdn_connectivity_fail
#define NAS_CONN_EST_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_ind #define NAS_CONN_EST_IND(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_ind
#define NAS_CONNECTION_ESTABLISHMENT_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_cnf #define NAS_CONNECTION_ESTABLISHMENT_CNF(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_est_cnf
#define NAS_BEARER_PARAM(mSGpTR) (mSGpTR)->ittiMsg.nas_bearer_param #define NAS_BEARER_PARAM(mSGpTR) (mSGpTR)->ittiMsg.nas_bearer_param
...@@ -34,6 +36,8 @@ ...@@ -34,6 +36,8 @@
#define NAS_DATA_LENGHT_MAX 256 #define NAS_DATA_LENGHT_MAX 256
typedef enum { typedef enum {
EMM_MSG_HEADER = 1, EMM_MSG_HEADER = 1,
EMM_MSG_ATTACH_REQUEST, EMM_MSG_ATTACH_REQUEST,
...@@ -67,6 +71,8 @@ typedef enum { ...@@ -67,6 +71,8 @@ typedef enum {
EMM_MSG_CS_SERVICE_NOTIFICATION, EMM_MSG_CS_SERVICE_NOTIFICATION,
} emm_message_ids_t; } emm_message_ids_t;
typedef enum { typedef enum {
ESM_MSG_HEADER = 1, ESM_MSG_HEADER = 1,
ESM_MSG_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST, ESM_MSG_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST,
...@@ -93,50 +99,103 @@ typedef enum { ...@@ -93,50 +99,103 @@ typedef enum {
ESM_MSG_ESM_STATUS, ESM_MSG_ESM_STATUS,
} esm_message_ids_t; } esm_message_ids_t;
typedef struct nas_raw_msg_s { typedef struct nas_raw_msg_s {
uint32_t lenght; uint32_t lenght;
uint8_t data[NAS_DATA_LENGHT_MAX]; uint8_t data[NAS_DATA_LENGHT_MAX];
} nas_raw_msg_t; } nas_raw_msg_t;
typedef struct nas_emm_plain_msg_s { typedef struct nas_emm_plain_msg_s {
emm_message_ids_t present; emm_message_ids_t present;
EMM_msg choice; EMM_msg choice;
} nas_emm_plain_msg_t; } nas_emm_plain_msg_t;
typedef struct nas_emm_protected_msg_s { typedef struct nas_emm_protected_msg_s {
nas_message_security_header_t header; nas_message_security_header_t header;
emm_message_ids_t present; emm_message_ids_t present;
EMM_msg choice; EMM_msg choice;
} nas_emm_protected_msg_t; } nas_emm_protected_msg_t;
typedef struct nas_esm_plain_msg_s { typedef struct nas_esm_plain_msg_s {
esm_message_ids_t present; esm_message_ids_t present;
ESM_msg choice; ESM_msg choice;
} nas_esm_plain_msg_t; } nas_esm_plain_msg_t;
typedef struct nas_esm_protected_msg_s { typedef struct nas_esm_protected_msg_s {
nas_message_security_header_t header; nas_message_security_header_t header;
esm_message_ids_t present; esm_message_ids_t present;
ESM_msg choice; ESM_msg choice;
} nas_esm_protected_msg_t; } nas_esm_protected_msg_t;
typedef struct nas_paging_ind_s { typedef struct nas_paging_ind_s {
} nas_paging_ind_t; } nas_paging_ind_t;
typedef struct nas_pdn_connectivity_req_s { typedef struct nas_pdn_connectivity_req_s {
char imsi[16]; int pti; // nas ref Identity of the procedure transaction executed to activate the PDN connection entry
uint8_t imsi_length; unsigned ue_id; // nas ref
OctetString apn; char imsi[16];
OctetString pdn_addr; uint8_t imsi_length;
int mme_pdn_index; network_qos_t qos;
network_qos_t esm_qos; OctetString apn;
int is_emergency; OctetString pdn_addr;
int pdn_type;
void *proc_data;
int request_type;
} nas_pdn_connectivity_req_t; } nas_pdn_connectivity_req_t;
typedef struct nas_pdn_connectivity_rsp_s {
int pti; // nas ref Identity of the procedure transaction executed to activate the PDN connection entry
unsigned ue_id; // nas ref
network_qos_t qos;
OctetString apn;
OctetString pdn_addr;
int pdn_type;
void *proc_data;
int request_type;
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
/* Key eNB */
uint8_t keNB[32];
ambr_t ambr;
ambr_t apn_ambr;
/* EPS bearer ID */
unsigned ebi:4;
/* QoS */
qci_t qci;
priority_level_t prio_level;
pre_emp_vulnerability_t pre_emp_vulnerability;
pre_emp_capability_t pre_emp_capability;
/* S-GW TEID for user-plane */
Teid_t sgw_s1u_teid;
/* S-GW IP address for User-Plane */
ip_address_t sgw_s1u_address;
} nas_pdn_connectivity_rsp_t;
typedef struct nas_pdn_connectivity_fail_s {
unsigned ue_id; // nas ref
} nas_pdn_connectivity_fail_t;
typedef struct nas_conn_est_ind_s { typedef struct nas_conn_est_ind_s {
nas_establish_ind_t nas; nas_establish_ind_t nas;
...@@ -146,8 +205,10 @@ typedef struct nas_conn_est_ind_s { ...@@ -146,8 +205,10 @@ typedef struct nas_conn_est_ind_s {
s1ap_initial_ue_message_t transparent; s1ap_initial_ue_message_t transparent;
} nas_conn_est_ind_t; } nas_conn_est_ind_t;
typedef nas_establish_rsp_t nas_conn_est_rej_t; typedef nas_establish_rsp_t nas_conn_est_rej_t;
#if defined(DISABLE_USE_NAS) #if defined(DISABLE_USE_NAS)
typedef struct nas_conn_est_cnf_s { typedef struct nas_conn_est_cnf_s {
uint32_t ue_id; uint32_t ue_id;
...@@ -160,56 +221,35 @@ typedef struct nas_conn_est_cnf_s { ...@@ -160,56 +221,35 @@ typedef struct nas_conn_est_cnf_s {
typedef nas_establish_cnf_t nas_conn_est_cnf_t; typedef nas_establish_cnf_t nas_conn_est_cnf_t;
#endif #endif
typedef struct nas_bearer_param_s {
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
/* Key eNB */
uint8_t keNB[32];
ambr_t ambr;
ambr_t apn_ambr;
/* EPS bearer ID */
unsigned ebi:4;
/* QoS */
qci_t qci;
priority_level_t prio_level;
pre_emp_vulnerability_t pre_emp_vulnerability;
pre_emp_capability_t pre_emp_capability;
/* S-GW TEID for user-plane */
uint32_t sgw_s1u_teid;
/* S-GW IP address for User-Plane */
ip_address_t sgw_s1u_address;
} nas_bearer_param_t;
typedef struct nas_conn_rel_ind_s { typedef struct nas_conn_rel_ind_s {
} nas_conn_rel_ind_t; } nas_conn_rel_ind_t;
typedef ul_info_transfer_ind_t nas_ul_data_ind_t; typedef ul_info_transfer_ind_t nas_ul_data_ind_t;
typedef dl_info_transfer_req_t nas_dl_data_req_t; typedef dl_info_transfer_req_t nas_dl_data_req_t;
typedef dl_info_transfer_cnf_t nas_dl_data_cnf_t; typedef dl_info_transfer_cnf_t nas_dl_data_cnf_t;
typedef struct nas_non_del_ind_s { typedef struct nas_non_del_ind_s {
} nas_non_del_ind_t; } nas_non_del_ind_t;
typedef struct nas_rab_est_req_s { typedef struct nas_rab_est_req_s {
} nas_rab_est_req_t; } nas_rab_est_req_t;
typedef struct nas_rab_est_rsp_s { typedef struct nas_rab_est_rsp_s {
} nas_rab_est_rsp_t; } nas_rab_est_rsp_t;
typedef struct nas_rab_rel_req_s { typedef struct nas_rab_rel_req_s {
} nas_rab_rel_req_t; } nas_rab_rel_req_t;
typedef struct nas_attach_req_s { typedef struct nas_attach_req_s {
/* TODO: Set the correct size */ /* TODO: Set the correct size */
char apn[100]; char apn[100];
...@@ -219,6 +259,7 @@ typedef struct nas_attach_req_s { ...@@ -219,6 +259,7 @@ typedef struct nas_attach_req_s {
s1ap_initial_ue_message_t transparent; s1ap_initial_ue_message_t transparent;
} nas_attach_req_t; } nas_attach_req_t;
typedef struct nas_auth_req_s { typedef struct nas_auth_req_s {
/* UE imsi */ /* UE imsi */
char imsi[16]; char imsi[16];
...@@ -229,6 +270,7 @@ typedef struct nas_auth_req_s { ...@@ -229,6 +270,7 @@ typedef struct nas_auth_req_s {
int cause; int cause;
} nas_auth_req_t; } nas_auth_req_t;
typedef struct nas_auth_resp_s { typedef struct nas_auth_resp_s {
char imsi[16]; char imsi[16];
} nas_auth_resp_t; } nas_auth_resp_t;
...@@ -244,10 +286,11 @@ typedef struct nas_auth_param_req_s { ...@@ -244,10 +286,11 @@ typedef struct nas_auth_param_req_s {
/* Indicates whether the procedure corresponds to a new connection or not */ /* Indicates whether the procedure corresponds to a new connection or not */
uint8_t initial_req:1; uint8_t initial_req:1;
uint8_t re_synchronization:1; uint8_t re_synchronization:1;
uint8_t auts[14]; uint8_t auts[14];
} nas_auth_param_req_t; } nas_auth_param_req_t;
typedef struct nas_auth_param_rsp_s { typedef struct nas_auth_param_rsp_s {
/* UE identifier */ /* UE identifier */
uint32_t ue_id; uint32_t ue_id;
...@@ -267,6 +310,7 @@ typedef struct nas_auth_param_fail_s { ...@@ -267,6 +310,7 @@ typedef struct nas_auth_param_fail_s {
nas_cause_t cause; nas_cause_t cause;
} nas_auth_param_fail_t; } nas_auth_param_fail_t;
#if defined(DISABLE_USE_NAS) #if defined(DISABLE_USE_NAS)
typedef struct nas_attach_accept_s { typedef struct nas_attach_accept_s {
s1ap_initial_ctxt_setup_req_t transparent; s1ap_initial_ctxt_setup_req_t transparent;
......
...@@ -5,23 +5,23 @@ ...@@ -5,23 +5,23 @@
#define S1AP_DEREGISTER_UE_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_deregister_ue_req #define S1AP_DEREGISTER_UE_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_deregister_ue_req
typedef struct s1ap_initial_ue_message_s { typedef struct s1ap_initial_ue_message_s {
unsigned eNB_ue_s1ap_id:24; unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id; uint32_t mme_ue_s1ap_id;
cgi_t e_utran_cgi; cgi_t e_utran_cgi;
} s1ap_initial_ue_message_t; } s1ap_initial_ue_message_t;
typedef struct s1ap_initial_ctxt_setup_req_s { typedef struct s1ap_initial_ctxt_setup_req_s {
unsigned eNB_ue_s1ap_id:24; unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id; uint32_t mme_ue_s1ap_id;
/* Key eNB */ /* Key eNB */
uint8_t keNB[32]; uint8_t keNB[32];
ambr_t ambr; ambr_t ambr;
ambr_t apn_ambr; ambr_t apn_ambr;
/* EPS bearer ID */ /* EPS bearer ID */
unsigned ebi:4; unsigned ebi:4;
/* QoS */ /* QoS */
qci_t qci; qci_t qci;
...@@ -30,16 +30,16 @@ typedef struct s1ap_initial_ctxt_setup_req_s { ...@@ -30,16 +30,16 @@ typedef struct s1ap_initial_ctxt_setup_req_s {
pre_emp_capability_t pre_emp_capability; pre_emp_capability_t pre_emp_capability;
/* S-GW TEID for user-plane */ /* S-GW TEID for user-plane */
uint32_t teid; Teid_t teid;
/* S-GW IP address for User-Plane */ /* S-GW IP address for User-Plane */
ip_address_t s_gw_address; ip_address_t s_gw_address;
} s1ap_initial_ctxt_setup_req_t; } s1ap_initial_ctxt_setup_req_t;
typedef struct s1ap_ue_cap_ind_s { typedef struct s1ap_ue_cap_ind_s {
unsigned eNB_ue_s1ap_id:24; unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id; uint32_t mme_ue_s1ap_id;
uint8_t radio_capabilities[100]; uint8_t radio_capabilities[100];
uint32_t radio_capabilities_length; uint32_t radio_capabilities_length;
} s1ap_ue_cap_ind_t; } s1ap_ue_cap_ind_t;
#define S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE 20 #define S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE 20
......
...@@ -5,23 +5,37 @@ ...@@ -5,23 +5,37 @@
typedef struct s6a_update_location_req_s { typedef struct s6a_update_location_req_s {
#define SKIP_SUBSCRIBER_DATA (0x1) #define SKIP_SUBSCRIBER_DATA (0x1)
unsigned skip_subsriber_data:1; unsigned skip_subscriber_data:1;
#define INITIAL_ATTACH (0x1) #define INITIAL_ATTACH (0x1)
unsigned initial_attach:1; unsigned initial_attach:1;
char imsi[IMSI_DIGITS_MAX + 1]; char imsi[IMSI_DIGITS_MAX + 1]; // username
uint8_t imsi_length; uint8_t imsi_length; // username
plmn_t visited_plmn;
rat_type_t rat_type; plmn_t visited_plmn; // visited plmn id
rat_type_t rat_type; // rat type
// missing // origin host
// missing // origin realm
// missing // destination host
// missing // destination realm
} s6a_update_location_req_t; } s6a_update_location_req_t;
typedef struct s6a_update_location_ans_s { typedef struct s6a_update_location_ans_s {
s6a_result_t result; // Result of the update location request procedure
subscription_data_t subscription_data; // subscriber status,
// Maximum Requested Bandwidth Uplink, downlink
// access restriction data
// msisdn
apn_config_profile_t apn_config_profile;// APN configuration profile
network_access_mode_t access_mode;
rau_tau_timer_t rau_tau_timer;
char imsi[IMSI_DIGITS_MAX + 1]; char imsi[IMSI_DIGITS_MAX + 1];
uint8_t imsi_length; uint8_t imsi_length;
/* Result of the update location request procedure */
s6a_result_t result;
subscription_data_t subscription_data;
} s6a_update_location_ans_t; } s6a_update_location_ans_t;
typedef struct s6a_auth_info_req_s { typedef struct s6a_auth_info_req_s {
......
This diff is collapsed.
...@@ -535,6 +535,9 @@ static int gtpv1u_create_s1u_tunnel(gtpv1u_enb_create_tunnel_req_t *create_tunne ...@@ -535,6 +535,9 @@ static int gtpv1u_create_s1u_tunnel(gtpv1u_enb_create_tunnel_req_t *create_tunne
int i; int i;
ebi_t eps_bearer_id = 0; ebi_t eps_bearer_id = 0;
int ipv4_addr = 0; int ipv4_addr = 0;
int ip_offset = 0;
in_addr_t in_addr;
int addrs_length_in_bytes= 0;
message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_ENB_CREATE_TUNNEL_RESP); message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_ENB_CREATE_TUNNEL_RESP);
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).ue_index = create_tunnel_req_pP->ue_index; GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).ue_index = create_tunnel_req_pP->ue_index;
...@@ -542,6 +545,7 @@ static int gtpv1u_create_s1u_tunnel(gtpv1u_enb_create_tunnel_req_t *create_tunne ...@@ -542,6 +545,7 @@ static int gtpv1u_create_s1u_tunnel(gtpv1u_enb_create_tunnel_req_t *create_tunne
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).num_tunnels = 0; GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).num_tunnels = 0;
for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) { for (i = 0; i < create_tunnel_req_pP->num_tunnels; i++) {
ip_offset = 0;
eps_bearer_id = create_tunnel_req_pP->eps_bearer_id[i]; eps_bearer_id = create_tunnel_req_pP->eps_bearer_id[i];
GTPU_DEBUG("Rx GTPV1U_ENB_CREATE_TUNNEL_REQ ue_index %u eps bearer id %u\n", GTPU_DEBUG("Rx GTPV1U_ENB_CREATE_TUNNEL_REQ ue_index %u eps bearer id %u\n",
create_tunnel_req_pP->ue_index, eps_bearer_id); create_tunnel_req_pP->ue_index, eps_bearer_id);
...@@ -564,36 +568,44 @@ static int gtpv1u_create_s1u_tunnel(gtpv1u_enb_create_tunnel_req_t *create_tunne ...@@ -564,36 +568,44 @@ static int gtpv1u_create_s1u_tunnel(gtpv1u_enb_create_tunnel_req_t *create_tunne
// PDCP->GTPV1U mapping // PDCP->GTPV1U mapping
//----------------------- //-----------------------
hash_rc = hashtable_get(gtpv1u_data_g.ue_mapping, create_tunnel_req_pP->ue_index, (void **)&gtpv1u_ue_data_p); hash_rc = hashtable_get(gtpv1u_data_g.ue_mapping, create_tunnel_req_pP->ue_index, (void **)&gtpv1u_ue_data_p);
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { if ((hash_rc == HASH_TABLE_KEY_NOT_EXISTS) || (hash_rc == HASH_TABLE_OK)) {
gtpv1u_ue_data_p = calloc (1, sizeof(gtpv1u_ue_data_t));
gtpv1u_ue_data_p->ue_id = create_tunnel_req_pP->ue_index;
gtpv1u_ue_data_p->instance_id = 0; // TO DO
memcpy(&GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.buffer,
&gtpv1u_data_g.enb_ip_address_for_S1u_S12_S4_up,
sizeof (in_addr_t));
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.length = sizeof (in_addr_t);
AssertFatal(create_tunnel_req_pP->sgw_addr[i].length == 4, "Bad transport layer address for next operation, TO DO");
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr = *((in_addr_t*)create_tunnel_req_pP->sgw_addr[i].buffer);
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].state = BEARER_IN_CONFIG; if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_eNB = s1u_teid; gtpv1u_ue_data_p = calloc (1, sizeof(gtpv1u_ue_data_t));
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_sgw = create_tunnel_req_pP->sgw_S1u_teid[i]; hash_rc = hashtable_insert(gtpv1u_data_g.ue_mapping, create_tunnel_req_pP->ue_index, gtpv1u_ue_data_p);
hash_rc = hashtable_insert(gtpv1u_data_g.ue_mapping, create_tunnel_req_pP->ue_index, gtpv1u_ue_data_p); AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting ue_mapping in GTPV1U hashtable");
AssertFatal(hash_rc == HASH_TABLE_OK, "Error inserting ue_mapping in GTPV1U hashtable"); }
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_S1u_teid[i] = s1u_teid;
} else if (hash_rc == HASH_TABLE_OK) {
gtpv1u_ue_data_p->ue_id = create_tunnel_req_pP->ue_index; gtpv1u_ue_data_p->ue_id = create_tunnel_req_pP->ue_index;
gtpv1u_ue_data_p->instance_id = 0; // TO DO gtpv1u_ue_data_p->instance_id = 0; // TO DO
memcpy(&GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.buffer, memcpy(&GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.buffer,
&gtpv1u_data_g.enb_ip_address_for_S1u_S12_S4_up, &gtpv1u_data_g.enb_ip_address_for_S1u_S12_S4_up,
sizeof (in_addr_t)); sizeof (in_addr_t));
GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.length = sizeof (in_addr_t); GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).enb_addr.length = sizeof (in_addr_t);
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr = *((in_addr_t*)create_tunnel_req_pP->sgw_addr[i].buffer);
addrs_length_in_bytes = create_tunnel_req_pP->sgw_addr[i].length / 8;
AssertFatal((addrs_length_in_bytes == 4) ||
(addrs_length_in_bytes == 16) ||
(addrs_length_in_bytes == 20),
"Bad transport layer address length %d (bits) %d (bytes)",
create_tunnel_req_pP->sgw_addr[i].length, addrs_length_in_bytes);
if ((addrs_length_in_bytes == 4) ||
(addrs_length_in_bytes == 20)) {
in_addr = *((in_addr_t*)create_tunnel_req_pP->sgw_addr[i].buffer);
ip_offset = 4;
gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr = in_addr;
}
if ((addrs_length_in_bytes == 16) ||