Commit fb09ba8e authored by gauthier's avatar gauthier

OK for start of MME_GW and HSS on same host

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7110 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent ecff2e01
......@@ -349,6 +349,10 @@ _gtpuah_tg4_add(struct sk_buff *old_skb_pP, const struct xt_action_param *par_pP
}
}
};
/*pr_info("GTPUAH: PACKET -> NF_HOOK NF_INET_POST_ROUTING/%s encapsulated src: %u.%u.%u.%u dst: %u.%u.%u.%u\n",
gtpuah_tg_reg[0].table,
NIPADDR(old_iph_p->saddr),
NIPADDR(old_iph_p->daddr));*/
rt = ip_route_output_key(&init_net, &fl.u.ip4);
......
This diff is collapsed.
......@@ -58,7 +58,7 @@ typedef enum {
typedef struct gtpv1u_teid_data_s {
/* UE identifier for oaisim stack */
module_id_t enb_id;
module_id_t ue_id;
rnti_t ue_id;
ebi_t eps_bearer_id;
} gtpv1u_teid_data_t;
......@@ -76,7 +76,7 @@ typedef struct gtpv1u_bearer_s {
typedef struct gtpv1u_ue_data_s {
/* UE identifier for oaisim stack */
module_id_t ue_id;
rnti_t ue_id;
/* Unique identifier used between PDCP and GTP-U to distinguish UEs */
uint32_t instance_id;
......@@ -121,12 +121,13 @@ typedef struct gtpv1u_data_s {
int
gtpv1u_new_data_req(
uint8_t enb_id,
uint8_t ue_id,
uint8_t rab_id,
uint8_t *buffer,
uint32_t buf_len,
uint32_t buf_offset);
uint8_t enb_module_idP,
rnti_t ue_rntiP,
uint8_t rab_idP,
uint8_t *buffer_pP,
uint32_t buf_lenP,
uint32_t buf_offsetP
);
int
gtpv1u_initial_req(
......
......@@ -54,7 +54,9 @@
//static NwGtpv1uStackHandleT gtpv1u_stack = 0;
static gtpv1u_data_t gtpv1u_sgw_data;
#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
static int gtpv1u_send_init_udp(uint16_t port_number);
#endif
static int gtpv1u_create_s1u_tunnel(Gtpv1uCreateTunnelReq *create_tunnel_reqP);
static int gtpv1u_delete_s1u_tunnel(Teid_t context_teidP, Teid_t S1U_teidP);
static int gtpv1u_update_s1u_tunnel(Gtpv1uUpdateTunnelReq *reqP);
......@@ -147,6 +149,7 @@ void gtpu_print_hex_octets(unsigned char* dataP, unsigned long sizeP)
}
#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
static int gtpv1u_send_init_udp(uint16_t port_number)
{
// Create and alloc new message
......@@ -168,6 +171,7 @@ static int gtpv1u_send_init_udp(uint16_t port_number)
return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
}
#endif
NwGtpv1uRcT gtpv1u_log_request(NwGtpv1uLogMgrHandleT hLogMgr,
NwU32T logLevel,
......@@ -179,6 +183,7 @@ NwGtpv1uRcT gtpv1u_log_request(NwGtpv1uLogMgrHandleT hLogMgr,
return NW_GTPV1U_OK;
}
#if !defined(ENABLE_USE_GTPU_IN_KERNEL)
NwGtpv1uRcT gtpv1u_send_udp_msg(
NwGtpv1uUdpHandleT udpHandle,
NwU8T *buffer,
......@@ -203,7 +208,7 @@ NwGtpv1uRcT gtpv1u_send_udp_msg(
return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
}
#endif
/* Callback called when a gtpv1u message arrived on UDP interface */
NwGtpv1uRcT gtpv1u_process_stack_req(
NwGtpv1uUlpHandleT hUlp,
......
......@@ -128,6 +128,7 @@ nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
{
NwGtpv1uStackT *pStack = (NwGtpv1uStackT *) hGtpuStackHandle;
NwGtpv1uMsgT *pMsg;
//NwU32T header_len = 0;
NwU32T msgExtraLen = 0;
if(gpGtpv1uMsgPool) {
......
......@@ -45,19 +45,20 @@
#include "assertions.h"
static
int mme_app_request_authentication_info(const mme_app_imsi_t imsi,
int mme_app_request_authentication_info(const char *imsi,
const uint8_t nb_of_vectors,
const plmn_t *plmn,
const uint8_t *auts);
static
int mme_app_request_authentication_info(const mme_app_imsi_t imsi,
int mme_app_request_authentication_info(const char *imsi,
const uint8_t nb_of_vectors,
const plmn_t *plmn,
const uint8_t *auts)
{
s6a_auth_info_req_t *auth_info_req = NULL;
MessageDef *message_p = NULL;
int imsi_length = strlen(imsi);
DevAssert(plmn != NULL);
......@@ -66,7 +67,9 @@ int mme_app_request_authentication_info(const mme_app_imsi_t imsi,
auth_info_req = &message_p->ittiMsg.s6a_auth_info_req;
memset(auth_info_req, 0, sizeof(*auth_info_req));
auth_info_req->imsi_length = MME_APP_IMSI_TO_STRING(imsi, auth_info_req->imsi);
strncpy(auth_info_req->imsi, imsi, imsi_length);
auth_info_req->imsi_length = imsi_length;
//MME_APP_IMSI_TO_STRING(imsi, auth_info_req->imsi);
memcpy(&auth_info_req->visited_plmn, plmn, sizeof(plmn_t));
MME_APP_DEBUG("%s visited_plmn MCC %X%X%X MNC %X%X%X\n",
......@@ -214,122 +217,7 @@ mme_app_handle_authentication_info_answer(
return 0;
}
#if defined(DISABLE_USE_NAS)
int mme_app_handle_attach_req(nas_attach_req_t *attach_req_p)
{
/* An attach request has been received from NAS layer.
* If the UE authentication vectors for the UE are known within MME then the
* authentication procedure should be triggered only if the request is an
* initial attach, otherwise an update location should be sent to the HSS
* and default bearer should be established for the provided APN.
* In case of initial attach procedure, the default APN retrieved from the
* HSS will be used to establish the default bearer within EPC.
* The default APN is the one that matches the context-identifier
*/
struct ue_context_s *ue_context;
uint64_t imsi = 0;
DevAssert(attach_req_p != NULL);
MME_APP_STRING_TO_IMSI((char *)attach_req_p->imsi, &imsi);
MME_APP_DEBUG("Handling imsi %"IMSI_FORMAT"\n", imsi);
ue_context = mme_ue_context_exists_imsi(&mme_app_desc.mme_ue_contexts, imsi);
if (ue_context == NULL) {
/* The MME doesn't know this IMSI.
* Insert the UE to the list of known equipements and
* Retrieve the authentication vector from HSS.
*/
MME_APP_DEBUG("UE context doesn't exist -> create one\n");
if ((ue_context = mme_create_new_ue_context()) == NULL) {
/* Error during ue context malloc */
/* TODO */
DevMessage("mme_create_new_ue_context");
return -1;
}
ue_context->imsi = imsi;
ue_context->eNB_ue_s1ap_id = attach_req_p->transparent.eNB_ue_s1ap_id;
ue_context->mme_ue_s1ap_id = attach_req_p->transparent.mme_ue_s1ap_id;
ue_context->ue_id = attach_req_p->transparent.mme_ue_s1ap_id;
// STAILQ_INIT(&ue_context->vector_list);
DevAssert(mme_insert_ue_context(&mme_app_desc.mme_ue_contexts, ue_context) == 0);
goto request_auth;
} else {
/* MME knows this IMSI, check if UE is authenticated and authentication
* vectors are known.
*/
MME_APP_DEBUG("UE context already exists, use it\n");
/* Update mme ue s1ap id */
ue_context->mme_ue_s1ap_id = attach_req_p->transparent.mme_ue_s1ap_id;
if ((ue_context->imsi_auth == IMSI_AUTHENTICATED) &&
(attach_req_p->initial != INITIAL_REQUEST)) {
/* We have to send an update location request to the HSS */
MME_APP_DEBUG("UE is authenticated\n");
} else {
MME_APP_DEBUG("UE is not authenticated\n");
/* UE is not authenticated or an initial request */
// if (STAILQ_EMPTY(&ue_context->vector_list))
if (ue_context->nb_of_vectors == 0)
request_auth: {
/* We have no vector for this UE, send an authentication request
* to the HSS.
*/
AssertFatal(0, "Hardcoded MCC/MNC");
plmn_t plmn = {
.MCCdigit2 = 0,
.MCCdigit1 = 8,
.MCCdigit3 = 2,
.MNCdigit1 = 0,
.MNCdigit2 = 4,
.MNCdigit3 = 3,
};
memcpy(&ue_context->e_utran_cgi, &attach_req_p->transparent.e_utran_cgi,
sizeof(cgi_t));
/* Acquire the current time */
time(&ue_context->cell_age);
/* Some random values for GUTI */
ue_context->guti.m_tmsi = 0x24568956;
ue_context->guti.gummei.MMEcode = 0x01;
ue_context->guti.gummei.MMEgid = 0x5691;
memcpy(&ue_context->guti.gummei.plmn, &plmn, sizeof(plmn_t));
MME_APP_DEBUG("and we have no auth. vector for it, request"
" authentication information\n");
// mme_app_dump_ue_contexts();
mme_app_request_authentication_info(imsi, 1, &plmn, NULL);
} else {
nas_auth_req_t *nas_auth_req_p;
MessageDef *message_p;
/* We have a vector... USE it */
MME_APP_DEBUG("but we have an auth. vector for it, request"
" authentication from NAS\n");
message_p = itti_alloc_new_message(TASK_MME_APP, NAS_AUTHENTICATION_PARAM_FAIL);
nas_auth_req_p = &message_p->ittiMsg.nas_auth_req;
MME_APP_IMSI_TO_STRING(imsi, nas_auth_req_p->imsi);
nas_auth_req_p->failure = NAS_FAILURE_OK;
return itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
}
}
}
return 0;
}
#else
void
mme_app_handle_nas_auth_param_req(
const nas_auth_param_req_t * const nas_auth_param_req_pP)
......@@ -354,13 +242,14 @@ mme_app_handle_nas_auth_param_req(
visited_plmn_from_req.MCCdigit2 = nas_auth_param_req_pP->imsi[1];
visited_plmn_from_req.MCCdigit3 = nas_auth_param_req_pP->imsi[2];
mnc_length = find_mnc_length(nas_auth_param_req_pP->imsi[0],
nas_auth_param_req_pP->imsi[1],
nas_auth_param_req_pP->imsi[2],
nas_auth_param_req_pP->imsi[3],
nas_auth_param_req_pP->imsi[4],
nas_auth_param_req_pP->imsi[5]
);
mnc_length = find_mnc_length(
nas_auth_param_req_pP->imsi[0],
nas_auth_param_req_pP->imsi[1],
nas_auth_param_req_pP->imsi[2],
nas_auth_param_req_pP->imsi[3],
nas_auth_param_req_pP->imsi[4],
nas_auth_param_req_pP->imsi[5]
);
if (mnc_length == 2) {
visited_plmn_from_req.MNCdigit1 = nas_auth_param_req_pP->imsi[3];
......@@ -439,11 +328,10 @@ mme_app_handle_nas_auth_param_req(
memcpy(&ue_context->guti.gummei.plmn, visited_plmn, sizeof(plmn_t));
MME_APP_DEBUG("and we have no auth. vector for it, request"
" authentication information\n");
mme_app_request_authentication_info(imsi, 1, visited_plmn, NULL);
mme_app_request_authentication_info(nas_auth_param_req_pP->imsi, 1, visited_plmn, NULL);
} else {
memcpy(&ue_context->guti.gummei.plmn, visited_plmn, sizeof(plmn_t));
mme_app_request_authentication_info(imsi, 1, visited_plmn, nas_auth_param_req_pP->auts);
mme_app_request_authentication_info(nas_auth_param_req_pP->imsi, 1, visited_plmn, nas_auth_param_req_pP->auts);
}
}
#endif
......@@ -50,8 +50,8 @@
#include "mme_app_ue_context.h"
#include "mme_app_defs.h"
static inline int ue_context_compare_identifiers(struct ue_context_s *p1,
struct ue_context_s *p2);
int ue_context_compare_identifiers(struct ue_context_s *p1,
struct ue_context_s *p2);
RB_PROTOTYPE(ue_context_map, ue_context_s, rb_entry,
ue_context_compare_identifiers);
......@@ -59,7 +59,7 @@ RB_PROTOTYPE(ue_context_map, ue_context_s, rb_entry,
RB_GENERATE(ue_context_map, ue_context_s, rb_entry,
ue_context_compare_identifiers);
static inline int ue_context_compare_identifiers(
extern inline int ue_context_compare_identifiers(
struct ue_context_s *p1, struct ue_context_s *p2)
{
MME_APP_DEBUG(" ue_context_compare_identifiers IMSI %"SCNu64"\n", p1->imsi);
......@@ -68,6 +68,8 @@ static inline int ue_context_compare_identifiers(
MME_APP_DEBUG(" ue_context_compare_identifiers ue_id %08x\n" , p1->ue_id);
if (p1->imsi > 0) {
MME_APP_DEBUG(" with IMSI %"SCNu64"\n", p2->imsi);
/* if IMSI provided */
if (p1->imsi > p2->imsi) {
return 1;
......@@ -77,6 +79,8 @@ static inline int ue_context_compare_identifiers(
return -1;
}
} else if (p1->mme_s11_teid > 0) {
MME_APP_DEBUG(" with mme_s11_teid %08x\n", p2->mme_s11_teid);
/* if s11 teid provided */
if (p1->mme_s11_teid > p2->mme_s11_teid) {
return 1;
......@@ -86,7 +90,7 @@ static inline int ue_context_compare_identifiers(
return -1;
}
} else if (p1->mme_ue_s1ap_id > 0) {
MME_APP_DEBUG(" with mme_ue_s1ap_id %d\n" , p2->mme_ue_s1ap_id);
MME_APP_DEBUG(" with mme_ue_s1ap_id %08x\n", p2->mme_ue_s1ap_id);
/* if s1ap ue id provided */
if (p1->mme_ue_s1ap_id > p2->mme_ue_s1ap_id) {
......@@ -97,6 +101,8 @@ static inline int ue_context_compare_identifiers(
return -1;
}
} else if (p1->ue_id > 0) {
MME_APP_DEBUG(" with ue_id %08x\n", p2->ue_id);
/* if nas ue_id provided */
if (p1->ue_id > p2->ue_id) {
return 1;
......@@ -152,7 +158,7 @@ ue_context_t *mme_create_new_ue_context(void)
return new_p;
}
inline
struct ue_context_s *mme_ue_context_exists_imsi(mme_ue_context_t *mme_ue_context,
mme_app_imsi_t imsi)
{
......@@ -166,7 +172,7 @@ struct ue_context_s *mme_ue_context_exists_imsi(mme_ue_context_t *mme_ue_context
&reference);
}
inline
struct ue_context_s *mme_ue_context_exists_s11_teid(mme_ue_context_t *mme_ue_context,
uint32_t teid)
{
......@@ -180,7 +186,8 @@ struct ue_context_s *mme_ue_context_exists_s11_teid(mme_ue_context_t *mme_ue_con
&reference);
}
inline
ue_context_t *mme_ue_context_exists_mme_ue_s1ap_id(
mme_ue_context_t *mme_ue_context,
uint32_t mme_ue_s1ap_id)
......@@ -195,7 +202,8 @@ ue_context_t *mme_ue_context_exists_mme_ue_s1ap_id(
&reference);
}
inline
ue_context_t *mme_ue_context_exists_nas_ue_id(
mme_ue_context_t *mme_ue_context,
uint32_t nas_ue_id)
......@@ -211,7 +219,8 @@ ue_context_t *mme_ue_context_exists_nas_ue_id(
}
inline
ue_context_t *mme_ue_context_exists_guti(mme_ue_context_t *mme_ue_context,
GUTI_t guti)
{
......
......@@ -200,7 +200,6 @@ typedef struct {
* \param imsi Imsi to find in UE map
* @returns an UE context matching the IMSI or NULL if the context doesn't exists
**/
inline
ue_context_t *mme_ue_context_exists_imsi(mme_ue_context_t *mme_ue_context,
mme_app_imsi_t imsi);
......@@ -208,7 +207,6 @@ ue_context_t *mme_ue_context_exists_imsi(mme_ue_context_t *mme_ue_context,
* \param teid The tunnel endpoint identifier used between MME and S-GW
* @returns an UE context matching the teid or NULL if the context doesn't exists
**/
inline
ue_context_t *mme_ue_context_exists_s11_teid(mme_ue_context_t *mme_ue_context,
uint32_t teid);
......@@ -216,7 +214,6 @@ ue_context_t *mme_ue_context_exists_s11_teid(mme_ue_context_t *mme_ue_context,
* \param mme_ue_s1ap_id The UE id identifier used in S1AP MME (and NAS)
* @returns an UE context matching the mme_ue_s1ap_id or NULL if the context doesn't exists
**/
inline
ue_context_t *mme_ue_context_exists_mme_ue_s1ap_id(mme_ue_context_t *mme_ue_context,
uint32_t mme_ue_s1ap_id);
......@@ -224,7 +221,6 @@ ue_context_t *mme_ue_context_exists_mme_ue_s1ap_id(mme_ue_context_t *mme_ue_cont
* \param nas_ue_id The UE id identifier used in S1AP MME and NAS
* @returns an UE context matching the nas_ue_id or NULL if the context doesn't exists
**/
inline
ue_context_t *mme_ue_context_exists_nas_ue_id(mme_ue_context_t *mme_ue_context,
uint32_t nas_ue_id);
......@@ -232,7 +228,6 @@ ue_context_t *mme_ue_context_exists_nas_ue_id(mme_ue_context_t *mme_ue_context,
* \param guti The GUTI used by the UE
* @returns an UE context matching the guti or NULL if the context doesn't exists
**/
inline
ue_context_t *mme_ue_context_exists_guti(mme_ue_context_t *mme_ue_context,
GUTI_t guti);
......
......@@ -251,14 +251,14 @@ static int _mme_api_pdn_id = 0;
** Others: None **
** **
***************************************************************************/
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
int mme_api_get_emm_config(mme_api_emm_config_t *config,
mme_config_t *mme_config_p)
#else
int mme_api_get_emm_config(mme_api_emm_config_t *config)
#endif
{
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
int i;
#endif
LOG_FUNC_IN;
......@@ -285,7 +285,7 @@ int mme_api_get_emm_config(mme_api_emm_config_t *config)
config->gummei.MMEgid = mme_config_p->gummei.mme_gid[0];
config->gummei.MMEcode = mme_config_p->gummei.mmec[0];
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
/* SR: this config param comes from MME global config */
if (mme_config_p->emergency_attach_supported != 0) {
......
......@@ -47,7 +47,7 @@ Description Implements the API used by the NAS layer running in the MME
#define __MME_API_H__
#ifdef NAS_MME
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
# include "mme_config.h"
# endif
#include "commonDef.h"
......@@ -127,7 +127,7 @@ typedef struct mme_api_tft_s {
/****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
int mme_api_get_emm_config(mme_api_emm_config_t *config,
mme_config_t *mme_config_p);
#else
......
......@@ -54,7 +54,7 @@ Description Defines the layer 3 messages supported by the NAS sublayer
#include <stdlib.h> // malloc, free
#include <string.h> // memcpy
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
# include "nas_itti_messaging.h"
#endif
#include "secu_defs.h"
......@@ -313,7 +313,6 @@ int nas_message_decrypt(
#endif
emm_security_context);
/* Check NAS message integrity */
if (mac != header->message_authentication_code) {
LOG_TRACE(DEBUG,
......@@ -425,6 +424,24 @@ int nas_message_decode(
emm_security_context
);
#define NAS_CODE_TO_BE_MODIFIED 1
#ifdef NAS_CODE_TO_BE_MODIFIED
// According to 3GPP TS 24.301 version 10.15.0 Release 10, 4.4.4.3 Integrity checking of NAS signalling messages in the MME
if ((!emm_security_context) && (mac == 0) && (msg->header.message_authentication_code != 0)) {
// force mac to be the same, but we should check for message types.
// TODO Reverse order of processing in NAS code: decode message type then check MAC
LOG_TRACE(DEBUG,
"Forced computed MAC to be the MSG MAC %04x",
msg->header.message_authentication_code);
mac = msg->header.message_authentication_code;
LOG_TRACE(DEBUG,
"Forced computed MAC to be the same as MAC in message %04x",
msg->header.message_authentication_code);
}
#endif
/* Check NAS message integrity */
if (mac != msg->header.message_authentication_code) {
LOG_TRACE(DEBUG,
......@@ -434,7 +451,7 @@ int nas_message_decode(
LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH);
}
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
/* Log message header */
#endif
......@@ -566,7 +583,7 @@ int nas_message_encode(
}
}
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE)))
/* Log message header */
#endif
} else {
......@@ -970,7 +987,9 @@ static int _nas_message_decrypt(
"No decryption of message length %u according to security header type 0x%02x",
length, security_header_type);
memcpy(dest, src, length);
LOG_FUNC_RETURN (length);
DECODE_U8(dest, *(UInt8_t*)(&header), size);
LOG_FUNC_RETURN (header.protocol_discriminator);
//LOG_FUNC_RETURN (length);
break;
case SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED_CYPHERED:
......@@ -1268,7 +1287,7 @@ static UInt32_t _nas_message_get_mac(
if (!emm_security_context) {
LOG_TRACE(DEBUG,
"No security context set for integrity protection algorithm");
#if defined(EPC_BUILD) || defined(UE_BUILD)
#if defined(NAS_BUILT_IN_EPC) || defined(NAS_BUILT_IN_UE)
LOG_FUNC_RETURN (0);
#else
LOG_FUNC_RETURN (0xabababab);
......@@ -1398,7 +1417,7 @@ static UInt32_t _nas_message_get_mac(
(direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num
);
#if defined(EPC_BUILD) || defined(UE_BUILD)
#if defined(NAS_BUILT_IN_EPC) || defined(NAS_BUILT_IN_UE)
LOG_FUNC_RETURN (0);
#else
LOG_FUNC_RETURN (0xabababab);
......
......@@ -49,7 +49,7 @@ Description Defines the layer 3 messages supported by the NAS sublayer
#include "commonDef.h"
#include "emm_msg.h"
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
#include "emmData.h"
#endif
#include "esm_msg.h"
......
......@@ -1084,7 +1084,7 @@ static int _at_response_encode_cgpaddr(char* buffer, const at_response_t* data)
if (cgpaddr->PDP_addr_2[i] != NULL) {
/* IPv6 Link-local address prefixe */
offset += sprintf(buffer+offset,
",%u.%u.%u.%u.%u.%u.%u.%u",
",%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu.%hhu",
0xfe, 0x80, 0, 0, 0, 0, 0, 0);
/* IPv6 Link-local address */
offset += sprintf(buffer+offset,
......
......@@ -76,7 +76,7 @@ Description Defines the attach related EMM procedure executed by the
#ifdef NAS_MME
#include "mme_api.h"
#include "mme_config.h"
# if defined(EPC_BUILD)
# if defined(NAS_BUILT_IN_EPC)
# include "nas_itti_messaging.h"
# endif
#endif
......@@ -1075,13 +1075,18 @@ int emm_proc_attach_set_detach(void)
** Others: _emm_data **
** **
***************************************************************************/
int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
int native_ksi, int ksi, int native_guti,
GUTI_t *guti, imsi_t *imsi, imei_t *imei,
tai_t *tai,
int eea, int eia, int ucs2, int uea, int uia, int gea,
int umts_present, int gprs_present,
const OctetString *esm_msg)
int emm_proc_attach_request(
unsigned int ueid,
emm_proc_attach_type_t type,
int native_ksi, int ksi,
int native_guti,
GUTI_t *guti,
imsi_t *imsi,
imei_t *imei,
tai_t *tai,
int eea, int eia, int ucs2, int uea, int uia, int gea,
int umts_present, int gprs_present,
const OctetString *esm_msg)
{
LOG_FUNC_IN;
......@@ -1098,7 +1103,7 @@ int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
ue_ctx.is_dynamic = FALSE;
ue_ctx.ueid = ueid;
#if !defined(EPC_BUILD)
#if !defined(NAS_BUILT_IN_EPC)
/* UE identifier sanity check */
if (ueid >= EMM_DATA_NB_UE_MAX) {
......@@ -1126,7 +1131,7 @@ int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
/* Get the UE's EMM context if it exists */
emm_data_context_t **emm_ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_data_context_t *temp = NULL;
temp = emm_data_context_get(&_emm_data, ueid);
......@@ -1197,7 +1202,7 @@ int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
(*emm_ctx)->ueid = ueid;
emm_fsm_set_status(ueid, *emm_ctx, EMM_DEREGISTERED);
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_data_context_add(&_emm_data, *(emm_ctx));
#endif
......@@ -1265,7 +1270,7 @@ int emm_proc_attach_reject(unsigned int ueid, int emm_cause)
ue_ctx.ueid = ueid;
/* Update the EMM cause code */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (ueid > 0)
#else
......@@ -1333,7 +1338,7 @@ int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg)
/* Get the UE context */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (ueid > 0) {
emm_ctx = emm_data_context_get(&_emm_data, ueid);
......@@ -1670,7 +1675,7 @@ static void *_emm_attach_t3450_handler(void *args)
/* Get the UE's EMM context */
emm_data_context_t *emm_ctx = NULL;
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_ctx = emm_data_context_get(&_emm_data, data->ueid);
#else
emm_ctx = _emm_data.ctx[data->ueid];
......@@ -1768,7 +1773,7 @@ static int _emm_attach_release(void *args)
}
/* Release the EMM context */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
emm_data_context_remove(&_emm_data, emm_ctx);
#else
free(_emm_data.ctx[ueid]);
......@@ -1903,7 +1908,7 @@ static int _emm_attach_abort(void *args)
free(data);
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
ctx = emm_data_context_get(&_emm_data, ueid);
#else
ctx = _emm_data.ctx[ueid];
......@@ -1979,7 +1984,7 @@ static int _emm_attach_identify(void *args)
*/
if (emm_ctx->imsi) {
/* The UE identifies itself using an IMSI */
#if defined(EPC_BUILD)
#if defined(NAS_BUILT_IN_EPC)
if (!emm_ctx->security) {
/* Ask upper layer to fetch new security context */
nas_itti_auth_info_req(emm_ctx->ueid, emm_ctx->imsi, 1, NULL);
......@@ -2096,7 +2101,7 @@ static int _emm_attach_identify(void *args)
rc = _emm_attach_security(emm_ctx);
}
#if !defined(EPC_BUILD)