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
This commit is contained in:
@@ -32,6 +32,9 @@ Description Defines the tracking area update EMM procedure executed by the
|
||||
#include "emmData.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 ****************/
|
||||
@@ -59,12 +62,58 @@ void *_emm_tau_t3430_handler(void *);
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef NAS_MME
|
||||
static int _emm_tracking_area_update_reject(void *args);
|
||||
#endif // NAS_MME
|
||||
|
||||
/****************************************************************************/
|
||||
/****************** 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 *********************/
|
||||
/****************************************************************************/
|
||||
@@ -78,18 +127,18 @@ void *_emm_tau_t3430_handler(void *);
|
||||
|
||||
/****************************************************************************
|
||||
** **
|
||||
** Name: _emm_tau_t3430_handler() **
|
||||
** Name: _emm_tau_t3430_handler() **
|
||||
** **
|
||||
** Description: T3430 timeout handler **
|
||||
** **
|
||||
** 3GPP TS 24.301, section 5.5.3.2.6 case c **
|
||||
** **
|
||||
** Inputs: args: handler parameters **
|
||||
** Others: None **
|
||||
** Inputs: args: handler parameters **
|
||||
** Others: None **
|
||||
** **
|
||||
** Outputs: None **
|
||||
** Return: None **
|
||||
** Others: None **
|
||||
** Return: None **
|
||||
** Others: None **
|
||||
** **
|
||||
***************************************************************************/
|
||||
void *_emm_tau_t3430_handler(void *args)
|
||||
@@ -105,3 +154,58 @@ void *_emm_tau_t3430_handler(void *args)
|
||||
}
|
||||
|
||||
#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,
|
||||
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_complete(unsigned int ueid, const OctetString *esm_msg);
|
||||
int emm_proc_tracking_area_update_reject(unsigned int ueid, int emm_cause);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -368,6 +368,12 @@ static int _emm_as_recv(unsigned int ueid, const char *msg, int len,
|
||||
break;
|
||||
#endif
|
||||
#ifdef NAS_MME
|
||||
case ATTACH_REQUEST:
|
||||
rc = emm_recv_attach_request(ueid,
|
||||
&emm_msg->attach_request,
|
||||
emm_cause);
|
||||
break;
|
||||
|
||||
case IDENTITY_RESPONSE:
|
||||
rc = emm_recv_identity_response(ueid,
|
||||
&emm_msg->identity_response,
|
||||
@@ -722,7 +728,9 @@ static int _emm_as_establish_req(const emm_as_establish_t *msg, int *emm_cause)
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
case SERVICE_REQUEST:
|
||||
@@ -1096,6 +1104,7 @@ static int _emm_as_send(const emm_as_t *msg)
|
||||
LOG_FUNC_RETURN (RETURNok);
|
||||
} break;
|
||||
|
||||
case AS_NAS_ESTABLISH_RSP:
|
||||
case AS_NAS_ESTABLISH_CNF: {
|
||||
if (as_msg.msg.nas_establish_rsp.errCode != AS_SUCCESS) {
|
||||
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,
|
||||
size = emm_send_attach_reject(msg, &emm_msg->attach_reject);
|
||||
break;
|
||||
|
||||
case EMM_AS_NAS_INFO_TAU:
|
||||
size = emm_send_tracking_area_update_reject(msg, &emm_msg->tracking_area_update_reject);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_TRACE(WARNING, "EMMAS-SAP - Type of initial NAS "
|
||||
"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,
|
||||
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() **
|
||||
|
||||
@@ -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_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_cause);
|
||||
int emm_recv_authentication_response(unsigned int ueid,
|
||||
|
||||
@@ -990,6 +990,44 @@ int emm_send_attach_reject(const emm_as_establish_t *msg,
|
||||
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() **
|
||||
|
||||
@@ -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_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_authentication_request(const emm_as_security_t *,
|
||||
authentication_request_msg *);
|
||||
|
||||
Reference in New Issue
Block a user