forked from acouzens/open5gs
[SGsAP] MO CS fallback in idle-mode
This commit is contained in:
parent
5164b51607
commit
a6eb646b76
|
@ -39,6 +39,9 @@ int emm_handle_attach_request(
|
|||
{
|
||||
int served_tai_index = 0;
|
||||
|
||||
nas_eps_mobile_identity_guti_t *eps_mobile_identity_guti = NULL;
|
||||
nas_guti_t nas_guti;
|
||||
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
nas_eps_attach_type_t *eps_attach_type =
|
||||
&attach_request->eps_attach_type;
|
||||
|
@ -47,6 +50,8 @@ int emm_handle_attach_request(
|
|||
nas_esm_message_container_t *esm_message_container =
|
||||
&attach_request->esm_message_container;
|
||||
|
||||
char imsi_bcd[MAX_IMSI_BCD_LEN+1];
|
||||
|
||||
ogs_assert(mme_ue);
|
||||
enb_ue = mme_ue->enb_ue;
|
||||
ogs_assert(enb_ue);
|
||||
|
@ -73,6 +78,10 @@ int emm_handle_attach_request(
|
|||
* SERVICE_REQUEST
|
||||
* Clear Paging Timer and Message
|
||||
* Update KeNB
|
||||
*
|
||||
* EXTENDED_SERVICE_REQUEST
|
||||
* Clear Paging Timer and Message
|
||||
* Update KeNB
|
||||
*/
|
||||
CLEAR_EPS_BEARER_ID(mme_ue);
|
||||
CLEAR_PAGING_INFO(mme_ue);
|
||||
|
@ -134,9 +143,6 @@ int emm_handle_attach_request(
|
|||
|
||||
switch (eps_mobile_identity->imsi.type) {
|
||||
case NAS_EPS_MOBILE_IDENTITY_IMSI:
|
||||
{
|
||||
char imsi_bcd[MAX_IMSI_BCD_LEN+1];
|
||||
|
||||
memcpy(&mme_ue->nas_mobile_identity_imsi,
|
||||
&eps_mobile_identity->imsi, sizeof(nas_mobile_identity_imsi_t));
|
||||
nas_imsi_to_bcd(
|
||||
|
@ -147,17 +153,13 @@ int emm_handle_attach_request(
|
|||
ogs_debug(" IMSI[%s]", imsi_bcd);
|
||||
|
||||
break;
|
||||
}
|
||||
case NAS_EPS_MOBILE_IDENTITY_GUTI:
|
||||
{
|
||||
nas_eps_mobile_identity_guti_t *nas_eps_mobile_identity_guti =
|
||||
&eps_mobile_identity->guti;
|
||||
nas_guti_t nas_guti;
|
||||
eps_mobile_identity_guti = &eps_mobile_identity->guti;
|
||||
|
||||
nas_guti.nas_plmn_id = nas_eps_mobile_identity_guti->nas_plmn_id;
|
||||
nas_guti.mme_gid = nas_eps_mobile_identity_guti->mme_gid;
|
||||
nas_guti.mme_code = nas_eps_mobile_identity_guti->mme_code;
|
||||
nas_guti.m_tmsi = nas_eps_mobile_identity_guti->m_tmsi;
|
||||
nas_guti.nas_plmn_id = eps_mobile_identity_guti->nas_plmn_id;
|
||||
nas_guti.mme_gid = eps_mobile_identity_guti->mme_gid;
|
||||
nas_guti.mme_code = eps_mobile_identity_guti->mme_code;
|
||||
nas_guti.m_tmsi = eps_mobile_identity_guti->m_tmsi;
|
||||
|
||||
ogs_debug(" GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI[%s]",
|
||||
nas_guti.mme_gid,
|
||||
|
@ -166,7 +168,6 @@ int emm_handle_attach_request(
|
|||
MME_UE_HAVE_IMSI(mme_ue)
|
||||
? mme_ue->imsi_bcd : "Unknown");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ogs_warn("Not implemented[%d]", eps_mobile_identity->imsi.type);
|
||||
break;
|
||||
|
@ -370,6 +371,10 @@ int emm_handle_service_request(
|
|||
* SERVICE_REQUEST
|
||||
* Clear Paging Timer and Message
|
||||
* Update KeNB
|
||||
*
|
||||
* EXTENDED_SERVICE_REQUEST
|
||||
* Clear Paging Timer and Message
|
||||
* Update KeNB
|
||||
*/
|
||||
CLEAR_PAGING_INFO(mme_ue);
|
||||
if (SECURITY_CONTEXT_IS_VALID(mme_ue)) {
|
||||
|
@ -392,6 +397,9 @@ int emm_handle_tau_request(
|
|||
{
|
||||
int served_tai_index = 0;
|
||||
|
||||
nas_eps_mobile_identity_guti_t *eps_mobile_identity_guti = NULL;
|
||||
nas_guti_t nas_guti;
|
||||
|
||||
nas_eps_update_type_t *eps_update_type =
|
||||
&tau_request->eps_update_type;
|
||||
nas_eps_mobile_identity_t *eps_mobile_identity =
|
||||
|
@ -423,6 +431,10 @@ int emm_handle_tau_request(
|
|||
* SERVICE_REQUEST
|
||||
* Clear Paging Timer and Message
|
||||
* Update KeNB
|
||||
*
|
||||
* EXTENDED_SERVICE_REQUEST
|
||||
* Clear Paging Timer and Message
|
||||
* Update KeNB
|
||||
*/
|
||||
CLEAR_PAGING_INFO(mme_ue);
|
||||
|
||||
|
@ -493,15 +505,12 @@ int emm_handle_tau_request(
|
|||
*/
|
||||
switch (eps_mobile_identity->imsi.type) {
|
||||
case NAS_EPS_MOBILE_IDENTITY_GUTI:
|
||||
{
|
||||
nas_eps_mobile_identity_guti_t *nas_eps_mobile_identity_guti =
|
||||
&eps_mobile_identity->guti;
|
||||
nas_guti_t nas_guti;
|
||||
eps_mobile_identity_guti = &eps_mobile_identity->guti;
|
||||
|
||||
nas_guti.nas_plmn_id = nas_eps_mobile_identity_guti->nas_plmn_id;
|
||||
nas_guti.mme_gid = nas_eps_mobile_identity_guti->mme_gid;
|
||||
nas_guti.mme_code = nas_eps_mobile_identity_guti->mme_code;
|
||||
nas_guti.m_tmsi = nas_eps_mobile_identity_guti->m_tmsi;
|
||||
nas_guti.nas_plmn_id = eps_mobile_identity_guti->nas_plmn_id;
|
||||
nas_guti.mme_gid = eps_mobile_identity_guti->mme_gid;
|
||||
nas_guti.mme_code = eps_mobile_identity_guti->mme_code;
|
||||
nas_guti.m_tmsi = eps_mobile_identity_guti->m_tmsi;
|
||||
|
||||
ogs_debug(" GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI:[%s]",
|
||||
nas_guti.mme_gid,
|
||||
|
@ -510,7 +519,6 @@ int emm_handle_tau_request(
|
|||
MME_UE_HAVE_IMSI(mme_ue)
|
||||
? mme_ue->imsi_bcd : "Unknown");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ogs_warn("Not implemented[%d]",
|
||||
eps_mobile_identity->imsi.type);
|
||||
|
@ -520,3 +528,91 @@ int emm_handle_tau_request(
|
|||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
int emm_handle_extended_service_request(
|
||||
mme_ue_t *mme_ue, nas_extended_service_request_t *extended_service_request)
|
||||
{
|
||||
int served_tai_index = 0;
|
||||
|
||||
nas_service_type_t *service_type = &extended_service_request->service_type;
|
||||
nas_mobile_identity_t *mobile_identity = &extended_service_request->m_tmsi;
|
||||
nas_mobile_identity_tmsi_t *mobile_identity_tmsi = NULL;
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
|
||||
ogs_assert(mme_ue);
|
||||
enb_ue = mme_ue->enb_ue;
|
||||
ogs_assert(enb_ue);
|
||||
|
||||
/* Set Service Type */
|
||||
memcpy(&mme_ue->nas_eps.service, service_type,
|
||||
sizeof(nas_service_type_t));
|
||||
mme_ue->nas_eps.type = MME_EPS_TYPE_EXTENDED_SERVICE_REQUEST;
|
||||
mme_ue->nas_eps.ksi = service_type->nas_key_set_identifier;
|
||||
ogs_debug(" NAS_EPS TYPE[%d] KSI[%d] SERVICE[0x%x]",
|
||||
mme_ue->nas_eps.type, mme_ue->nas_eps.ksi,
|
||||
mme_ue->nas_eps.data);
|
||||
|
||||
/*
|
||||
* ATTACH_REQUEST
|
||||
* Clear EBI generator
|
||||
* Clear Paging Timer and Message
|
||||
* Update KeNB
|
||||
*
|
||||
* TAU_REQUEST
|
||||
* Clear Paging Timer and Message
|
||||
*
|
||||
* SERVICE_REQUEST
|
||||
* Clear Paging Timer and Message
|
||||
* Update KeNB
|
||||
*
|
||||
* EXTENDED_SERVICE_REQUEST
|
||||
* Clear Paging Timer and Message
|
||||
* Update KeNB
|
||||
*/
|
||||
CLEAR_PAGING_INFO(mme_ue);
|
||||
if (SECURITY_CONTEXT_IS_VALID(mme_ue)) {
|
||||
mme_kdf_enb(mme_ue->kasme, mme_ue->ul_count.i32, mme_ue->kenb);
|
||||
mme_kdf_nh(mme_ue->kasme, mme_ue->kenb, mme_ue->nh);
|
||||
mme_ue->nhcc = 1;
|
||||
}
|
||||
|
||||
ogs_debug(" OLD TAI[PLMN_ID:%06x,TAC:%d]",
|
||||
plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac);
|
||||
ogs_debug(" OLD E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
||||
plmn_id_hexdump(&mme_ue->e_cgi.plmn_id), mme_ue->e_cgi.cell_id);
|
||||
ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]",
|
||||
plmn_id_hexdump(&enb_ue->saved.tai.plmn_id), enb_ue->saved.tai.tac);
|
||||
ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
||||
plmn_id_hexdump(&enb_ue->saved.e_cgi.plmn_id),
|
||||
enb_ue->saved.e_cgi.cell_id);
|
||||
|
||||
/* Copy TAI and ECGI from enb_ue */
|
||||
memcpy(&mme_ue->tai, &enb_ue->saved.tai, sizeof(tai_t));
|
||||
memcpy(&mme_ue->e_cgi, &enb_ue->saved.e_cgi, sizeof(e_cgi_t));
|
||||
|
||||
/* Check TAI */
|
||||
served_tai_index = mme_find_served_tai(&mme_ue->tai);
|
||||
if (served_tai_index < 0) {
|
||||
/* Send TAU reject */
|
||||
ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]",
|
||||
plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac);
|
||||
nas_send_tau_reject(mme_ue, EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED);
|
||||
return OGS_ERROR;
|
||||
}
|
||||
ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index);
|
||||
|
||||
switch(mobile_identity->tmsi.type) {
|
||||
case NAS_MOBILE_IDENTITY_TMSI:
|
||||
mobile_identity_tmsi = &mobile_identity->tmsi;
|
||||
|
||||
ogs_debug(" M-TMSI:[0x%x] IMSI:[%s]",
|
||||
mobile_identity_tmsi->tmsi,
|
||||
MME_UE_HAVE_IMSI(mme_ue) ? mme_ue->imsi_bcd : "Unknown");
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown TMSI type [%d]", mobile_identity->tmsi.type);
|
||||
break;
|
||||
}
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,9 @@ int emm_handle_service_request(
|
|||
int emm_handle_tau_request(
|
||||
mme_ue_t *mme_ue, nas_tracking_area_update_request_t *tau_request);
|
||||
|
||||
int emm_handle_extended_service_request(
|
||||
mme_ue_t *mme_ue, nas_extended_service_request_t *extended_service_request);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -189,6 +189,26 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
ogs_debug("[EMM] Tracking area update complete");
|
||||
ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd);
|
||||
return;
|
||||
case NAS_EXTENDED_SERVICE_REQUEST:
|
||||
ogs_debug("[EMM] Extended service request");
|
||||
rv = emm_handle_extended_service_request(
|
||||
mme_ue, &message->emm.extended_service_request);
|
||||
if (rv != OGS_OK) {
|
||||
ogs_error("emm_handle_extended_service_request() failed");
|
||||
OGS_FSM_TRAN(s, emm_state_exception);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MME_UE_HAVE_IMSI(mme_ue)) {
|
||||
ogs_warn("[EMM] Extended Service request : Unknown UE");
|
||||
rv = nas_send_service_reject(mme_ue,
|
||||
EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
case NAS_EMM_STATUS:
|
||||
ogs_warn("[EMM] EMM STATUS : IMSI[%s] Cause[%d]",
|
||||
mme_ue->imsi_bcd,
|
||||
|
@ -295,6 +315,39 @@ static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
|
|||
ogs_assert_if_reached();
|
||||
}
|
||||
break;
|
||||
case MME_EPS_TYPE_EXTENDED_SERVICE_REQUEST:
|
||||
procedureCode = e->s1ap_code;
|
||||
|
||||
if (!SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) {
|
||||
ogs_warn("No PDN Connection : UE[%s]", mme_ue->imsi_bcd);
|
||||
rv = nas_send_service_reject(mme_ue,
|
||||
EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
OGS_FSM_TRAN(s, emm_state_exception);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!SECURITY_CONTEXT_IS_VALID(mme_ue)) {
|
||||
ogs_warn("No Security Context : IMSI[%s]", mme_ue->imsi_bcd);
|
||||
rv = nas_send_service_reject(mme_ue,
|
||||
EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
OGS_FSM_TRAN(s, &emm_state_exception);
|
||||
return;
|
||||
}
|
||||
|
||||
if (procedureCode == S1AP_ProcedureCode_id_initialUEMessage) {
|
||||
ogs_debug(" Iniital UE Message");
|
||||
rv = s1ap_send_initial_context_setup_request(mme_ue);
|
||||
ogs_assert(rv == OGS_OK);
|
||||
} else if (procedureCode == S1AP_ProcedureCode_id_uplinkNASTransport) {
|
||||
ogs_error(" Uplink NAS Transport : Not Implemented");
|
||||
ogs_assert_if_reached();
|
||||
} else {
|
||||
ogs_fatal("Invalid Procedure Code[%d]", (int)procedureCode);
|
||||
ogs_assert_if_reached();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ogs_fatal("Invalid NAS-EPS[%d]", mme_ue->nas_eps.type);
|
||||
ogs_assert_if_reached();
|
||||
|
|
|
@ -2104,21 +2104,25 @@ mme_ue_t *mme_ue_find_by_teid(uint32_t teid)
|
|||
mme_ue_t *mme_ue_find_by_message(nas_message_t *message)
|
||||
{
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
nas_attach_request_t *attach_request = NULL;
|
||||
nas_tracking_area_update_request_t *tau_request = NULL;
|
||||
nas_extended_service_request_t *extended_service_request = NULL;
|
||||
nas_eps_mobile_identity_t *eps_mobile_identity = NULL;
|
||||
nas_mobile_identity_t *mobile_identity = NULL;
|
||||
|
||||
char imsi_bcd[MAX_IMSI_BCD_LEN+1];
|
||||
nas_eps_mobile_identity_guti_t *eps_mobile_identity_guti = NULL;
|
||||
nas_mobile_identity_tmsi_t *mobile_identity_tmsi = NULL;
|
||||
served_gummei_t *served_gummei = NULL;
|
||||
nas_guti_t nas_guti;
|
||||
|
||||
switch (message->emm.h.message_type) {
|
||||
case NAS_ATTACH_REQUEST:
|
||||
{
|
||||
nas_attach_request_t *attach_request =
|
||||
&message->emm.attach_request;
|
||||
|
||||
nas_eps_mobile_identity_t *eps_mobile_identity =
|
||||
&attach_request->eps_mobile_identity;
|
||||
attach_request = &message->emm.attach_request;
|
||||
eps_mobile_identity = &attach_request->eps_mobile_identity;
|
||||
|
||||
switch(eps_mobile_identity->imsi.type) {
|
||||
case NAS_EPS_MOBILE_IDENTITY_IMSI:
|
||||
{
|
||||
char imsi_bcd[MAX_IMSI_BCD_LEN+1];
|
||||
|
||||
nas_imsi_to_bcd(
|
||||
&eps_mobile_identity->imsi, eps_mobile_identity->length,
|
||||
imsi_bcd);
|
||||
|
@ -2130,17 +2134,13 @@ mme_ue_t *mme_ue_find_by_message(nas_message_t *message)
|
|||
ogs_trace("Unknown UE by IMSI[%s]", imsi_bcd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NAS_EPS_MOBILE_IDENTITY_GUTI:
|
||||
{
|
||||
nas_eps_mobile_identity_guti_t *nas_eps_mobile_identity_guti =
|
||||
&eps_mobile_identity->guti;
|
||||
nas_guti_t nas_guti;
|
||||
eps_mobile_identity_guti = &eps_mobile_identity->guti;
|
||||
|
||||
nas_guti.nas_plmn_id = nas_eps_mobile_identity_guti->nas_plmn_id;
|
||||
nas_guti.mme_gid = nas_eps_mobile_identity_guti->mme_gid;
|
||||
nas_guti.mme_code = nas_eps_mobile_identity_guti->mme_code;
|
||||
nas_guti.m_tmsi = nas_eps_mobile_identity_guti->m_tmsi;
|
||||
nas_guti.nas_plmn_id = eps_mobile_identity_guti->nas_plmn_id;
|
||||
nas_guti.mme_gid = eps_mobile_identity_guti->mme_gid;
|
||||
nas_guti.mme_code = eps_mobile_identity_guti->mme_code;
|
||||
nas_guti.m_tmsi = eps_mobile_identity_guti->m_tmsi;
|
||||
|
||||
mme_ue = mme_ue_find_by_guti(&nas_guti);
|
||||
if (mme_ue) {
|
||||
|
@ -2155,36 +2155,26 @@ mme_ue_t *mme_ue_find_by_message(nas_message_t *message)
|
|||
nas_guti.m_tmsi);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ogs_error("Uknown message imsi type =%d",
|
||||
eps_mobile_identity->imsi.type);
|
||||
ogs_error("Unknown IMSI type [%d]", eps_mobile_identity->imsi.type);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NAS_DETACH_REQUEST:
|
||||
/* TODO */
|
||||
break;
|
||||
case NAS_TRACKING_AREA_UPDATE_REQUEST:
|
||||
{
|
||||
nas_tracking_area_update_request_t *tau_request =
|
||||
&message->emm.tracking_area_update_request;
|
||||
|
||||
nas_eps_mobile_identity_t *eps_mobile_identity =
|
||||
&tau_request->old_guti;
|
||||
tau_request = &message->emm.tracking_area_update_request;
|
||||
eps_mobile_identity = &tau_request->old_guti;
|
||||
|
||||
switch(eps_mobile_identity->imsi.type) {
|
||||
case NAS_EPS_MOBILE_IDENTITY_GUTI:
|
||||
{
|
||||
nas_eps_mobile_identity_guti_t *nas_eps_mobile_identity_guti =
|
||||
&eps_mobile_identity->guti;
|
||||
nas_guti_t nas_guti;
|
||||
eps_mobile_identity_guti = &eps_mobile_identity->guti;
|
||||
|
||||
nas_guti.nas_plmn_id = nas_eps_mobile_identity_guti->nas_plmn_id;
|
||||
nas_guti.mme_gid = nas_eps_mobile_identity_guti->mme_gid;
|
||||
nas_guti.mme_code = nas_eps_mobile_identity_guti->mme_code;
|
||||
nas_guti.m_tmsi = nas_eps_mobile_identity_guti->m_tmsi;
|
||||
nas_guti.nas_plmn_id = eps_mobile_identity_guti->nas_plmn_id;
|
||||
nas_guti.mme_gid = eps_mobile_identity_guti->mme_gid;
|
||||
nas_guti.mme_code = eps_mobile_identity_guti->mme_code;
|
||||
nas_guti.m_tmsi = eps_mobile_identity_guti->m_tmsi;
|
||||
|
||||
mme_ue = mme_ue_find_by_guti(&nas_guti);
|
||||
if (mme_ue) {
|
||||
|
@ -2199,14 +2189,44 @@ mme_ue_t *mme_ue_find_by_message(nas_message_t *message)
|
|||
nas_guti.m_tmsi);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ogs_error("Uknown message imsi type =%d",
|
||||
eps_mobile_identity->imsi.type);
|
||||
ogs_error("Unknown IMSI type [%d]", eps_mobile_identity->imsi.type);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case NAS_EXTENDED_SERVICE_REQUEST:
|
||||
extended_service_request = &message->emm.extended_service_request;
|
||||
mobile_identity = &extended_service_request->m_tmsi;
|
||||
|
||||
switch(mobile_identity->tmsi.type) {
|
||||
case NAS_MOBILE_IDENTITY_TMSI:
|
||||
mobile_identity_tmsi = &mobile_identity->tmsi;
|
||||
served_gummei = &mme_self()->served_gummei[0];
|
||||
|
||||
/* Use the first configured plmn_id and mme group id */
|
||||
nas_from_plmn_id(&nas_guti.nas_plmn_id, &served_gummei->plmn_id[0]);
|
||||
nas_guti.mme_gid = served_gummei->mme_gid[0];
|
||||
nas_guti.mme_code = served_gummei->mme_code[0];
|
||||
nas_guti.m_tmsi = mobile_identity_tmsi->tmsi;
|
||||
|
||||
mme_ue = mme_ue_find_by_guti(&nas_guti);
|
||||
if (mme_ue) {
|
||||
ogs_trace("Known UE by GUTI[G:%d,C:%d,M_TMSI:0x%x]",
|
||||
nas_guti.mme_gid,
|
||||
nas_guti.mme_code,
|
||||
nas_guti.m_tmsi);
|
||||
} else {
|
||||
ogs_warn("Unknown UE by GUTI[G:%d,C:%d,M_TMSI:0x%x]",
|
||||
nas_guti.mme_gid,
|
||||
nas_guti.mme_code,
|
||||
nas_guti.m_tmsi);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown TMSI type [%d]", mobile_identity->tmsi.type);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -274,13 +274,15 @@ struct mme_ue_s {
|
|||
#define MME_EPS_TYPE_ATTACH_REQUEST 1
|
||||
#define MME_EPS_TYPE_TAU_REQUEST 2
|
||||
#define MME_EPS_TYPE_SERVICE_REQUEST 3
|
||||
#define MME_EPS_TYPE_DETACH_REQUEST_FROM_UE 4
|
||||
#define MME_EPS_TYPE_DETACH_REQUEST_TO_UE 5
|
||||
#define MME_EPS_TYPE_EXTENDED_SERVICE_REQUEST 4
|
||||
#define MME_EPS_TYPE_DETACH_REQUEST_FROM_UE 5
|
||||
#define MME_EPS_TYPE_DETACH_REQUEST_TO_UE 6
|
||||
uint8_t type;
|
||||
uint8_t ksi;
|
||||
union {
|
||||
nas_eps_attach_type_t attach;
|
||||
nas_eps_update_type_t update;
|
||||
nas_service_type_t service;
|
||||
nas_detach_type_t detach;
|
||||
uint8_t data;
|
||||
};
|
||||
|
|
|
@ -490,6 +490,42 @@ int s1ap_build_initial_context_setup_request(
|
|||
SecurityKey->bits_unused = 0;
|
||||
memcpy(SecurityKey->buf, mme_ue->kenb, SecurityKey->size);
|
||||
|
||||
/* Set CS-Fallback */
|
||||
if (mme_ue->nas_eps.type == MME_EPS_TYPE_EXTENDED_SERVICE_REQUEST) {
|
||||
S1AP_CSFallbackIndicator_t *CSFallbackIndicator = NULL;
|
||||
S1AP_LAI_t *LAI = NULL;
|
||||
|
||||
ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t));
|
||||
ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_CSFallbackIndicator;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present =
|
||||
S1AP_InitialContextSetupRequestIEs__value_PR_CSFallbackIndicator;
|
||||
|
||||
CSFallbackIndicator = &ie->value.choice.CSFallbackIndicator;
|
||||
ogs_assert(CSFallbackIndicator);
|
||||
|
||||
*CSFallbackIndicator = S1AP_CSFallbackIndicator_cs_fallback_required;
|
||||
|
||||
ie = ogs_calloc(1, sizeof(S1AP_InitialContextSetupRequestIEs_t));
|
||||
ASN_SEQUENCE_ADD(&InitialContextSetupRequest->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_RegisteredLAI;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present =
|
||||
S1AP_InitialContextSetupRequestIEs__value_PR_LAI;
|
||||
|
||||
LAI = &ie->value.choice.LAI;
|
||||
ogs_assert(LAI);
|
||||
|
||||
s1ap_buffer_to_OCTET_STRING(&mme_ue->tai.plmn_id, sizeof(plmn_id_t),
|
||||
&LAI->pLMNidentity);
|
||||
ogs_assert(mme_ue->vlr);
|
||||
ogs_assert(mme_ue->p_tmsi);
|
||||
s1ap_uint16_to_OCTET_STRING(mme_ue->vlr->lai.lac, &LAI->lAC);
|
||||
}
|
||||
|
||||
/* Set UeRadioCapability if exists */
|
||||
if (mme_ue->ueRadioCapability.buf && mme_ue->ueRadioCapability.size) {
|
||||
S1AP_UERadioCapability_t *UERadioCapability = NULL;
|
||||
|
|
|
@ -1724,6 +1724,99 @@ int tests1ap_build_tau_request(ogs_pkbuf_t **pkbuf, int i,
|
|||
return OGS_OK;
|
||||
}
|
||||
|
||||
int tests1ap_build_extended_service_request(ogs_pkbuf_t **pkbuf,
|
||||
int i, uint32_t m_tmsi, uint8_t seq, uint8_t *knas_int)
|
||||
{
|
||||
char *payload[TESTS1AP_MAX_MESSAGE] = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
/* 3 */
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
/* 6 */
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
/* 9 */
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
/* 12 */
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
/* 15 */
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
/* 18 */
|
||||
"000c"
|
||||
"4038000005000800 020002001a00100f 17b51a57a504074c 000504e900a25200"
|
||||
"4300060009f10700 07006440080009f1 0707080140008640 0130",
|
||||
"",
|
||||
"",
|
||||
|
||||
/* 21 */
|
||||
"",
|
||||
"",
|
||||
};
|
||||
uint16_t len[TESTS1AP_MAX_MESSAGE] = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
||||
60,
|
||||
0,
|
||||
0,
|
||||
|
||||
/* 21 */
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
char hexbuf[MAX_SDU_LEN];
|
||||
|
||||
*pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN);
|
||||
ogs_pkbuf_put_data(*pkbuf,
|
||||
OGS_HEX(payload[i], strlen(payload[i]), hexbuf), len[i]);
|
||||
m_tmsi = htonl(m_tmsi);
|
||||
memcpy((*pkbuf)->data + 29, &m_tmsi, sizeof m_tmsi);
|
||||
|
||||
snow_3g_f9(knas_int, seq, (0 << 27), 0,
|
||||
(*pkbuf)->data + 23, (10 << 3),
|
||||
(*pkbuf)->data + 19);
|
||||
|
||||
return OGS_OK;
|
||||
}
|
||||
|
||||
int tests1ap_build_pdn_connectivity_request(
|
||||
ogs_pkbuf_t **pkbuf, int i)
|
||||
{
|
||||
|
|
|
@ -82,6 +82,8 @@ int tests1ap_build_service_request(ogs_pkbuf_t **pkbuf,
|
|||
int tests1ap_build_tau_request(ogs_pkbuf_t **pkbuf, int i,
|
||||
uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, uint8_t active_flag,
|
||||
uint32_t m_tmsi, uint8_t seq, uint32_t mac, uint8_t *knas_int);
|
||||
int tests1ap_build_extended_service_request(ogs_pkbuf_t **pkbuf,
|
||||
int i, uint32_t m_tmsi, uint8_t seq, uint8_t *knas_int);
|
||||
int tests1ap_build_pdn_connectivity_request(
|
||||
ogs_pkbuf_t **pkbuf, int i);
|
||||
int tests1ap_build_pdn_disconnectivity_request(
|
||||
|
|
|
@ -283,6 +283,26 @@ static void test1_func(abts_case *tc, void *data)
|
|||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Send Extended Service Request */
|
||||
rv = tests1ap_build_extended_service_request(&sendbuf,
|
||||
msgindex, m_tmsi, 4, mme_ue->knas_int);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
/* Initial Context Setup Request */
|
||||
recvbuf = testenb_s1ap_read(s1ap);
|
||||
ABTS_PTR_NOTNULL(tc, recvbuf);
|
||||
ogs_pkbuf_free(recvbuf);
|
||||
|
||||
/* Send Initial Context Setup Response */
|
||||
rv = tests1ap_build_initial_context_setup_response(&sendbuf,
|
||||
2, 2, 5, 0x00470003, "127.0.0.5");
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
#if 0
|
||||
/* Send Service Request */
|
||||
rv = tests1ap_build_service_request(&sendbuf, 0x000200, 3, 0xc340, m_tmsi);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
@ -301,10 +321,6 @@ static void test1_func(abts_case *tc, void *data)
|
|||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
||||
#if 0
|
||||
ogs_msleep(50);
|
||||
#endif
|
||||
|
||||
/* Send Detach Request */
|
||||
rv = tests1ap_build_detach_request(&sendbuf, msgindex);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
|
@ -332,6 +348,7 @@ static void test1_func(abts_case *tc, void *data)
|
|||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
rv = testenb_s1ap_send(s1ap, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, OGS_OK, rv);
|
||||
#endif
|
||||
|
||||
/********** Remove Subscriber in Database */
|
||||
doc = BCON_NEW("imsi", BCON_UTF8("262420000118139"));
|
||||
|
@ -539,7 +556,9 @@ abts_suite *test_csfb(abts_suite *suite)
|
|||
suite = ADD_SUITE(suite)
|
||||
|
||||
abts_run_test(suite, test1_func, NULL);
|
||||
#if 0
|
||||
abts_run_test(suite, test2_func, NULL);
|
||||
#endif
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue