Commit af1cff72 authored by winckel's avatar winckel

Implemented a partial handler for Tracking Area Update Request to trigger a...

Implemented a partial handler for  Tracking Area Update Request to trigger a Attach Request from UE after MME reset.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4991 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent b3960e9c
...@@ -32,6 +32,9 @@ Description Defines the tracking area update EMM procedure executed by the ...@@ -32,6 +32,9 @@ Description Defines the tracking area update EMM procedure executed by the
#include "emmData.h" #include "emmData.h"
#include "emm_sap.h" #include "emm_sap.h"
#include "emm_cause.h"
#include <string.h> // memcmp, memcpy
/****************************************************************************/ /****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/
...@@ -59,12 +62,58 @@ void *_emm_tau_t3430_handler(void *); ...@@ -59,12 +62,58 @@ void *_emm_tau_t3430_handler(void *);
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#ifdef NAS_MME #ifdef NAS_MME
static int _emm_tracking_area_update_reject(void *args);
#endif // NAS_MME #endif // NAS_MME
/****************************************************************************/ /****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/ /****************** E X P O R T E D F U N C T I O N S ******************/
/****************************************************************************/ /****************************************************************************/
/****************************************************************************
** **
** Name: emm_proc_tracking_area_update_reject() **
** **
** Description: **
** **
** Inputs: ueid: UE lower layer identifier **
** emm_cause: EMM cause code to be reported **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: _emm_data **
** **
***************************************************************************/
int emm_proc_tracking_area_update_reject(unsigned int ueid, int emm_cause)
{
LOG_FUNC_IN;
int rc;
/* Create temporary UE context */
emm_data_context_t ue_ctx;
memset(&ue_ctx, 0 , sizeof(emm_data_context_t));
ue_ctx.is_dynamic = FALSE;
ue_ctx.ueid = ueid;
/* Update the EMM cause code */
#if defined(EPC_BUILD)
if (ueid > 0)
#else
if (ueid < EMM_DATA_NB_UE_MAX)
#endif
{
ue_ctx.emm_cause = emm_cause;
} else {
ue_ctx.emm_cause = EMM_CAUSE_ILLEGAL_UE;
}
/* Do not accept attach request with protocol error */
rc = _emm_tracking_area_update_reject(&ue_ctx);
LOG_FUNC_RETURN(rc);
}
/****************************************************************************/ /****************************************************************************/
/********************* L O C A L F U N C T I O N S *********************/ /********************* L O C A L F U N C T I O N S *********************/
/****************************************************************************/ /****************************************************************************/
...@@ -105,3 +154,58 @@ void *_emm_tau_t3430_handler(void *args) ...@@ -105,3 +154,58 @@ void *_emm_tau_t3430_handler(void *args)
} }
#endif // NAS_UE #endif // NAS_UE
#ifdef NAS_MME
/****************************************************************************
** **
** Name: _emm_tracking_area_update_reject() **
** **
** Description: Performs the tracking area update procedure not accepted **
** by the network. **
** **
** Inputs: args: UE context data **
** Others: None **
** **
** Outputs: None **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
static int _emm_tracking_area_update_reject(void *args)
{
LOG_FUNC_IN;
int rc = RETURNerror;
emm_data_context_t *emm_ctx = (emm_data_context_t *)(args);
if (emm_ctx) {
emm_sap_t emm_sap;
LOG_TRACE(WARNING, "EMM-PROC - EMM tracking area update procedure not accepted "
"by the network (ueid=%08x, cause=%d)",
emm_ctx->ueid, emm_ctx->emm_cause);
/*
* Notify EMM-AS SAP that Tracking Area Update Reject message has to be sent
* onto the network
*/
emm_sap.primitive = EMMAS_ESTABLISH_REJ;
emm_sap.u.emm_as.u.establish.ueid = emm_ctx->ueid;
emm_sap.u.emm_as.u.establish.UEid.guti = NULL;
if (emm_ctx->emm_cause == EMM_CAUSE_SUCCESS) {
emm_ctx->emm_cause = EMM_CAUSE_ILLEGAL_UE;
}
emm_sap.u.emm_as.u.establish.emm_cause = emm_ctx->emm_cause;
emm_sap.u.emm_as.u.establish.NASinfo = EMM_AS_NAS_INFO_TAU;
emm_sap.u.emm_as.u.establish.NASmsg.length = 0;
emm_sap.u.emm_as.u.establish.NASmsg.value = NULL;
/* Setup EPS NAS security data */
emm_as_set_security_data(&emm_sap.u.emm_as.u.establish.sctx,
emm_ctx->security, FALSE, TRUE);
rc = emm_sap_send(&emm_sap);
}
LOG_FUNC_RETURN(rc);
}
#endif // NAS_MME
...@@ -137,6 +137,7 @@ int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type, ...@@ -137,6 +137,7 @@ int emm_proc_attach_request(unsigned int ueid, emm_proc_attach_type_t type,
imei_t *imei, tai_t *tai, int eea, int eia, const OctetString *esm_msg); imei_t *imei, tai_t *tai, int eea, int eia, const OctetString *esm_msg);
int emm_proc_attach_reject(unsigned int ueid, int emm_cause); int emm_proc_attach_reject(unsigned int ueid, int emm_cause);
int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg); int emm_proc_attach_complete(unsigned int ueid, const OctetString *esm_msg);
int emm_proc_tracking_area_update_reject(unsigned int ueid, int emm_cause);
#endif #endif
/* /*
......
...@@ -368,6 +368,12 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len, ...@@ -368,6 +368,12 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len,
break; break;
#endif #endif
#ifdef NAS_MME #ifdef NAS_MME
case ATTACH_REQUEST:
rc = emm_recv_attach_request(ueid,
&emm_msg->attach_request,
emm_cause);
break;
case IDENTITY_RESPONSE: case IDENTITY_RESPONSE:
rc = emm_recv_identity_response(ueid, rc = emm_recv_identity_response(ueid,
&emm_msg->identity_response, &emm_msg->identity_response,
...@@ -722,7 +728,9 @@ static int _emm_as_establish_req(const emm_as_establish_t *msg, int *emm_cause) ...@@ -722,7 +728,9 @@ static int _emm_as_establish_req(const emm_as_establish_t *msg, int *emm_cause)
break; break;
case TRACKING_AREA_UPDATE_REQUEST: case TRACKING_AREA_UPDATE_REQUEST:
rc = RETURNok; /* TODO */ rc = emm_recv_tracking_area_update_request(msg->ueid,
&emm_msg->tracking_area_update_request,
emm_cause);
break; break;
case SERVICE_REQUEST: case SERVICE_REQUEST:
...@@ -1096,6 +1104,7 @@ static int _emm_as_send(const emm_as_t *msg) ...@@ -1096,6 +1104,7 @@ static int _emm_as_send(const emm_as_t *msg)
LOG_FUNC_RETURN (RETURNok); LOG_FUNC_RETURN (RETURNok);
} break; } break;
case AS_NAS_ESTABLISH_RSP:
case AS_NAS_ESTABLISH_CNF: { case AS_NAS_ESTABLISH_CNF: {
if (as_msg.msg.nas_establish_rsp.errCode != AS_SUCCESS) { if (as_msg.msg.nas_establish_rsp.errCode != AS_SUCCESS) {
nas_itti_dl_data_req(as_msg.msg.nas_establish_rsp.UEid, nas_itti_dl_data_req(as_msg.msg.nas_establish_rsp.UEid,
...@@ -1768,6 +1777,10 @@ static int _emm_as_establish_rej(const emm_as_establish_t *msg, ...@@ -1768,6 +1777,10 @@ static int _emm_as_establish_rej(const emm_as_establish_t *msg,
size = emm_send_attach_reject(msg, &emm_msg->attach_reject); size = emm_send_attach_reject(msg, &emm_msg->attach_reject);
break; break;
case EMM_AS_NAS_INFO_TAU:
size = emm_send_tracking_area_update_reject(msg, &emm_msg->tracking_area_update_reject);
break;
default: default:
LOG_TRACE(WARNING, "EMMAS-SAP - Type of initial NAS " LOG_TRACE(WARNING, "EMMAS-SAP - Type of initial NAS "
"message 0x%.2x is not valid", msg->NASinfo); "message 0x%.2x is not valid", msg->NASinfo);
......
...@@ -745,6 +745,37 @@ int emm_recv_detach_request(unsigned int ueid, const detach_request_msg *msg, ...@@ -745,6 +745,37 @@ int emm_recv_detach_request(unsigned int ueid, const detach_request_msg *msg,
LOG_FUNC_RETURN (rc); LOG_FUNC_RETURN (rc);
} }
/****************************************************************************
** **
** Name: emm_recv_tracking_area_update_request() **
** **
** Description: Processes Tracking Area Update Request message **
** **
** Inputs: ueid: UE lower layer identifier **
** msg: The received EMM message **
** Others: None **
** **
** Outputs: emm_cause: EMM cause code **
** Return: RETURNok, RETURNerror **
** Others: None **
** **
***************************************************************************/
int emm_recv_tracking_area_update_request(unsigned int ueid,
const tracking_area_update_request_msg *msg,
int *emm_cause)
{
int rc = RETURNok;
LOG_FUNC_IN;
LOG_TRACE(INFO, "EMMAS-SAP - Received Tracking Area Update Request message");
/* LW: Not completely implemented; send a Received Tracking Area Update Reject to induce a Attach Request from UE! */
rc = emm_proc_tracking_area_update_reject(ueid, EMM_CAUSE_IMPLICITLY_DETACHED);
LOG_FUNC_RETURN (rc);
}
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_recv_identity_response() ** ** Name: emm_recv_identity_response() **
......
...@@ -116,6 +116,10 @@ int emm_recv_attach_complete(unsigned int ueid, const attach_complete_msg *msg, ...@@ -116,6 +116,10 @@ int emm_recv_attach_complete(unsigned int ueid, const attach_complete_msg *msg,
int emm_recv_detach_request(unsigned int ueid, const detach_request_msg *msg, int emm_recv_detach_request(unsigned int ueid, const detach_request_msg *msg,
int *emm_cause); int *emm_cause);
int emm_recv_tracking_area_update_request(unsigned int ueid,
const tracking_area_update_request_msg *msg,
int *emm_cause);
int emm_recv_identity_response(unsigned int ueid, identity_response_msg *msg, int emm_recv_identity_response(unsigned int ueid, identity_response_msg *msg,
int *emm_cause); int *emm_cause);
int emm_recv_authentication_response(unsigned int ueid, int emm_recv_authentication_response(unsigned int ueid,
......
...@@ -990,6 +990,44 @@ int emm_send_attach_reject(const emm_as_establish_t *msg, ...@@ -990,6 +990,44 @@ int emm_send_attach_reject(const emm_as_establish_t *msg,
LOG_FUNC_RETURN (size); LOG_FUNC_RETURN (size);
} }
/****************************************************************************
** **
** Name: emm_send_tracking_area_update_reject() **
** **
** Description: Builds Tracking Area Update Reject message **
** **
** The Tracking Area Update Reject message is sent by the **
** network to the UE to indicate that the corresponding **
** tracking area update has been rejected. **
** **
** Inputs: msg: The EMMAS-SAP primitive to process **
** Others: None **
** **
** Outputs: emm_msg: The EMM message to be sent **
** Return: The size of the EMM message **
** Others: None **
** **
***************************************************************************/
int emm_send_tracking_area_update_reject(const emm_as_establish_t *msg,
tracking_area_update_reject_msg *emm_msg)
{
LOG_FUNC_IN;
int size = EMM_HEADER_MAXIMUM_LENGTH;
LOG_TRACE(INFO, "EMMAS-SAP - Send Tracking Area Update Reject message (cause=%d)",
msg->emm_cause);
/* Mandatory - Message type */
emm_msg->messagetype = TRACKING_AREA_UPDATE_REJECT;
/* Mandatory - EMM cause */
size += EMM_CAUSE_MAXIMUM_LENGTH;
emm_msg->emmcause = msg->emm_cause;
LOG_FUNC_RETURN (size);
}
/**************************************************************************** /****************************************************************************
** ** ** **
** Name: emm_send_identity_request() ** ** Name: emm_send_identity_request() **
......
...@@ -130,6 +130,9 @@ int emm_send_security_mode_reject(const emm_as_security_t *, ...@@ -130,6 +130,9 @@ int emm_send_security_mode_reject(const emm_as_security_t *,
int emm_send_attach_accept(const emm_as_establish_t *, attach_accept_msg *); int emm_send_attach_accept(const emm_as_establish_t *, attach_accept_msg *);
int emm_send_attach_reject(const emm_as_establish_t *, attach_reject_msg *); int emm_send_attach_reject(const emm_as_establish_t *, attach_reject_msg *);
int emm_send_tracking_area_update_reject(const emm_as_establish_t *msg,
tracking_area_update_reject_msg *emm_msg);
int emm_send_identity_request(const emm_as_security_t *, identity_request_msg *); int emm_send_identity_request(const emm_as_security_t *, identity_request_msg *);
int emm_send_authentication_request(const emm_as_security_t *, int emm_send_authentication_request(const emm_as_security_t *,
authentication_request_msg *); authentication_request_msg *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment