2019-06-16 02:25:41 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
|
|
|
*
|
|
|
|
* This file is part of Open5GS.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-06-11 13:10:47 +00:00
|
|
|
#include "mme-event.h"
|
2017-03-26 06:34:34 +00:00
|
|
|
|
2019-06-11 13:10:47 +00:00
|
|
|
#include "mme-kdf.h"
|
2019-06-01 09:52:38 +00:00
|
|
|
#include "s1ap-path.h"
|
2019-06-11 13:10:47 +00:00
|
|
|
#include "nas-path.h"
|
|
|
|
#include "mme-gtp-path.h"
|
2019-07-13 13:52:50 +00:00
|
|
|
#include "sgsap-types.h"
|
|
|
|
#include "sgsap-path.h"
|
2017-04-13 10:58:58 +00:00
|
|
|
|
2019-06-11 13:10:47 +00:00
|
|
|
#include "mme-s11-build.h"
|
|
|
|
#include "s1ap-build.h"
|
|
|
|
#include "s1ap-handler.h"
|
2017-04-13 10:58:58 +00:00
|
|
|
|
2019-06-11 13:10:47 +00:00
|
|
|
#include "mme-path.h"
|
|
|
|
#include "mme-sm.h"
|
2017-11-30 11:13:15 +00:00
|
|
|
|
2019-09-13 12:07:47 +00:00
|
|
|
void s1ap_handle_s1_setup_request(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-03-26 05:57:33 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-10 13:52:21 +00:00
|
|
|
int i, j;
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2018-03-10 03:21:02 +00:00
|
|
|
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
|
|
|
S1AP_S1SetupRequest_t *S1SetupRequest = NULL;
|
|
|
|
|
|
|
|
S1AP_S1SetupRequestIEs_t *ie = NULL;
|
|
|
|
S1AP_Global_ENB_ID_t *Global_ENB_ID = NULL;
|
|
|
|
S1AP_SupportedTAs_t *SupportedTAs = NULL;
|
|
|
|
S1AP_PagingDRX_t *PagingDRX = NULL;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_pkbuf_t *s1apbuf = NULL;
|
|
|
|
uint32_t enb_id;
|
2018-03-10 03:21:02 +00:00
|
|
|
S1AP_Cause_PR group = S1AP_Cause_PR_NOTHING;
|
2018-02-22 13:23:16 +00:00
|
|
|
long cause = 0;
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-10 03:21:02 +00:00
|
|
|
initiatingMessage = message->choice.initiatingMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(initiatingMessage);
|
2018-03-10 03:21:02 +00:00
|
|
|
S1SetupRequest = &initiatingMessage->value.choice.S1SetupRequest;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(S1SetupRequest);
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] S1-Setup request");
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < S1SetupRequest->protocolIEs.list.count; i++) {
|
2018-03-10 03:21:02 +00:00
|
|
|
ie = S1SetupRequest->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_Global_ENB_ID:
|
|
|
|
Global_ENB_ID = &ie->value.choice.Global_ENB_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_SupportedTAs:
|
|
|
|
SupportedTAs = &ie->value.choice.SupportedTAs;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_DefaultPagingDRX:
|
|
|
|
PagingDRX = &ie->value.choice.PagingDRX;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-10 03:21:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(Global_ENB_ID);
|
2018-03-10 13:52:21 +00:00
|
|
|
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_s1ap_ENB_ID_to_uint32(&Global_ENB_ID->eNB_ID, &enb_id);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]", OGS_ADDR(enb->addr, buf), enb_id);
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2018-03-12 11:38:21 +00:00
|
|
|
if (PagingDRX)
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" PagingDRX[%ld]", *PagingDRX);
|
2018-03-12 11:38:21 +00:00
|
|
|
|
2018-02-22 13:23:16 +00:00
|
|
|
mme_enb_set_enb_id(enb, enb_id);
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(SupportedTAs);
|
2017-08-04 21:34:52 +00:00
|
|
|
/* Parse Supported TA */
|
2017-12-11 07:55:11 +00:00
|
|
|
enb->num_of_supported_ta_list = 0;
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < SupportedTAs->list.count; i++) {
|
2018-03-10 03:21:02 +00:00
|
|
|
S1AP_SupportedTAs_Item_t *SupportedTAs_Item = NULL;
|
2018-03-10 13:52:21 +00:00
|
|
|
S1AP_TAC_t *tAC = NULL;
|
2017-08-04 21:34:52 +00:00
|
|
|
|
2018-03-10 03:21:02 +00:00
|
|
|
SupportedTAs_Item =
|
|
|
|
(S1AP_SupportedTAs_Item_t *)SupportedTAs->list.array[i];
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(SupportedTAs_Item);
|
2018-03-10 13:52:21 +00:00
|
|
|
tAC = &SupportedTAs_Item->tAC;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(tAC);
|
2017-08-04 21:34:52 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (j = 0; j < SupportedTAs_Item->broadcastPLMNs.list.count; j++) {
|
2018-03-10 13:52:21 +00:00
|
|
|
S1AP_PLMNidentity_t *pLMNidentity = NULL;
|
|
|
|
pLMNidentity = (S1AP_PLMNidentity_t *)
|
2018-03-10 03:21:02 +00:00
|
|
|
SupportedTAs_Item->broadcastPLMNs.list.array[j];
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(pLMNidentity);
|
2017-08-04 21:34:52 +00:00
|
|
|
|
2017-12-11 07:55:11 +00:00
|
|
|
memcpy(&enb->supported_ta_list[enb->num_of_supported_ta_list].tac,
|
2019-04-27 14:54:30 +00:00
|
|
|
tAC->buf, sizeof(uint16_t));
|
2017-12-11 07:55:11 +00:00
|
|
|
enb->supported_ta_list[enb->num_of_supported_ta_list].tac =
|
|
|
|
ntohs(enb->supported_ta_list
|
|
|
|
[enb->num_of_supported_ta_list].tac);
|
|
|
|
memcpy(&enb->supported_ta_list
|
|
|
|
[enb->num_of_supported_ta_list].plmn_id,
|
2019-09-13 12:07:47 +00:00
|
|
|
pLMNidentity->buf, sizeof(ogs_plmn_id_t));
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" PLMN_ID[MCC:%d MNC:%d] TAC[%d]",
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_plmn_id_mcc(&enb->supported_ta_list
|
2018-01-22 14:14:20 +00:00
|
|
|
[enb->num_of_supported_ta_list].plmn_id),
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_plmn_id_mnc(&enb->supported_ta_list
|
2018-02-22 13:23:16 +00:00
|
|
|
[enb->num_of_supported_ta_list].plmn_id),
|
|
|
|
enb->supported_ta_list[enb->num_of_supported_ta_list].tac);
|
2017-12-11 07:55:11 +00:00
|
|
|
enb->num_of_supported_ta_list++;
|
2017-08-04 21:34:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (enb->num_of_supported_ta_list == 0) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_warn("S1-Setup failure:");
|
|
|
|
ogs_warn(" No supported TA exist in S1-Setup request");
|
2018-03-10 03:21:02 +00:00
|
|
|
group = S1AP_Cause_PR_misc;
|
|
|
|
cause = S1AP_CauseMisc_unspecified;
|
2019-06-16 02:25:41 +00:00
|
|
|
} else {
|
2018-02-22 13:23:16 +00:00
|
|
|
int served_tai_index = -1;
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < enb->num_of_supported_ta_list; i++) {
|
2018-02-22 13:23:16 +00:00
|
|
|
served_tai_index =
|
|
|
|
mme_find_served_tai(&enb->supported_ta_list[i]);
|
|
|
|
if (served_tai_index >= 0 &&
|
2019-06-16 02:25:41 +00:00
|
|
|
served_tai_index < MAX_NUM_OF_SERVED_TAI) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" SERVED_TAI_INDEX[%d]", served_tai_index);
|
2018-02-22 13:23:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-08-04 21:34:52 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (served_tai_index < 0) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_warn("S1-Setup failure:");
|
|
|
|
ogs_warn(" Cannot find Served TAI. Check 'mme.tai' configuration");
|
2018-03-10 03:21:02 +00:00
|
|
|
group = S1AP_Cause_PR_misc;
|
|
|
|
cause = S1AP_CauseMisc_unknown_PLMN;
|
2018-02-22 13:23:16 +00:00
|
|
|
}
|
|
|
|
}
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (group == S1AP_Cause_PR_NOTHING) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] S1-Setup response");
|
|
|
|
ogs_assert(s1ap_build_setup_rsp(&s1apbuf) == OGS_OK);
|
2019-06-16 02:25:41 +00:00
|
|
|
} else {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] S1-Setup failure");
|
|
|
|
ogs_assert(s1ap_build_setup_failure(
|
|
|
|
&s1apbuf, group, cause, S1AP_TimeToWait_v10s) == OGS_OK);
|
2018-02-22 13:23:16 +00:00
|
|
|
}
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(
|
|
|
|
s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == OGS_OK);
|
2017-03-26 05:57:33 +00:00
|
|
|
}
|
|
|
|
|
2019-09-13 12:07:47 +00:00
|
|
|
void s1ap_handle_initial_ue_message(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-03-26 05:57:33 +00:00
|
|
|
{
|
2018-03-10 13:52:21 +00:00
|
|
|
int i;
|
2019-04-27 14:54:30 +00:00
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2018-03-10 13:52:21 +00:00
|
|
|
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
|
|
|
S1AP_InitialUEMessage_t *InitialUEMessage = NULL;
|
|
|
|
|
|
|
|
S1AP_InitialUEMessage_IEs_t *ie = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_NAS_PDU_t *NAS_PDU = NULL;
|
|
|
|
S1AP_TAI_t *TAI = NULL;
|
|
|
|
S1AP_EUTRAN_CGI_t *EUTRAN_CGI = NULL;
|
|
|
|
S1AP_S_TMSI_t *S_TMSI = NULL;
|
|
|
|
|
|
|
|
S1AP_PLMNidentity_t *pLMNidentity = NULL;
|
2018-03-10 03:21:02 +00:00
|
|
|
S1AP_TAC_t *tAC = NULL;
|
2018-03-10 13:52:21 +00:00
|
|
|
S1AP_CellIdentity_t *cell_ID = NULL;
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2018-03-10 13:52:21 +00:00
|
|
|
enb_ue_t *enb_ue = NULL;
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2018-03-10 13:52:21 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-10 13:52:21 +00:00
|
|
|
initiatingMessage = message->choice.initiatingMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(initiatingMessage);
|
2018-03-10 13:52:21 +00:00
|
|
|
InitialUEMessage = &initiatingMessage->value.choice.InitialUEMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(InitialUEMessage);
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Initial UE Message");
|
2018-03-10 13:52:21 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < InitialUEMessage->protocolIEs.list.count; i++) {
|
2018-03-10 13:52:21 +00:00
|
|
|
ie = InitialUEMessage->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_NAS_PDU:
|
|
|
|
NAS_PDU = &ie->value.choice.NAS_PDU;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_TAI:
|
|
|
|
TAI = &ie->value.choice.TAI;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_EUTRAN_CGI:
|
|
|
|
EUTRAN_CGI = &ie->value.choice.EUTRAN_CGI;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_S_TMSI:
|
|
|
|
S_TMSI = &ie->value.choice.S_TMSI;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-10 13:52:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
2018-03-10 13:52:21 +00:00
|
|
|
enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
2019-06-16 02:25:41 +00:00
|
|
|
if (!enb_ue) {
|
2017-04-28 07:11:45 +00:00
|
|
|
enb_ue = enb_ue_add(enb);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb_ue);
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2018-03-10 13:52:21 +00:00
|
|
|
enb_ue->enb_ue_s1ap_id = *ENB_UE_S1AP_ID;
|
2017-07-25 00:03:20 +00:00
|
|
|
|
2018-03-10 13:52:21 +00:00
|
|
|
/* Find MME_UE if S_TMSI included */
|
2019-06-16 02:25:41 +00:00
|
|
|
if (S_TMSI) {
|
2017-07-25 00:03:20 +00:00
|
|
|
served_gummei_t *served_gummei = &mme_self()->served_gummei[0];
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_nas_guti_t nas_guti;
|
2017-07-26 02:28:43 +00:00
|
|
|
mme_ue_t *mme_ue = NULL;
|
2017-07-25 00:03:20 +00:00
|
|
|
|
2019-09-13 12:07:47 +00:00
|
|
|
memset(&nas_guti, 0, sizeof(ogs_nas_guti_t));
|
2017-07-25 00:03:20 +00:00
|
|
|
|
2018-01-31 03:54:59 +00:00
|
|
|
/* Use the first configured plmn_id and mme group id */
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_nas_from_plmn_id(&nas_guti.nas_plmn_id, &served_gummei->plmn_id[0]);
|
2019-05-26 06:27:09 +00:00
|
|
|
nas_guti.mme_gid = served_gummei->mme_gid[0];
|
2017-07-25 00:03:20 +00:00
|
|
|
|
|
|
|
/* size must be 1 */
|
2019-05-26 06:27:09 +00:00
|
|
|
memcpy(&nas_guti.mme_code, S_TMSI->mMEC.buf, S_TMSI->mMEC.size);
|
2017-07-25 00:03:20 +00:00
|
|
|
/* size must be 4 */
|
2019-05-26 06:27:09 +00:00
|
|
|
memcpy(&nas_guti.m_tmsi, S_TMSI->m_TMSI.buf, S_TMSI->m_TMSI.size);
|
|
|
|
nas_guti.m_tmsi = ntohl(nas_guti.m_tmsi);
|
2017-07-25 00:03:20 +00:00
|
|
|
|
2019-05-26 06:27:09 +00:00
|
|
|
mme_ue = mme_ue_find_by_guti(&nas_guti);
|
2019-06-16 02:25:41 +00:00
|
|
|
if (!mme_ue) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_warn("Unknown UE by S_TMSI[G:%d,C:%d,M_TMSI:0x%x]",
|
2019-05-26 06:27:09 +00:00
|
|
|
nas_guti.mme_gid, nas_guti.mme_code, nas_guti.m_tmsi);
|
2019-06-16 02:25:41 +00:00
|
|
|
} else {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" S_TMSI[G:%d,C:%d,M_TMSI:0x%x] IMSI:[%s]",
|
2018-01-28 06:08:52 +00:00
|
|
|
mme_ue->guti.mme_gid,
|
|
|
|
mme_ue->guti.mme_code,
|
|
|
|
mme_ue->guti.m_tmsi,
|
|
|
|
MME_UE_HAVE_IMSI(mme_ue)
|
|
|
|
? mme_ue->imsi_bcd : "Unknown");
|
2018-01-29 10:10:54 +00:00
|
|
|
|
2018-01-30 13:10:28 +00:00
|
|
|
/* If NAS(mme_ue_t) has already been associated with
|
2018-02-02 10:37:36 +00:00
|
|
|
* older S1(enb_ue_t) context */
|
2019-06-16 02:25:41 +00:00
|
|
|
if (ECM_CONNECTED(mme_ue)) {
|
2018-02-02 10:37:36 +00:00
|
|
|
/* Implcit S1 release */
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("Implicit S1 release");
|
|
|
|
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-02-01 19:26:01 +00:00
|
|
|
mme_ue->enb_ue->enb_ue_s1ap_id,
|
|
|
|
mme_ue->enb_ue->mme_ue_s1ap_id);
|
2019-06-30 11:46:15 +00:00
|
|
|
enb_ue_remove(mme_ue->enb_ue);
|
2018-01-30 13:10:28 +00:00
|
|
|
}
|
2017-09-14 09:01:26 +00:00
|
|
|
mme_ue_associate_enb_ue(mme_ue, enb_ue);
|
2017-07-25 00:03:20 +00:00
|
|
|
}
|
|
|
|
}
|
2017-03-26 05:57:33 +00:00
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(TAI);
|
2018-03-10 13:52:21 +00:00
|
|
|
pLMNidentity = &TAI->pLMNidentity;
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_assert(pLMNidentity && pLMNidentity->size == sizeof(ogs_plmn_id_t));
|
2018-03-10 13:52:21 +00:00
|
|
|
tAC = &TAI->tAC;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(tAC && tAC->size == sizeof(uint16_t));
|
2017-12-11 07:55:11 +00:00
|
|
|
|
2019-06-02 12:55:24 +00:00
|
|
|
memcpy(&enb_ue->saved.tai.plmn_id, pLMNidentity->buf,
|
|
|
|
sizeof(enb_ue->saved.tai.plmn_id));
|
|
|
|
memcpy(&enb_ue->saved.tai.tac, tAC->buf, sizeof(enb_ue->saved.tai.tac));
|
|
|
|
enb_ue->saved.tai.tac = ntohs(enb_ue->saved.tai.tac);
|
2017-12-11 07:55:11 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(EUTRAN_CGI);
|
2018-03-10 13:52:21 +00:00
|
|
|
pLMNidentity = &EUTRAN_CGI->pLMNidentity;
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_assert(pLMNidentity && pLMNidentity->size == sizeof(ogs_plmn_id_t));
|
2018-03-10 13:52:21 +00:00
|
|
|
cell_ID = &EUTRAN_CGI->cell_ID;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(cell_ID);
|
2019-06-02 12:55:24 +00:00
|
|
|
memcpy(&enb_ue->saved.e_cgi.plmn_id, pLMNidentity->buf,
|
|
|
|
sizeof(enb_ue->saved.e_cgi.plmn_id));
|
|
|
|
memcpy(&enb_ue->saved.e_cgi.cell_id, cell_ID->buf,
|
|
|
|
sizeof(enb_ue->saved.e_cgi.cell_id));
|
|
|
|
enb_ue->saved.e_cgi.cell_id = (ntohl(enb_ue->saved.e_cgi.cell_id) >> 4);
|
2017-04-11 11:44:38 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d] TAC[%d]",
|
2019-06-02 12:55:24 +00:00
|
|
|
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id, enb_ue->saved.tai.tac);
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(s1ap_send_to_nas(enb_ue,
|
|
|
|
S1AP_ProcedureCode_id_initialUEMessage, NAS_PDU) == OGS_OK);
|
2017-03-26 05:57:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void s1ap_handle_uplink_nas_transport(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-03-26 05:57:33 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-10 13:52:21 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
|
|
|
S1AP_UplinkNASTransport_t *UplinkNASTransport = NULL;
|
|
|
|
|
|
|
|
S1AP_UplinkNASTransport_IEs_t *ie = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_NAS_PDU_t *NAS_PDU = NULL;
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2017-04-28 07:11:45 +00:00
|
|
|
enb_ue_t *enb_ue = NULL;
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2018-03-11 05:38:35 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-10 13:52:21 +00:00
|
|
|
initiatingMessage = message->choice.initiatingMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(initiatingMessage);
|
2018-03-10 13:52:21 +00:00
|
|
|
UplinkNASTransport = &initiatingMessage->value.choice.UplinkNASTransport;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(UplinkNASTransport);
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Uplink NAS transport");
|
2018-03-10 13:52:21 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < UplinkNASTransport->protocolIEs.list.count; i++) {
|
2018-03-10 13:52:21 +00:00
|
|
|
ie = UplinkNASTransport->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_NAS_PDU:
|
|
|
|
NAS_PDU = &ie->value.choice.NAS_PDU;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-10 13:52:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
2018-03-10 13:52:21 +00:00
|
|
|
enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
2019-08-27 15:14:19 +00:00
|
|
|
ogs_expect_or_return(enb_ue);
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
2017-03-26 05:57:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(s1ap_send_to_nas(enb_ue,
|
|
|
|
S1AP_ProcedureCode_id_uplinkNASTransport, NAS_PDU) == OGS_OK);
|
2017-03-26 05:57:33 +00:00
|
|
|
}
|
|
|
|
|
2017-04-13 14:14:59 +00:00
|
|
|
void s1ap_handle_ue_capability_info_indication(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-04-13 14:14:59 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-10 13:52:21 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
|
|
|
S1AP_UECapabilityInfoIndication_t *UECapabilityInfoIndication = NULL;
|
|
|
|
|
|
|
|
S1AP_UECapabilityInfoIndicationIEs_t *ie = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_UERadioCapability_t *UERadioCapability = NULL;
|
2017-04-13 14:14:59 +00:00
|
|
|
|
2017-04-28 07:11:45 +00:00
|
|
|
enb_ue_t *enb_ue = NULL;
|
2017-04-13 14:14:59 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2018-03-11 05:38:35 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-10 13:52:21 +00:00
|
|
|
initiatingMessage = message->choice.initiatingMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(initiatingMessage);
|
2018-03-10 13:52:21 +00:00
|
|
|
UECapabilityInfoIndication =
|
|
|
|
&initiatingMessage->value.choice.UECapabilityInfoIndication;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(UECapabilityInfoIndication);
|
2017-04-13 14:14:59 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] UE capability info indication");
|
2018-03-10 13:52:21 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < UECapabilityInfoIndication->protocolIEs.list.count; i++) {
|
2018-03-10 13:52:21 +00:00
|
|
|
ie = UECapabilityInfoIndication->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_UERadioCapability:
|
|
|
|
UERadioCapability = &ie->value.choice.UERadioCapability;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-10 13:52:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
2018-03-10 13:52:21 +00:00
|
|
|
enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb_ue);
|
2017-04-13 14:14:59 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (enb_ue->mme_ue) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(UERadioCapability);
|
2019-09-13 12:07:47 +00:00
|
|
|
OGS_S1AP_STORE_DATA(&enb_ue->mme_ue->ueRadioCapability,
|
|
|
|
UERadioCapability);
|
2017-08-08 19:01:08 +00:00
|
|
|
}
|
2017-04-13 14:14:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void s1ap_handle_initial_context_setup_response(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-04-13 14:14:59 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-10 13:52:21 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
|
|
|
|
S1AP_InitialContextSetupResponse_t *InitialContextSetupResponse = NULL;
|
|
|
|
|
|
|
|
S1AP_InitialContextSetupResponseIEs_t *ie = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_E_RABSetupListCtxtSURes_t *E_RABSetupListCtxtSURes = NULL;
|
2017-04-13 14:14:59 +00:00
|
|
|
|
2017-09-11 15:49:15 +00:00
|
|
|
mme_ue_t *mme_ue = NULL;
|
2017-04-28 07:11:45 +00:00
|
|
|
enb_ue_t *enb_ue = NULL;
|
2017-04-13 14:14:59 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2018-03-11 05:38:35 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-10 13:52:21 +00:00
|
|
|
successfulOutcome = message->choice.successfulOutcome;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(successfulOutcome);
|
2018-03-10 13:52:21 +00:00
|
|
|
InitialContextSetupResponse =
|
|
|
|
&successfulOutcome->value.choice.InitialContextSetupResponse;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(InitialContextSetupResponse);
|
2017-04-13 14:14:59 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Initial context setup response");
|
2018-03-10 13:52:21 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < InitialContextSetupResponse->protocolIEs.list.count; i++) {
|
2018-03-10 13:52:21 +00:00
|
|
|
ie = InitialContextSetupResponse->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_E_RABSetupListCtxtSURes:
|
|
|
|
E_RABSetupListCtxtSURes =
|
|
|
|
&ie->value.choice.E_RABSetupListCtxtSURes;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-10 13:52:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
2018-03-10 13:52:21 +00:00
|
|
|
enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb_ue);
|
2017-09-11 15:49:15 +00:00
|
|
|
mme_ue = enb_ue->mme_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(mme_ue);
|
2017-04-13 14:14:59 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
2017-04-13 16:26:50 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(E_RABSetupListCtxtSURes);
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < E_RABSetupListCtxtSURes->list.count; i++) {
|
2018-03-21 07:10:20 +00:00
|
|
|
S1AP_E_RABSetupItemCtxtSUResIEs_t *ie2 = NULL;
|
2018-03-10 13:52:21 +00:00
|
|
|
S1AP_E_RABSetupItemCtxtSURes_t *e_rab = NULL;
|
|
|
|
|
2017-04-13 16:26:50 +00:00
|
|
|
mme_bearer_t *bearer = NULL;
|
|
|
|
|
2018-03-21 07:10:20 +00:00
|
|
|
ie2 = (S1AP_E_RABSetupItemCtxtSUResIEs_t *)
|
2018-03-10 13:52:21 +00:00
|
|
|
E_RABSetupListCtxtSURes->list.array[i];
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ie2);
|
2018-03-10 13:52:21 +00:00
|
|
|
|
2018-03-21 07:10:20 +00:00
|
|
|
e_rab = &ie2->value.choice.E_RABSetupItemCtxtSURes;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(e_rab);
|
2017-04-13 16:26:50 +00:00
|
|
|
|
2019-07-28 10:44:15 +00:00
|
|
|
bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(bearer);
|
2017-04-13 16:26:50 +00:00
|
|
|
memcpy(&bearer->enb_s1u_teid, e_rab->gTP_TEID.buf,
|
|
|
|
sizeof(bearer->enb_s1u_teid));
|
|
|
|
bearer->enb_s1u_teid = ntohl(bearer->enb_s1u_teid);
|
2019-09-13 12:07:47 +00:00
|
|
|
rv = ogs_s1ap_BIT_STRING_to_ip(
|
2017-12-07 08:23:45 +00:00
|
|
|
&e_rab->transportLayerAddress, &bearer->enb_s1u_ip);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-08 03:11:44 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" EBI[%d] ENB-S1U-TEID[%d]",
|
2018-02-01 05:07:01 +00:00
|
|
|
bearer->ebi, bearer->enb_s1u_teid);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (OGS_FSM_CHECK(&bearer->sm, esm_state_active)) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" NAS_EPS Type[%d]", mme_ue->nas_eps.type);
|
2017-09-14 08:29:34 +00:00
|
|
|
int uli_presence = 0;
|
2019-06-16 02:25:41 +00:00
|
|
|
if (mme_ue->nas_eps.type != MME_EPS_TYPE_ATTACH_REQUEST) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" ### ULI PRESENT ###");
|
2017-09-14 08:29:34 +00:00
|
|
|
uli_presence = 1;
|
2017-09-14 02:12:02 +00:00
|
|
|
}
|
2017-09-14 08:29:34 +00:00
|
|
|
rv = mme_gtp_send_modify_bearer_request(bearer, uli_presence);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-08 03:11:44 +00:00
|
|
|
}
|
2017-04-13 16:26:50 +00:00
|
|
|
}
|
2019-07-13 13:52:50 +00:00
|
|
|
|
2019-07-14 02:00:11 +00:00
|
|
|
if (SMS_SERVICE_INDICATOR(mme_ue)) {
|
2019-07-13 13:52:50 +00:00
|
|
|
sgsap_send_service_request(mme_ue, SGSAP_EMM_CONNECTED_MODE);
|
|
|
|
}
|
|
|
|
|
|
|
|
CLEAR_SERVICE_INDICATOR(mme_ue);
|
2017-04-13 14:14:59 +00:00
|
|
|
}
|
|
|
|
|
2018-01-02 09:30:17 +00:00
|
|
|
void s1ap_handle_initial_context_setup_failure(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2018-01-02 09:30:17 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-10 13:52:21 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL;
|
|
|
|
S1AP_InitialContextSetupFailure_t *InitialContextSetupFailure = NULL;
|
|
|
|
|
|
|
|
S1AP_InitialContextSetupFailureIEs_t *ie = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_Cause_t *Cause = NULL;
|
2018-01-02 09:30:17 +00:00
|
|
|
|
|
|
|
mme_ue_t *mme_ue = NULL;
|
|
|
|
enb_ue_t *enb_ue = NULL;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2018-03-11 05:38:35 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-10 13:52:21 +00:00
|
|
|
unsuccessfulOutcome = message->choice.unsuccessfulOutcome;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(unsuccessfulOutcome);
|
2018-03-10 13:52:21 +00:00
|
|
|
InitialContextSetupFailure =
|
|
|
|
&unsuccessfulOutcome->value.choice.InitialContextSetupFailure;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(InitialContextSetupFailure);
|
2018-01-02 09:30:17 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Initial context setup failure");
|
2018-03-10 13:52:21 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < InitialContextSetupFailure->protocolIEs.list.count; i++) {
|
2018-03-10 13:52:21 +00:00
|
|
|
ie = InitialContextSetupFailure->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_Cause:
|
|
|
|
Cause = &ie->value.choice.Cause;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-10 13:52:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-03-10 13:52:21 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
|
|
|
ogs_assert(Cause);
|
2018-03-10 13:52:21 +00:00
|
|
|
|
|
|
|
enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
2019-06-16 02:25:41 +00:00
|
|
|
if (enb_ue == NULL) {
|
2019-07-10 13:04:52 +00:00
|
|
|
ogs_warn("Initial context setup failure : "
|
|
|
|
"cannot find eNB-UE-S1AP-ID[%d]", (int)*ENB_UE_S1AP_ID);
|
2019-07-14 02:00:11 +00:00
|
|
|
goto cleanup;
|
2018-04-06 00:38:11 +00:00
|
|
|
}
|
2018-03-10 13:52:21 +00:00
|
|
|
mme_ue = enb_ue->mme_ue;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-28 04:50:21 +00:00
|
|
|
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Cause[Group:%d Cause:%d]",
|
|
|
|
Cause->present, (int)Cause->choice.radioNetwork);
|
2018-01-28 13:08:53 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(mme_ue);
|
2019-06-16 02:25:41 +00:00
|
|
|
if (mme_ue && OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" EMM-Registered");
|
2018-01-29 05:48:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 19.2.2.3 in Spec 36.300
|
|
|
|
*
|
|
|
|
* In case of failure, eNB and MME behaviours are not mandated.
|
|
|
|
*
|
|
|
|
* Both implicit release (local release at each node) and
|
|
|
|
* explicit release (MME-initiated UE Context Release procedure)
|
|
|
|
* may in principle be adopted. The eNB should ensure
|
|
|
|
* that no hanging resources remain at the eNB.
|
|
|
|
*/
|
2019-06-16 02:25:41 +00:00
|
|
|
} else {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" NOT EMM-Registered");
|
|
|
|
ogs_assert(mme_ue);
|
2018-02-03 13:55:05 +00:00
|
|
|
rv = mme_send_delete_session_or_ue_context_release(mme_ue, enb_ue);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2018-01-11 23:32:33 +00:00
|
|
|
}
|
2019-07-14 02:00:11 +00:00
|
|
|
|
|
|
|
cleanup:
|
|
|
|
CLEAR_SERVICE_INDICATOR(mme_ue);
|
2018-01-02 09:30:17 +00:00
|
|
|
}
|
|
|
|
|
2019-07-10 13:04:52 +00:00
|
|
|
void s1ap_handle_ue_context_modification_response(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2019-07-10 13:04:52 +00:00
|
|
|
{
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
|
|
|
|
S1AP_UEContextModificationResponse_t *UEContextModificationResponse = NULL;
|
|
|
|
|
|
|
|
S1AP_UEContextModificationResponseIEs_t *ie = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
|
|
|
|
mme_ue_t *mme_ue = NULL;
|
|
|
|
enb_ue_t *enb_ue = NULL;
|
|
|
|
|
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
|
|
|
|
|
|
|
ogs_assert(message);
|
|
|
|
successfulOutcome = message->choice.successfulOutcome;
|
|
|
|
ogs_assert(successfulOutcome);
|
|
|
|
UEContextModificationResponse =
|
|
|
|
&successfulOutcome->value.choice.UEContextModificationResponse;
|
|
|
|
ogs_assert(UEContextModificationResponse);
|
|
|
|
|
|
|
|
ogs_debug("[MME] UE context modification response");
|
|
|
|
|
|
|
|
for (i = 0; i < UEContextModificationResponse->protocolIEs.list.count; i++) {
|
|
|
|
ie = UEContextModificationResponse->protocolIEs.list.array[i];
|
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
|
|
|
|
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
|
|
|
enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
|
|
|
ogs_assert(enb_ue);
|
|
|
|
mme_ue = enb_ue->mme_ue;
|
|
|
|
ogs_assert(mme_ue);
|
|
|
|
|
|
|
|
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
|
|
|
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
|
|
|
|
2019-07-14 02:00:11 +00:00
|
|
|
CLEAR_SERVICE_INDICATOR(mme_ue);
|
2019-07-10 13:04:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void s1ap_handle_ue_context_modification_failure(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2019-07-10 13:04:52 +00:00
|
|
|
{
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL;
|
|
|
|
S1AP_UEContextModificationFailure_t *UEContextModificationFailure = NULL;
|
|
|
|
|
|
|
|
S1AP_UEContextModificationFailureIEs_t *ie = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_Cause_t *Cause = NULL;
|
|
|
|
|
|
|
|
enb_ue_t *enb_ue = NULL;
|
2019-07-14 02:00:11 +00:00
|
|
|
mme_ue_t *mme_ue = NULL;
|
2019-07-10 13:04:52 +00:00
|
|
|
|
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
|
|
|
|
|
|
|
ogs_assert(message);
|
|
|
|
unsuccessfulOutcome = message->choice.unsuccessfulOutcome;
|
|
|
|
ogs_assert(unsuccessfulOutcome);
|
|
|
|
UEContextModificationFailure =
|
|
|
|
&unsuccessfulOutcome->value.choice.UEContextModificationFailure;
|
|
|
|
ogs_assert(UEContextModificationFailure);
|
|
|
|
|
|
|
|
ogs_warn("[MME] UE context modification failure");
|
|
|
|
|
|
|
|
for (i = 0; i < UEContextModificationFailure->protocolIEs.list.count; i++) {
|
|
|
|
ie = UEContextModificationFailure->protocolIEs.list.array[i];
|
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_Cause:
|
|
|
|
Cause = &ie->value.choice.Cause;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
|
|
|
|
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
|
|
|
ogs_assert(Cause);
|
|
|
|
|
|
|
|
enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
|
|
|
if (enb_ue == NULL) {
|
|
|
|
ogs_warn("Initial context setup failure : "
|
|
|
|
"cannot find eNB-UE-S1AP-ID[%d]", (int)*ENB_UE_S1AP_ID);
|
2019-07-14 02:00:11 +00:00
|
|
|
goto cleanup;
|
2019-07-10 13:04:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
|
|
|
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
|
|
|
ogs_debug(" Cause[Group:%d Cause:%d]",
|
|
|
|
Cause->present, (int)Cause->choice.radioNetwork);
|
2019-07-14 02:00:11 +00:00
|
|
|
|
|
|
|
cleanup:
|
|
|
|
mme_ue = enb_ue->mme_ue;
|
|
|
|
ogs_assert(mme_ue);
|
|
|
|
CLEAR_SERVICE_INDICATOR(mme_ue);
|
2019-07-10 13:04:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-04 16:17:24 +00:00
|
|
|
void s1ap_handle_e_rab_setup_response(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-09-04 16:17:24 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2017-09-04 16:17:24 +00:00
|
|
|
int i;
|
|
|
|
|
2018-03-11 11:41:37 +00:00
|
|
|
S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
|
|
|
|
S1AP_E_RABSetupResponse_t *E_RABSetupResponse = NULL;
|
|
|
|
|
|
|
|
S1AP_E_RABSetupResponseIEs_t *ie = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_E_RABSetupListBearerSURes_t *E_RABSetupListBearerSURes = NULL;
|
|
|
|
|
2017-09-04 16:17:24 +00:00
|
|
|
enb_ue_t *enb_ue = NULL;
|
2017-09-11 15:49:15 +00:00
|
|
|
mme_ue_t *mme_ue = NULL;
|
2017-09-04 16:17:24 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2017-09-04 16:17:24 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-11 11:41:37 +00:00
|
|
|
successfulOutcome = message->choice.successfulOutcome;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(successfulOutcome);
|
2018-03-11 11:41:37 +00:00
|
|
|
E_RABSetupResponse = &successfulOutcome->value.choice.E_RABSetupResponse;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(E_RABSetupResponse);
|
2017-09-04 16:17:24 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] E-RAB setup response");
|
2018-03-11 11:41:37 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < E_RABSetupResponse->protocolIEs.list.count; i++) {
|
2018-03-11 11:41:37 +00:00
|
|
|
ie = E_RABSetupResponse->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_E_RABSetupListBearerSURes:
|
|
|
|
E_RABSetupListBearerSURes =
|
|
|
|
&ie->value.choice.E_RABSetupListBearerSURes;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-11 11:41:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
2018-03-11 11:41:37 +00:00
|
|
|
enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb_ue);
|
2017-09-11 15:49:15 +00:00
|
|
|
mme_ue = enb_ue->mme_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(mme_ue);
|
2017-09-04 16:17:24 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
2017-09-04 16:17:24 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(E_RABSetupListBearerSURes);
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < E_RABSetupListBearerSURes->list.count; i++) {
|
2018-03-21 07:10:20 +00:00
|
|
|
S1AP_E_RABSetupItemBearerSUResIEs_t *ie2 = NULL;
|
2018-03-10 03:21:02 +00:00
|
|
|
S1AP_E_RABSetupItemBearerSURes_t *e_rab = NULL;
|
2017-09-04 16:17:24 +00:00
|
|
|
|
2018-03-11 11:41:37 +00:00
|
|
|
mme_bearer_t *bearer = NULL;
|
|
|
|
|
2018-03-21 07:10:20 +00:00
|
|
|
ie2 = (S1AP_E_RABSetupItemBearerSUResIEs_t *)
|
2018-03-11 11:41:37 +00:00
|
|
|
E_RABSetupListBearerSURes->list.array[i];
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ie2);
|
2018-03-11 11:41:37 +00:00
|
|
|
|
2018-03-21 07:10:20 +00:00
|
|
|
e_rab = &ie2->value.choice.E_RABSetupItemBearerSURes;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(e_rab);
|
2017-09-04 16:17:24 +00:00
|
|
|
|
|
|
|
bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(bearer);
|
2017-09-04 16:17:24 +00:00
|
|
|
|
|
|
|
memcpy(&bearer->enb_s1u_teid, e_rab->gTP_TEID.buf,
|
|
|
|
sizeof(bearer->enb_s1u_teid));
|
|
|
|
bearer->enb_s1u_teid = ntohl(bearer->enb_s1u_teid);
|
2019-09-13 12:07:47 +00:00
|
|
|
rv = ogs_s1ap_BIT_STRING_to_ip(
|
2017-12-07 08:23:45 +00:00
|
|
|
&e_rab->transportLayerAddress, &bearer->enb_s1u_ip);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-08 03:11:44 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" EBI[%d]", bearer->ebi);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (OGS_FSM_CHECK(&bearer->sm, esm_state_active)) {
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
2017-09-08 03:11:44 +00:00
|
|
|
|
|
|
|
mme_bearer_t *linked_bearer = mme_linked_bearer(bearer);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(linked_bearer);
|
|
|
|
ogs_debug(" Linked-EBI[%d]", linked_bearer->ebi);
|
2017-09-08 03:11:44 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (bearer->ebi == linked_bearer->ebi) {
|
2017-09-14 08:29:34 +00:00
|
|
|
rv = mme_gtp_send_modify_bearer_request(bearer, 0);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2019-06-16 02:25:41 +00:00
|
|
|
} else {
|
2017-09-08 03:11:44 +00:00
|
|
|
rv = mme_gtp_send_create_bearer_response(bearer);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-08 03:11:44 +00:00
|
|
|
}
|
|
|
|
}
|
2017-09-04 16:17:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-25 00:03:20 +00:00
|
|
|
void s1ap_handle_ue_context_release_request(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-07-25 00:03:20 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-11 05:38:35 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
|
|
|
S1AP_UEContextReleaseRequest_t *UEContextReleaseRequest = NULL;
|
|
|
|
|
|
|
|
S1AP_UEContextReleaseRequest_IEs_t *ie = NULL;
|
|
|
|
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
2018-03-12 14:06:14 +00:00
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
2018-03-11 05:38:35 +00:00
|
|
|
S1AP_Cause_t *Cause = NULL;
|
2017-07-25 00:03:20 +00:00
|
|
|
|
|
|
|
enb_ue_t *enb_ue = NULL;
|
2018-01-29 13:38:53 +00:00
|
|
|
mme_ue_t *mme_ue = NULL;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2018-02-03 02:48:15 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-11 05:38:35 +00:00
|
|
|
initiatingMessage = message->choice.initiatingMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(initiatingMessage);
|
2018-03-11 05:38:35 +00:00
|
|
|
UEContextReleaseRequest =
|
|
|
|
&initiatingMessage->value.choice.UEContextReleaseRequest;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(UEContextReleaseRequest);
|
2017-07-25 00:03:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] UE Context release request");
|
2018-03-11 05:38:35 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < UEContextReleaseRequest->protocolIEs.list.count; i++) {
|
2018-03-11 05:38:35 +00:00
|
|
|
ie = UEContextReleaseRequest->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID:
|
|
|
|
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_Cause:
|
|
|
|
Cause = &ie->value.choice.Cause;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-11 05:38:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(MME_UE_S1AP_ID);
|
2018-03-11 05:38:35 +00:00
|
|
|
enb_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID);
|
2019-06-16 02:25:41 +00:00
|
|
|
if (!enb_ue) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_warn("No ENB UE Context : MME_UE_S1AP_ID[%d]",
|
|
|
|
(int)*MME_UE_S1AP_ID);
|
2018-02-03 02:48:15 +00:00
|
|
|
rv = s1ap_send_error_indication(enb,
|
2018-03-14 08:59:56 +00:00
|
|
|
MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
|
|
|
|
S1AP_Cause_PR_radioNetwork,
|
|
|
|
S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2018-02-03 02:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-07-25 00:03:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
2018-03-11 05:38:35 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(Cause);
|
|
|
|
ogs_debug(" Cause[Group:%d Cause:%d]",
|
|
|
|
Cause->present, (int)Cause->choice.radioNetwork);
|
2017-07-25 00:03:20 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (Cause->present) {
|
|
|
|
case S1AP_Cause_PR_radioNetwork:
|
|
|
|
case S1AP_Cause_PR_transport:
|
|
|
|
case S1AP_Cause_PR_protocol:
|
|
|
|
case S1AP_Cause_PR_misc:
|
|
|
|
break;
|
|
|
|
case S1AP_Cause_PR_nas:
|
|
|
|
ogs_warn("NAS-Cause[%d]", (int)Cause->choice.nas);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ogs_warn("Invalid cause group[%d]", Cause->present);
|
|
|
|
break;
|
2017-07-25 12:15:25 +00:00
|
|
|
}
|
2018-01-29 13:38:53 +00:00
|
|
|
|
2018-02-02 10:37:36 +00:00
|
|
|
mme_ue = enb_ue->mme_ue;
|
2019-06-16 02:25:41 +00:00
|
|
|
if (mme_ue) {
|
|
|
|
if (OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered)) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" EMM-Registered");
|
2018-02-03 13:55:05 +00:00
|
|
|
rv = mme_send_release_access_bearer_or_ue_context_release(
|
|
|
|
mme_ue, enb_ue);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2019-06-16 02:25:41 +00:00
|
|
|
} else {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" NOT EMM-Registered");
|
2018-02-03 13:55:05 +00:00
|
|
|
rv = mme_send_delete_session_or_ue_context_release(mme_ue, enb_ue);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2018-01-31 03:54:59 +00:00
|
|
|
}
|
2019-06-16 02:25:41 +00:00
|
|
|
} else {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" S1 Context Not Associated");
|
2019-07-20 16:03:19 +00:00
|
|
|
CLEAR_ENB_UE_TIMER(enb_ue->t_ue_context_release);
|
2018-02-02 10:37:36 +00:00
|
|
|
rv = s1ap_send_ue_context_release_command(enb_ue,
|
2018-03-10 03:21:02 +00:00
|
|
|
S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
|
2018-02-02 10:37:36 +00:00
|
|
|
S1AP_UE_CTX_REL_NO_ACTION, 0);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2018-01-29 13:38:53 +00:00
|
|
|
}
|
2017-07-25 12:15:25 +00:00
|
|
|
}
|
2017-07-25 00:03:20 +00:00
|
|
|
|
2017-04-28 04:46:16 +00:00
|
|
|
void s1ap_handle_ue_context_release_complete(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-04-28 04:46:16 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-11 05:38:35 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
|
|
|
|
S1AP_UEContextReleaseComplete_t *UEContextReleaseComplete = NULL;
|
|
|
|
|
|
|
|
S1AP_UEContextReleaseComplete_IEs_t *ie = NULL;
|
|
|
|
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
2017-04-28 04:46:16 +00:00
|
|
|
|
2017-09-18 10:30:03 +00:00
|
|
|
mme_ue_t *mme_ue = NULL;
|
2018-03-11 05:38:35 +00:00
|
|
|
enb_ue_t *enb_ue = NULL;
|
2017-04-28 04:46:16 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2017-04-28 04:46:16 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-11 05:38:35 +00:00
|
|
|
successfulOutcome = message->choice.successfulOutcome;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(successfulOutcome);
|
2018-03-11 05:38:35 +00:00
|
|
|
UEContextReleaseComplete =
|
|
|
|
&successfulOutcome->value.choice.UEContextReleaseComplete;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(UEContextReleaseComplete);
|
2017-04-28 04:46:16 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] UE Context release complete");
|
2018-03-11 05:38:35 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < UEContextReleaseComplete->protocolIEs.list.count; i++) {
|
2018-03-11 05:38:35 +00:00
|
|
|
ie = UEContextReleaseComplete->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID:
|
|
|
|
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-11 05:38:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(MME_UE_S1AP_ID);
|
2018-03-11 05:38:35 +00:00
|
|
|
enb_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID);
|
2019-06-16 02:25:41 +00:00
|
|
|
if (!enb_ue) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_warn("No ENB UE Context : MME_UE_S1AP_ID[%d]",
|
|
|
|
(int)*MME_UE_S1AP_ID);
|
2018-05-23 11:40:46 +00:00
|
|
|
rv = s1ap_send_error_indication(enb,
|
|
|
|
MME_UE_S1AP_ID, NULL,
|
|
|
|
S1AP_Cause_PR_radioNetwork,
|
|
|
|
S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2018-05-23 11:40:46 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-07-20 16:03:19 +00:00
|
|
|
|
2018-01-29 05:48:51 +00:00
|
|
|
mme_ue = enb_ue->mme_ue;
|
2017-04-28 04:46:16 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
2017-04-28 04:46:16 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (enb_ue->ue_ctx_rel_action) {
|
|
|
|
case S1AP_UE_CTX_REL_NO_ACTION:
|
|
|
|
ogs_debug(" No Action");
|
2019-06-30 11:46:15 +00:00
|
|
|
enb_ue_remove(enb_ue);
|
2019-06-16 02:25:41 +00:00
|
|
|
break;
|
|
|
|
case S1AP_UE_CTX_REL_S1_NORMAL_RELEASE:
|
|
|
|
ogs_debug(" Action: S1 normal release");
|
2019-06-30 11:46:15 +00:00
|
|
|
enb_ue_remove(enb_ue);
|
|
|
|
mme_ue_deassociate(mme_ue);
|
2019-06-16 02:25:41 +00:00
|
|
|
break;
|
|
|
|
case S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE:
|
|
|
|
ogs_debug(" Action: UE context remove()");
|
2019-06-30 11:46:15 +00:00
|
|
|
enb_ue_remove(enb_ue);
|
|
|
|
mme_ue_remove(mme_ue);
|
2019-06-16 02:25:41 +00:00
|
|
|
break;
|
|
|
|
case S1AP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL:
|
|
|
|
ogs_debug(" Action: Delete indirect tunnel");
|
2018-01-29 05:48:51 +00:00
|
|
|
|
2019-06-30 11:46:15 +00:00
|
|
|
source_ue_deassociate_target_ue(enb_ue);
|
|
|
|
enb_ue_remove(enb_ue);
|
2018-01-29 05:48:51 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
ogs_assert(mme_ue);
|
|
|
|
if (mme_ue_have_indirect_tunnel(mme_ue)) {
|
|
|
|
rv = mme_gtp_send_delete_indirect_data_forwarding_tunnel_request(
|
|
|
|
mme_ue);
|
|
|
|
ogs_assert(rv == OGS_OK);
|
|
|
|
} else {
|
|
|
|
ogs_warn("Check your eNodeB");
|
|
|
|
ogs_warn(" There is no INDIRECT TUNNEL");
|
|
|
|
ogs_warn(" Packet could be dropped during S1-Handover");
|
|
|
|
rv = mme_ue_clear_indirect_tunnel(mme_ue);
|
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-18 12:58:33 +00:00
|
|
|
}
|
2019-06-16 02:25:41 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ogs_fatal("Invalid Action[%d]", enb_ue->ue_ctx_rel_action);
|
|
|
|
ogs_assert_if_reached();
|
|
|
|
break;
|
2017-09-18 12:58:33 +00:00
|
|
|
}
|
2017-04-28 04:46:16 +00:00
|
|
|
}
|
2017-08-07 22:58:13 +00:00
|
|
|
|
2017-09-11 12:14:55 +00:00
|
|
|
void s1ap_handle_path_switch_request(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-09-11 12:14:55 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2017-09-11 12:14:55 +00:00
|
|
|
int i;
|
|
|
|
|
2018-03-12 13:47:10 +00:00
|
|
|
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
|
|
|
S1AP_PathSwitchRequest_t *PathSwitchRequest = NULL;
|
2017-09-11 12:14:55 +00:00
|
|
|
|
2018-03-12 13:47:10 +00:00
|
|
|
S1AP_PathSwitchRequestIEs_t *ie = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_E_RABToBeSwitchedDLList_t *E_RABToBeSwitchedDLList = NULL;
|
|
|
|
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_EUTRAN_CGI_t *EUTRAN_CGI = NULL;
|
|
|
|
S1AP_TAI_t *TAI = NULL;
|
|
|
|
S1AP_UESecurityCapabilities_t *UESecurityCapabilities = NULL;
|
|
|
|
|
|
|
|
S1AP_PLMNidentity_t *pLMNidentity = NULL;
|
2018-03-10 03:21:02 +00:00
|
|
|
S1AP_CellIdentity_t *cell_ID = NULL;
|
|
|
|
S1AP_TAC_t *tAC = NULL;
|
|
|
|
S1AP_EncryptionAlgorithms_t *encryptionAlgorithms = NULL;
|
|
|
|
S1AP_IntegrityProtectionAlgorithms_t *integrityProtectionAlgorithms = NULL;
|
2019-04-27 14:54:30 +00:00
|
|
|
uint16_t eea = 0, eia = 0;
|
2017-09-11 12:14:55 +00:00
|
|
|
|
2018-03-12 13:47:10 +00:00
|
|
|
enb_ue_t *enb_ue = NULL;
|
|
|
|
mme_ue_t *mme_ue = NULL;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_pkbuf_t *s1apbuf = NULL;
|
2018-03-12 13:47:10 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2017-09-11 12:14:55 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-12 13:47:10 +00:00
|
|
|
initiatingMessage = message->choice.initiatingMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(initiatingMessage);
|
2018-03-12 13:47:10 +00:00
|
|
|
PathSwitchRequest = &initiatingMessage->value.choice.PathSwitchRequest;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(PathSwitchRequest);
|
2017-09-11 12:14:55 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Path switch request");
|
2018-03-12 13:47:10 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < PathSwitchRequest->protocolIEs.list.count; i++) {
|
2018-03-12 13:47:10 +00:00
|
|
|
ie = PathSwitchRequest->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_E_RABToBeSwitchedDLList:
|
|
|
|
E_RABToBeSwitchedDLList =
|
|
|
|
&ie->value.choice.E_RABToBeSwitchedDLList;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_SourceMME_UE_S1AP_ID:
|
|
|
|
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_EUTRAN_CGI:
|
|
|
|
EUTRAN_CGI = &ie->value.choice.EUTRAN_CGI;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_TAI:
|
|
|
|
TAI = &ie->value.choice.TAI;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_UESecurityCapabilities:
|
|
|
|
UESecurityCapabilities = &ie->value.choice.UESecurityCapabilities;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-12 13:47:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(EUTRAN_CGI);
|
2018-03-12 13:47:10 +00:00
|
|
|
pLMNidentity = &EUTRAN_CGI->pLMNidentity;
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_assert(pLMNidentity && pLMNidentity->size == sizeof(ogs_plmn_id_t));
|
2018-03-12 13:47:10 +00:00
|
|
|
cell_ID = &EUTRAN_CGI->cell_ID;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(cell_ID);
|
2017-09-11 12:14:55 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(TAI);
|
2018-03-12 13:47:10 +00:00
|
|
|
pLMNidentity = &TAI->pLMNidentity;
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_assert(pLMNidentity && pLMNidentity->size == sizeof(ogs_plmn_id_t));
|
2018-03-12 13:47:10 +00:00
|
|
|
tAC = &TAI->tAC;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(tAC && tAC->size == sizeof(uint16_t));
|
2017-09-11 12:14:55 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(UESecurityCapabilities);
|
2017-09-11 12:14:55 +00:00
|
|
|
encryptionAlgorithms =
|
2018-03-12 13:47:10 +00:00
|
|
|
&UESecurityCapabilities->encryptionAlgorithms;
|
2017-09-11 12:14:55 +00:00
|
|
|
integrityProtectionAlgorithms =
|
2018-03-12 13:47:10 +00:00
|
|
|
&UESecurityCapabilities->integrityProtectionAlgorithms;
|
2017-09-11 12:14:55 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(MME_UE_S1AP_ID);
|
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
2018-03-12 13:47:10 +00:00
|
|
|
enb_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID);
|
2019-06-16 02:25:41 +00:00
|
|
|
if (!enb_ue) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_error("Cannot find UE from sourceMME-UE-S1AP-ID[%d] and eNB[%s:%d]",
|
|
|
|
(int)*MME_UE_S1AP_ID, OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2017-09-11 12:14:55 +00:00
|
|
|
|
2018-05-13 09:02:24 +00:00
|
|
|
rv = s1ap_build_path_switch_failure(&s1apbuf,
|
2018-03-12 13:47:10 +00:00
|
|
|
*ENB_UE_S1AP_ID, *MME_UE_S1AP_ID,
|
2018-03-10 03:21:02 +00:00
|
|
|
S1AP_Cause_PR_radioNetwork,
|
|
|
|
S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK && s1apbuf);
|
2018-05-13 09:02:24 +00:00
|
|
|
|
|
|
|
rv = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-11 12:14:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
|
|
|
|
2017-09-11 12:14:55 +00:00
|
|
|
mme_ue = enb_ue->mme_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(mme_ue);
|
2017-09-11 12:14:55 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (SECURITY_CONTEXT_IS_VALID(mme_ue)) {
|
2017-09-12 01:48:42 +00:00
|
|
|
mme_ue->nhcc++;
|
|
|
|
mme_kdf_nh(mme_ue->kasme, mme_ue->nh, mme_ue->nh);
|
2019-06-16 02:25:41 +00:00
|
|
|
} else {
|
2018-05-13 09:02:24 +00:00
|
|
|
rv = s1ap_build_path_switch_failure(&s1apbuf,
|
2018-03-12 13:47:10 +00:00
|
|
|
*ENB_UE_S1AP_ID, *MME_UE_S1AP_ID,
|
2018-03-10 03:21:02 +00:00
|
|
|
S1AP_Cause_PR_nas, S1AP_CauseNas_authentication_failure);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK && s1apbuf);
|
2018-05-13 09:02:24 +00:00
|
|
|
|
|
|
|
rv = s1ap_send_to_enb_ue(enb_ue, s1apbuf);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-12 01:48:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-03-12 13:47:10 +00:00
|
|
|
enb_ue->enb_ue_s1ap_id = *ENB_UE_S1AP_ID;
|
2017-09-11 12:14:55 +00:00
|
|
|
|
2019-06-02 12:55:24 +00:00
|
|
|
memcpy(&enb_ue->saved.tai.plmn_id, pLMNidentity->buf,
|
|
|
|
sizeof(enb_ue->saved.tai.plmn_id));
|
|
|
|
memcpy(&enb_ue->saved.tai.tac, tAC->buf, sizeof(enb_ue->saved.tai.tac));
|
|
|
|
enb_ue->saved.tai.tac = ntohs(enb_ue->saved.tai.tac);
|
2018-02-02 17:08:43 +00:00
|
|
|
|
2019-06-02 12:55:24 +00:00
|
|
|
memcpy(&enb_ue->saved.e_cgi.plmn_id, pLMNidentity->buf,
|
|
|
|
sizeof(enb_ue->saved.e_cgi.plmn_id));
|
|
|
|
memcpy(&enb_ue->saved.e_cgi.cell_id, cell_ID->buf,
|
|
|
|
sizeof(enb_ue->saved.e_cgi.cell_id));
|
|
|
|
enb_ue->saved.e_cgi.cell_id = (ntohl(enb_ue->saved.e_cgi.cell_id) >> 4);
|
2018-02-02 17:08:43 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" OLD TAI[PLMN_ID:%06x,TAC:%d]",
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_plmn_id_hexdump(&mme_ue->tai.plmn_id),
|
2019-04-27 14:54:30 +00:00
|
|
|
mme_ue->tai.tac);
|
|
|
|
ogs_debug(" OLD E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_plmn_id_hexdump(&mme_ue->e_cgi.plmn_id),
|
2019-04-27 14:54:30 +00:00
|
|
|
mme_ue->e_cgi.cell_id);
|
|
|
|
ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]",
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_plmn_id_hexdump(&enb_ue->saved.tai.plmn_id),
|
2019-06-02 12:55:24 +00:00
|
|
|
enb_ue->saved.tai.tac);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_plmn_id_hexdump(&enb_ue->saved.e_cgi.plmn_id),
|
2019-06-02 12:55:24 +00:00
|
|
|
enb_ue->saved.e_cgi.cell_id);
|
2018-02-02 17:08:43 +00:00
|
|
|
|
|
|
|
/* Copy TAI and ECGI from enb_ue */
|
2019-09-13 12:07:47 +00:00
|
|
|
memcpy(&mme_ue->tai, &enb_ue->saved.tai, sizeof(ogs_tai_t));
|
|
|
|
memcpy(&mme_ue->e_cgi, &enb_ue->saved.e_cgi, sizeof(ogs_e_cgi_t));
|
2017-09-11 12:14:55 +00:00
|
|
|
|
|
|
|
memcpy(&eea, encryptionAlgorithms->buf, sizeof(eea));
|
|
|
|
eea = ntohs(eea);
|
2017-09-12 14:07:55 +00:00
|
|
|
mme_ue->ue_network_capability.eea = eea >> 9;
|
|
|
|
mme_ue->ue_network_capability.eea0 = 1;
|
2017-09-11 12:14:55 +00:00
|
|
|
|
|
|
|
memcpy(&eia, integrityProtectionAlgorithms->buf, sizeof(eia));
|
|
|
|
eia = ntohs(eia);
|
2017-09-12 14:07:55 +00:00
|
|
|
mme_ue->ue_network_capability.eia = eia >> 9;
|
|
|
|
mme_ue->ue_network_capability.eia0 = 0;
|
2017-09-11 12:14:55 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(E_RABToBeSwitchedDLList);
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < E_RABToBeSwitchedDLList->list.count; i++) {
|
2018-03-21 07:10:20 +00:00
|
|
|
S1AP_E_RABToBeSwitchedDLItemIEs_t *ie2 = NULL;
|
2018-03-12 13:47:10 +00:00
|
|
|
S1AP_E_RABToBeSwitchedDLItem_t *e_rab = NULL;
|
2017-09-11 14:58:16 +00:00
|
|
|
|
2017-09-11 12:14:55 +00:00
|
|
|
mme_bearer_t *bearer = NULL;
|
|
|
|
|
2018-03-21 07:10:20 +00:00
|
|
|
ie2 = (S1AP_E_RABToBeSwitchedDLItemIEs_t *)
|
2018-03-12 13:47:10 +00:00
|
|
|
E_RABToBeSwitchedDLList->list.array[i];
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ie2);
|
2018-03-12 13:47:10 +00:00
|
|
|
|
2018-03-21 07:10:20 +00:00
|
|
|
e_rab = &ie2->value.choice.E_RABToBeSwitchedDLItem;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(e_rab);
|
2017-09-11 12:14:55 +00:00
|
|
|
|
|
|
|
bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(bearer);
|
2017-09-11 12:14:55 +00:00
|
|
|
|
|
|
|
memcpy(&bearer->enb_s1u_teid, e_rab->gTP_TEID.buf,
|
|
|
|
sizeof(bearer->enb_s1u_teid));
|
|
|
|
bearer->enb_s1u_teid = ntohl(bearer->enb_s1u_teid);
|
2019-09-13 12:07:47 +00:00
|
|
|
rv = ogs_s1ap_BIT_STRING_to_ip(
|
2017-12-07 08:23:45 +00:00
|
|
|
&e_rab->transportLayerAddress, &bearer->enb_s1u_ip);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-11 14:58:16 +00:00
|
|
|
|
2017-09-13 02:18:17 +00:00
|
|
|
GTP_COUNTER_INCREMENT(
|
|
|
|
mme_ue, GTP_COUNTER_MODIFY_BEARER_BY_PATH_SWITCH);
|
|
|
|
|
2017-09-14 08:29:34 +00:00
|
|
|
rv = mme_gtp_send_modify_bearer_request(bearer, 1);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-11 12:14:55 +00:00
|
|
|
}
|
|
|
|
|
2017-09-15 21:02:14 +00:00
|
|
|
/* Switch to enb */
|
|
|
|
enb_ue_switch_to_enb(enb_ue, enb);
|
2017-09-11 12:14:55 +00:00
|
|
|
}
|
2017-09-12 05:16:22 +00:00
|
|
|
|
2018-03-13 14:16:01 +00:00
|
|
|
void s1ap_handle_enb_configuration_transfer(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message, ogs_pkbuf_t *pkbuf)
|
2018-03-13 14:16:01 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-13 14:16:01 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
|
|
|
S1AP_ENBConfigurationTransfer_t *ENBConfigurationTransfer = NULL;
|
|
|
|
|
|
|
|
S1AP_ENBConfigurationTransferIEs_t *ie = NULL;
|
|
|
|
S1AP_SONConfigurationTransfer_t *SONConfigurationTransfer = NULL;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2018-03-13 14:16:01 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-13 14:16:01 +00:00
|
|
|
initiatingMessage = message->choice.initiatingMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(initiatingMessage);
|
2018-03-13 14:16:01 +00:00
|
|
|
ENBConfigurationTransfer =
|
|
|
|
&initiatingMessage->value.choice.ENBConfigurationTransfer;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ENBConfigurationTransfer);
|
2018-03-13 14:16:01 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] ENB configuration transfer");
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < ENBConfigurationTransfer->protocolIEs.list.count; i++) {
|
2018-03-13 14:16:01 +00:00
|
|
|
ie = ENBConfigurationTransfer->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_SONConfigurationTransferECT:
|
|
|
|
SONConfigurationTransfer =
|
|
|
|
&ie->value.choice.SONConfigurationTransfer;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-13 14:16:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-03-13 14:16:01 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (SONConfigurationTransfer) {
|
2018-03-24 01:08:55 +00:00
|
|
|
S1AP_TargeteNB_ID_t *targeteNB_ID =
|
|
|
|
&SONConfigurationTransfer->targeteNB_ID;
|
|
|
|
S1AP_SourceeNB_ID_t *sourceeNB_ID =
|
|
|
|
&SONConfigurationTransfer->sourceeNB_ID;
|
|
|
|
|
2018-03-13 14:16:01 +00:00
|
|
|
mme_enb_t *target_enb = NULL;
|
2019-04-27 14:54:30 +00:00
|
|
|
uint32_t source_enb_id, target_enb_id;
|
|
|
|
uint16_t source_tac, target_tac;
|
2018-03-13 14:16:01 +00:00
|
|
|
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_s1ap_ENB_ID_to_uint32(
|
2018-03-24 01:08:55 +00:00
|
|
|
&sourceeNB_ID->global_ENB_ID.eNB_ID, &source_enb_id);
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_s1ap_ENB_ID_to_uint32(
|
2018-03-24 01:08:55 +00:00
|
|
|
&targeteNB_ID->global_ENB_ID.eNB_ID, &target_enb_id);
|
2018-03-13 14:16:01 +00:00
|
|
|
|
2018-03-24 01:08:55 +00:00
|
|
|
memcpy(&source_tac, sourceeNB_ID->selected_TAI.tAC.buf,
|
2018-03-13 14:16:01 +00:00
|
|
|
sizeof(source_tac));
|
|
|
|
source_tac = ntohs(source_tac);
|
2018-03-24 01:08:55 +00:00
|
|
|
memcpy(&target_tac, targeteNB_ID->selected_TAI.tAC.buf,
|
2018-03-13 14:16:01 +00:00
|
|
|
sizeof(target_tac));
|
|
|
|
target_tac = ntohs(target_tac);
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Source : ENB_ID[%s:%d], TAC[%d]",
|
2018-03-24 01:08:55 +00:00
|
|
|
sourceeNB_ID->global_ENB_ID.eNB_ID.present ==
|
2018-03-13 14:16:01 +00:00
|
|
|
S1AP_ENB_ID_PR_homeENB_ID ? "Home" :
|
2018-03-24 01:08:55 +00:00
|
|
|
sourceeNB_ID->global_ENB_ID.eNB_ID.present ==
|
2018-03-13 14:16:01 +00:00
|
|
|
S1AP_ENB_ID_PR_macroENB_ID ? "Macro" : "Others",
|
|
|
|
source_enb_id, source_tac);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Target : ENB_ID[%s:%d], TAC[%d]",
|
2018-03-24 01:08:55 +00:00
|
|
|
targeteNB_ID->global_ENB_ID.eNB_ID.present ==
|
2018-03-13 14:16:01 +00:00
|
|
|
S1AP_ENB_ID_PR_homeENB_ID ? "Home" :
|
2018-03-24 01:08:55 +00:00
|
|
|
targeteNB_ID->global_ENB_ID.eNB_ID.present ==
|
2018-03-13 14:16:01 +00:00
|
|
|
S1AP_ENB_ID_PR_macroENB_ID ? "Macro" : "Others",
|
|
|
|
target_enb_id, target_tac);
|
|
|
|
|
|
|
|
target_enb = mme_enb_find_by_enb_id(target_enb_id);
|
2019-06-16 02:25:41 +00:00
|
|
|
if (target_enb == NULL) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_warn("eNB configuration transfer : cannot find target eNB-id[%d]",
|
2018-03-27 00:42:23 +00:00
|
|
|
target_enb_id);
|
2018-03-23 04:14:56 +00:00
|
|
|
return;
|
|
|
|
}
|
2018-03-13 14:16:01 +00:00
|
|
|
|
2018-03-24 01:08:55 +00:00
|
|
|
rv = s1ap_send_mme_configuration_transfer(
|
|
|
|
target_enb, SONConfigurationTransfer);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2018-03-13 14:16:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-13 12:07:47 +00:00
|
|
|
void s1ap_handle_handover_required(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-09-12 05:16:22 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-13 14:16:01 +00:00
|
|
|
int i;
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2018-03-13 14:16:01 +00:00
|
|
|
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
|
|
|
S1AP_HandoverRequired_t *HandoverRequired = NULL;
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2018-03-13 14:16:01 +00:00
|
|
|
S1AP_HandoverRequiredIEs_t *ie = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_HandoverType_t *HandoverType = NULL;
|
|
|
|
S1AP_Cause_t *Cause = NULL;
|
|
|
|
S1AP_TargetID_t *TargetID = NULL;
|
|
|
|
S1AP_Source_ToTarget_TransparentContainer_t
|
|
|
|
*Source_ToTarget_TransparentContainer = NULL;
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-13 14:16:01 +00:00
|
|
|
initiatingMessage = message->choice.initiatingMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(initiatingMessage);
|
2018-03-13 14:16:01 +00:00
|
|
|
HandoverRequired = &initiatingMessage->value.choice.HandoverRequired;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(HandoverRequired);
|
2018-03-13 14:16:01 +00:00
|
|
|
|
|
|
|
enb_ue_t *source_ue = NULL;
|
|
|
|
mme_ue_t *mme_ue = NULL;
|
2018-03-23 04:14:56 +00:00
|
|
|
mme_enb_t *target_enb = NULL;
|
2019-04-27 14:54:30 +00:00
|
|
|
uint32_t target_enb_id = 0;
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Handover required");
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < HandoverRequired->protocolIEs.list.count; i++) {
|
2018-03-13 14:16:01 +00:00
|
|
|
ie = HandoverRequired->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID:
|
|
|
|
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_HandoverType:
|
|
|
|
HandoverType = &ie->value.choice.HandoverType;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_Cause:
|
|
|
|
Cause = &ie->value.choice.Cause;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_TargetID:
|
|
|
|
TargetID = &ie->value.choice.TargetID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_Source_ToTarget_TransparentContainer:
|
|
|
|
Source_ToTarget_TransparentContainer =
|
|
|
|
&ie->value.choice.Source_ToTarget_TransparentContainer;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-13 14:16:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(TargetID);
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (TargetID->present) {
|
|
|
|
case S1AP_TargetID_PR_targeteNB_ID:
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_s1ap_ENB_ID_to_uint32(
|
2019-06-16 02:25:41 +00:00
|
|
|
&TargetID->choice.targeteNB_ID->global_ENB_ID.eNB_ID,
|
|
|
|
&target_enb_id);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ogs_error("Not implemented(%d)", TargetID->present);
|
|
|
|
return;
|
2018-03-23 04:14:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
target_enb = mme_enb_find_by_enb_id(target_enb_id);
|
2019-06-16 02:25:41 +00:00
|
|
|
if (target_enb == NULL) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_warn("Handover required : cannot find target eNB-id[%d]",
|
2018-03-23 04:14:56 +00:00
|
|
|
target_enb_id);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
|
|
|
ogs_assert(MME_UE_S1AP_ID);
|
2018-03-13 14:16:01 +00:00
|
|
|
source_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(source_ue);
|
|
|
|
ogs_assert(source_ue->mme_ue_s1ap_id == *MME_UE_S1AP_ID);
|
|
|
|
|
|
|
|
ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id);
|
|
|
|
|
2017-09-14 09:01:26 +00:00
|
|
|
mme_ue = source_ue->mme_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(mme_ue);
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (SECURITY_CONTEXT_IS_VALID(mme_ue)) {
|
2017-09-12 14:07:55 +00:00
|
|
|
mme_ue->nhcc++;
|
|
|
|
mme_kdf_nh(mme_ue->kasme, mme_ue->nh, mme_ue->nh);
|
2019-06-16 02:25:41 +00:00
|
|
|
} else {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(Cause);
|
2018-03-13 14:16:01 +00:00
|
|
|
|
|
|
|
rv = s1ap_send_handover_preparation_failure(source_ue, Cause);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-15 04:28:07 +00:00
|
|
|
|
|
|
|
return;
|
2017-09-12 14:07:55 +00:00
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(HandoverType);
|
2018-03-13 14:16:01 +00:00
|
|
|
source_ue->handover_type = *HandoverType;
|
2017-09-13 12:51:02 +00:00
|
|
|
|
2018-03-23 04:14:56 +00:00
|
|
|
rv = s1ap_send_handover_request(mme_ue, target_enb,
|
2018-03-13 14:16:01 +00:00
|
|
|
ENB_UE_S1AP_ID, MME_UE_S1AP_ID,
|
2018-03-23 04:14:56 +00:00
|
|
|
HandoverType, Cause,
|
2018-03-13 14:16:01 +00:00
|
|
|
Source_ToTarget_TransparentContainer);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-12 05:16:22 +00:00
|
|
|
}
|
|
|
|
|
2019-09-13 12:07:47 +00:00
|
|
|
void s1ap_handle_handover_request_ack(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-09-12 05:16:22 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2017-09-12 14:07:55 +00:00
|
|
|
int i;
|
|
|
|
|
2018-03-13 14:16:01 +00:00
|
|
|
S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
|
|
|
|
S1AP_HandoverRequestAcknowledge_t *HandoverRequestAcknowledge = NULL;
|
|
|
|
|
|
|
|
S1AP_HandoverRequestAcknowledgeIEs_t *ie = NULL;
|
|
|
|
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_E_RABAdmittedList_t *E_RABAdmittedList = NULL;
|
|
|
|
S1AP_Target_ToSource_TransparentContainer_t
|
|
|
|
*Target_ToSource_TransparentContainer = NULL;
|
|
|
|
|
2017-09-15 03:06:26 +00:00
|
|
|
enb_ue_t *source_ue = NULL;
|
2017-09-14 09:01:26 +00:00
|
|
|
enb_ue_t *target_ue = NULL;
|
2017-09-12 14:07:55 +00:00
|
|
|
mme_ue_t *mme_ue = NULL;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-13 14:16:01 +00:00
|
|
|
successfulOutcome = message->choice.successfulOutcome;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(successfulOutcome);
|
2018-03-13 14:16:01 +00:00
|
|
|
HandoverRequestAcknowledge =
|
|
|
|
&successfulOutcome->value.choice.HandoverRequestAcknowledge;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(HandoverRequestAcknowledge);
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Handover request acknowledge");
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < HandoverRequestAcknowledge->protocolIEs.list.count; i++) {
|
2018-03-13 14:16:01 +00:00
|
|
|
ie = HandoverRequestAcknowledge->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID:
|
|
|
|
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_E_RABAdmittedList:
|
|
|
|
E_RABAdmittedList = &ie->value.choice.E_RABAdmittedList;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_Target_ToSource_TransparentContainer:
|
|
|
|
Target_ToSource_TransparentContainer =
|
|
|
|
&ie->value.choice.Target_ToSource_TransparentContainer;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-13 14:16:01 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(MME_UE_S1AP_ID);
|
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
|
|
|
ogs_assert(E_RABAdmittedList);
|
|
|
|
ogs_assert(Target_ToSource_TransparentContainer);
|
2018-03-13 14:16:01 +00:00
|
|
|
|
|
|
|
target_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(target_ue);
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2018-03-13 14:16:01 +00:00
|
|
|
target_ue->enb_ue_s1ap_id = *ENB_UE_S1AP_ID;
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2017-09-15 03:06:26 +00:00
|
|
|
source_ue = target_ue->source_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(source_ue);
|
2017-09-18 12:30:04 +00:00
|
|
|
mme_ue = source_ue->mme_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(mme_ue);
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id);
|
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < E_RABAdmittedList->list.count; i++) {
|
2018-03-21 07:10:20 +00:00
|
|
|
S1AP_E_RABAdmittedItemIEs_t *ie2 = NULL;
|
2018-03-10 03:21:02 +00:00
|
|
|
S1AP_E_RABAdmittedItem_t *e_rab = NULL;
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2018-03-13 14:16:01 +00:00
|
|
|
mme_bearer_t *bearer = NULL;
|
|
|
|
|
2018-03-21 07:10:20 +00:00
|
|
|
ie2 = (S1AP_E_RABAdmittedItemIEs_t *)E_RABAdmittedList->list.array[i];
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ie2);
|
2018-03-13 14:16:01 +00:00
|
|
|
|
2018-03-21 07:10:20 +00:00
|
|
|
e_rab = &ie2->value.choice.E_RABAdmittedItem;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(e_rab);
|
2017-09-12 14:07:55 +00:00
|
|
|
|
|
|
|
bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(bearer);
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2017-09-14 02:12:02 +00:00
|
|
|
memcpy(&bearer->target_s1u_teid, e_rab->gTP_TEID.buf,
|
|
|
|
sizeof(bearer->target_s1u_teid));
|
|
|
|
bearer->target_s1u_teid = ntohl(bearer->target_s1u_teid);
|
2019-09-13 12:07:47 +00:00
|
|
|
rv = ogs_s1ap_BIT_STRING_to_ip(
|
2017-12-07 08:23:45 +00:00
|
|
|
&e_rab->transportLayerAddress, &bearer->target_s1u_ip);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-12 14:07:55 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (e_rab->dL_transportLayerAddress && e_rab->dL_gTP_TEID) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(e_rab->dL_gTP_TEID->buf);
|
|
|
|
ogs_assert(e_rab->dL_transportLayerAddress->buf);
|
2017-09-12 14:07:55 +00:00
|
|
|
memcpy(&bearer->enb_dl_teid, e_rab->dL_gTP_TEID->buf,
|
|
|
|
sizeof(bearer->enb_dl_teid));
|
|
|
|
bearer->enb_dl_teid = ntohl(bearer->enb_dl_teid);
|
2019-09-13 12:07:47 +00:00
|
|
|
rv = ogs_s1ap_BIT_STRING_to_ip(
|
2017-12-07 08:23:45 +00:00
|
|
|
e_rab->dL_transportLayerAddress, &bearer->enb_dl_ip);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-12 14:07:55 +00:00
|
|
|
}
|
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (e_rab->uL_TransportLayerAddress && e_rab->uL_GTP_TEID) {
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(e_rab->uL_GTP_TEID->buf);
|
|
|
|
ogs_assert(e_rab->uL_TransportLayerAddress->buf);
|
2018-03-13 14:16:01 +00:00
|
|
|
memcpy(&bearer->enb_ul_teid, e_rab->uL_GTP_TEID->buf,
|
2017-09-12 14:07:55 +00:00
|
|
|
sizeof(bearer->enb_ul_teid));
|
|
|
|
bearer->enb_ul_teid = ntohl(bearer->enb_ul_teid);
|
2019-09-13 12:07:47 +00:00
|
|
|
rv = ogs_s1ap_BIT_STRING_to_ip(
|
2018-03-13 14:16:01 +00:00
|
|
|
e_rab->uL_TransportLayerAddress, &bearer->enb_ul_ip);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-12 14:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-13 12:07:47 +00:00
|
|
|
OGS_S1AP_STORE_DATA(&mme_ue->container,
|
|
|
|
Target_ToSource_TransparentContainer);
|
2017-09-13 02:57:17 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
if (mme_ue_have_indirect_tunnel(mme_ue) == 1) {
|
2017-09-13 14:49:31 +00:00
|
|
|
rv = mme_gtp_send_create_indirect_data_forwarding_tunnel_request(
|
|
|
|
mme_ue);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2019-06-16 02:25:41 +00:00
|
|
|
} else {
|
2017-09-15 03:06:26 +00:00
|
|
|
rv = s1ap_send_handover_command(source_ue);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-13 14:49:31 +00:00
|
|
|
}
|
2017-09-12 05:16:22 +00:00
|
|
|
}
|
|
|
|
|
2019-09-13 12:07:47 +00:00
|
|
|
void s1ap_handle_handover_failure(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-09-12 05:16:22 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-14 07:36:56 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL;
|
|
|
|
S1AP_HandoverFailure_t *HandoverFailure = NULL;
|
|
|
|
|
|
|
|
S1AP_HandoverFailureIEs_t *ie = NULL;
|
|
|
|
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_Cause_t *Cause = NULL;
|
2017-09-15 04:28:07 +00:00
|
|
|
|
|
|
|
enb_ue_t *target_ue = NULL;
|
|
|
|
enb_ue_t *source_ue = NULL;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2017-09-15 04:28:07 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-14 07:36:56 +00:00
|
|
|
unsuccessfulOutcome = message->choice.unsuccessfulOutcome;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(unsuccessfulOutcome);
|
2018-03-14 07:36:56 +00:00
|
|
|
HandoverFailure = &unsuccessfulOutcome->value.choice.HandoverFailure;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(HandoverFailure);
|
2017-09-15 04:28:07 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Handover failure");
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < HandoverFailure->protocolIEs.list.count; i++) {
|
2018-03-14 07:36:56 +00:00
|
|
|
ie = HandoverFailure->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID:
|
|
|
|
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_Cause:
|
|
|
|
Cause = &ie->value.choice.Cause;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-14 07:36:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(MME_UE_S1AP_ID);
|
|
|
|
ogs_assert(Cause);
|
2018-03-14 07:36:56 +00:00
|
|
|
|
|
|
|
target_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(target_ue);
|
2017-09-15 04:28:07 +00:00
|
|
|
|
|
|
|
source_ue = target_ue->source_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(source_ue);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id);
|
|
|
|
|
2018-03-14 07:36:56 +00:00
|
|
|
rv = s1ap_send_handover_preparation_failure(source_ue, Cause);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-15 04:28:07 +00:00
|
|
|
|
2019-07-20 16:03:19 +00:00
|
|
|
CLEAR_ENB_UE_TIMER(target_ue->t_ue_context_release);
|
2018-01-21 11:31:28 +00:00
|
|
|
rv = s1ap_send_ue_context_release_command(
|
2018-03-10 03:21:02 +00:00
|
|
|
target_ue, S1AP_Cause_PR_radioNetwork,
|
|
|
|
S1AP_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system,
|
2018-01-21 11:31:28 +00:00
|
|
|
S1AP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL, 0);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-12 05:16:22 +00:00
|
|
|
}
|
|
|
|
|
2019-09-13 12:07:47 +00:00
|
|
|
void s1ap_handle_handover_cancel(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-09-15 03:06:26 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-13 14:42:55 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
|
|
|
S1AP_HandoverCancel_t *HandoverCancel = NULL;
|
|
|
|
|
|
|
|
S1AP_HandoverCancelIEs_t *ie = NULL;
|
|
|
|
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_Cause_t *Cause = NULL;
|
2017-09-15 03:06:26 +00:00
|
|
|
|
|
|
|
enb_ue_t *source_ue = NULL;
|
2017-09-18 10:30:03 +00:00
|
|
|
enb_ue_t *target_ue = NULL;
|
2017-09-15 03:06:26 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2017-09-15 03:06:26 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-13 14:42:55 +00:00
|
|
|
initiatingMessage = message->choice.initiatingMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(initiatingMessage);
|
2018-03-13 14:42:55 +00:00
|
|
|
HandoverCancel = &initiatingMessage->value.choice.HandoverCancel;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(HandoverCancel);
|
2017-09-15 03:06:26 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Handover cancel");
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < HandoverCancel->protocolIEs.list.count; i++) {
|
2018-03-13 14:42:55 +00:00
|
|
|
ie = HandoverCancel->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID:
|
|
|
|
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_Cause:
|
|
|
|
Cause = &ie->value.choice.Cause;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-13 14:42:55 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(MME_UE_S1AP_ID);
|
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
|
|
|
ogs_assert(Cause);
|
2018-03-13 14:42:55 +00:00
|
|
|
|
|
|
|
source_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(source_ue);
|
|
|
|
ogs_assert(source_ue->mme_ue_s1ap_id == *MME_UE_S1AP_ID);
|
2017-09-15 03:06:26 +00:00
|
|
|
|
2017-09-18 10:30:03 +00:00
|
|
|
target_ue = source_ue->target_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(target_ue);
|
2017-09-15 03:06:26 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id);
|
|
|
|
|
2017-09-18 10:30:03 +00:00
|
|
|
rv = s1ap_send_handover_cancel_ack(source_ue);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-15 04:28:07 +00:00
|
|
|
|
2019-07-20 16:03:19 +00:00
|
|
|
CLEAR_ENB_UE_TIMER(target_ue->t_ue_context_release);
|
2018-01-21 11:31:28 +00:00
|
|
|
rv = s1ap_send_ue_context_release_command(
|
2018-03-10 03:21:02 +00:00
|
|
|
target_ue, S1AP_Cause_PR_radioNetwork,
|
|
|
|
S1AP_CauseRadioNetwork_handover_cancelled,
|
2019-04-27 14:54:30 +00:00
|
|
|
S1AP_UE_CTX_REL_DELETE_INDIRECT_TUNNEL,
|
|
|
|
ogs_time_from_msec(300));
|
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-15 03:06:26 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Handover Cancel : "
|
|
|
|
"UE[eNB-UE-S1AP-ID(%d)] --> eNB[%s:%d]",
|
2017-09-15 03:06:26 +00:00
|
|
|
source_ue->enb_ue_s1ap_id,
|
2019-04-27 14:54:30 +00:00
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2017-09-15 03:06:26 +00:00
|
|
|
}
|
|
|
|
|
2019-09-13 12:07:47 +00:00
|
|
|
void s1ap_handle_enb_status_transfer(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-09-12 05:16:22 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-13 14:16:01 +00:00
|
|
|
int i;
|
2017-09-13 14:49:31 +00:00
|
|
|
|
2018-03-13 14:16:01 +00:00
|
|
|
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
|
|
|
S1AP_ENBStatusTransfer_t *ENBStatusTransfer = NULL;
|
|
|
|
|
|
|
|
S1AP_ENBStatusTransferIEs_t *ie = NULL;
|
|
|
|
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_ENB_StatusTransfer_TransparentContainer_t
|
|
|
|
*ENB_StatusTransfer_TransparentContainer = NULL;
|
2017-09-13 14:49:31 +00:00
|
|
|
|
2018-03-13 14:16:01 +00:00
|
|
|
enb_ue_t *source_ue = NULL, *target_ue = NULL;
|
2017-09-13 14:49:31 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2017-09-13 14:49:31 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-13 14:16:01 +00:00
|
|
|
initiatingMessage = message->choice.initiatingMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(initiatingMessage);
|
2018-03-13 14:16:01 +00:00
|
|
|
ENBStatusTransfer = &initiatingMessage->value.choice.ENBStatusTransfer;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ENBStatusTransfer);
|
2017-09-13 14:49:31 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] ENB status transfer");
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < ENBStatusTransfer->protocolIEs.list.count; i++) {
|
2018-03-13 14:16:01 +00:00
|
|
|
ie = ENBStatusTransfer->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID:
|
|
|
|
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_StatusTransfer_TransparentContainer:
|
|
|
|
ENB_StatusTransfer_TransparentContainer =
|
|
|
|
&ie->value.choice.ENB_StatusTransfer_TransparentContainer;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-13 14:16:01 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(MME_UE_S1AP_ID);
|
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
|
|
|
ogs_assert(ENB_StatusTransfer_TransparentContainer);
|
2018-03-13 14:16:01 +00:00
|
|
|
|
|
|
|
source_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(source_ue);
|
|
|
|
ogs_assert(source_ue->mme_ue_s1ap_id == *MME_UE_S1AP_ID);
|
2017-09-13 14:49:31 +00:00
|
|
|
|
2017-09-14 09:01:26 +00:00
|
|
|
target_ue = source_ue->target_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(target_ue);
|
2017-09-13 14:49:31 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id);
|
|
|
|
|
2018-03-13 14:16:01 +00:00
|
|
|
rv = s1ap_send_mme_status_transfer(target_ue,
|
|
|
|
ENB_StatusTransfer_TransparentContainer);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-12 05:16:22 +00:00
|
|
|
}
|
|
|
|
|
2019-09-13 12:07:47 +00:00
|
|
|
void s1ap_handle_handover_notification(mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2017-09-12 05:16:22 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-13 14:42:55 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
|
|
|
S1AP_HandoverNotify_t *HandoverNotify = NULL;
|
|
|
|
|
|
|
|
S1AP_HandoverNotifyIEs_t *ie = NULL;
|
|
|
|
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
|
|
|
S1AP_EUTRAN_CGI_t *EUTRAN_CGI = NULL;
|
|
|
|
S1AP_TAI_t *TAI = NULL;
|
|
|
|
|
|
|
|
S1AP_PLMNidentity_t *pLMNidentity = NULL;
|
|
|
|
S1AP_CellIdentity_t *cell_ID = NULL;
|
|
|
|
S1AP_TAC_t *tAC = NULL;
|
2017-09-14 02:12:02 +00:00
|
|
|
|
2017-09-18 12:30:04 +00:00
|
|
|
enb_ue_t *source_ue = NULL;
|
2017-09-14 09:01:26 +00:00
|
|
|
enb_ue_t *target_ue = NULL;
|
2017-09-14 02:12:02 +00:00
|
|
|
mme_ue_t *mme_ue = NULL;
|
|
|
|
mme_sess_t *sess = NULL;
|
|
|
|
mme_bearer_t *bearer = NULL;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2017-09-14 02:12:02 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-13 14:42:55 +00:00
|
|
|
initiatingMessage = message->choice.initiatingMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(initiatingMessage);
|
2018-03-13 14:42:55 +00:00
|
|
|
HandoverNotify = &initiatingMessage->value.choice.HandoverNotify;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(HandoverNotify);
|
2017-09-14 02:12:02 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Handover notification");
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < HandoverNotify->protocolIEs.list.count; i++) {
|
2018-03-13 14:42:55 +00:00
|
|
|
ie = HandoverNotify->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID:
|
|
|
|
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
|
|
|
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_EUTRAN_CGI:
|
|
|
|
EUTRAN_CGI = &ie->value.choice.EUTRAN_CGI;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_TAI:
|
|
|
|
TAI = &ie->value.choice.TAI;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-13 14:42:55 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-01-22 14:14:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(EUTRAN_CGI);
|
2018-03-13 14:42:55 +00:00
|
|
|
pLMNidentity = &EUTRAN_CGI->pLMNidentity;
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_assert(pLMNidentity && pLMNidentity->size == sizeof(ogs_plmn_id_t));
|
2018-03-13 14:42:55 +00:00
|
|
|
cell_ID = &EUTRAN_CGI->cell_ID;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(cell_ID);
|
2017-09-14 02:12:02 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(TAI);
|
2018-03-13 14:42:55 +00:00
|
|
|
pLMNidentity = &TAI->pLMNidentity;
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_assert(pLMNidentity && pLMNidentity->size == sizeof(ogs_plmn_id_t));
|
2018-03-13 14:42:55 +00:00
|
|
|
tAC = &TAI->tAC;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(tAC && tAC->size == sizeof(uint16_t));
|
2017-09-14 02:12:02 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ENB_UE_S1AP_ID);
|
|
|
|
ogs_assert(MME_UE_S1AP_ID);
|
2018-03-13 14:42:55 +00:00
|
|
|
target_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(target_ue);
|
|
|
|
ogs_assert(target_ue->mme_ue_s1ap_id == *MME_UE_S1AP_ID);
|
2017-09-14 02:12:02 +00:00
|
|
|
|
2017-09-18 12:30:04 +00:00
|
|
|
source_ue = target_ue->source_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(source_ue);
|
2017-09-18 12:30:04 +00:00
|
|
|
mme_ue = source_ue->mme_ue;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(mme_ue);
|
2017-09-14 09:01:26 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Source : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" Target : ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
|
2018-01-22 14:14:20 +00:00
|
|
|
target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id);
|
|
|
|
|
2017-09-14 09:01:26 +00:00
|
|
|
mme_ue_associate_enb_ue(mme_ue, target_ue);
|
2017-09-14 02:12:02 +00:00
|
|
|
|
2019-06-02 12:55:24 +00:00
|
|
|
memcpy(&target_ue->saved.tai.plmn_id, pLMNidentity->buf,
|
|
|
|
sizeof(target_ue->saved.tai.plmn_id));
|
|
|
|
memcpy(&target_ue->saved.tai.tac,
|
|
|
|
tAC->buf, sizeof(target_ue->saved.tai.tac));
|
|
|
|
target_ue->saved.tai.tac = ntohs(target_ue->saved.tai.tac);
|
2018-02-02 17:00:38 +00:00
|
|
|
|
2019-06-02 12:55:24 +00:00
|
|
|
memcpy(&target_ue->saved.e_cgi.plmn_id, pLMNidentity->buf,
|
|
|
|
sizeof(target_ue->saved.e_cgi.plmn_id));
|
|
|
|
memcpy(&target_ue->saved.e_cgi.cell_id, cell_ID->buf,
|
|
|
|
sizeof(target_ue->saved.e_cgi.cell_id));
|
|
|
|
target_ue->saved.e_cgi.cell_id =
|
|
|
|
(ntohl(target_ue->saved.e_cgi.cell_id) >> 4);
|
2018-02-02 17:00:38 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" OLD TAI[PLMN_ID:%06x,TAC:%d]",
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_plmn_id_hexdump(&mme_ue->tai.plmn_id),
|
2019-04-27 14:54:30 +00:00
|
|
|
mme_ue->tai.tac);
|
|
|
|
ogs_debug(" OLD E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_plmn_id_hexdump(&mme_ue->e_cgi.plmn_id),
|
2019-04-27 14:54:30 +00:00
|
|
|
mme_ue->e_cgi.cell_id);
|
|
|
|
ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]",
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_plmn_id_hexdump(&target_ue->saved.tai.plmn_id),
|
2019-06-02 12:55:24 +00:00
|
|
|
target_ue->saved.tai.tac);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
2019-09-13 12:07:47 +00:00
|
|
|
ogs_plmn_id_hexdump(&target_ue->saved.e_cgi.plmn_id),
|
2019-06-02 12:55:24 +00:00
|
|
|
target_ue->saved.e_cgi.cell_id);
|
2018-02-02 17:00:38 +00:00
|
|
|
|
|
|
|
/* Copy TAI and ECGI from enb_ue */
|
2019-09-13 12:07:47 +00:00
|
|
|
memcpy(&mme_ue->tai, &target_ue->saved.tai, sizeof(ogs_tai_t));
|
|
|
|
memcpy(&mme_ue->e_cgi, &target_ue->saved.e_cgi, sizeof(ogs_e_cgi_t));
|
2017-09-14 02:12:02 +00:00
|
|
|
|
|
|
|
sess = mme_sess_first(mme_ue);
|
2019-06-16 02:25:41 +00:00
|
|
|
while (sess) {
|
2017-09-14 02:12:02 +00:00
|
|
|
bearer = mme_bearer_first(sess);
|
2019-06-16 02:25:41 +00:00
|
|
|
while (bearer) {
|
2017-09-14 02:12:02 +00:00
|
|
|
bearer->enb_s1u_teid = bearer->target_s1u_teid;
|
2019-09-13 12:07:47 +00:00
|
|
|
memcpy(&bearer->enb_s1u_ip, &bearer->target_s1u_ip,
|
|
|
|
sizeof(ogs_ip_t));
|
2017-09-14 02:12:02 +00:00
|
|
|
|
|
|
|
GTP_COUNTER_INCREMENT(
|
|
|
|
mme_ue, GTP_COUNTER_MODIFY_BEARER_BY_HANDOVER_NOTIFY);
|
|
|
|
|
2017-09-14 08:29:34 +00:00
|
|
|
rv = mme_gtp_send_modify_bearer_request(bearer, 1);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2017-09-14 02:12:02 +00:00
|
|
|
|
|
|
|
bearer = mme_bearer_next(bearer);
|
|
|
|
}
|
|
|
|
sess = mme_sess_next(sess);
|
|
|
|
}
|
2017-09-12 05:16:22 +00:00
|
|
|
}
|
2018-03-21 07:10:20 +00:00
|
|
|
|
|
|
|
void s1ap_handle_s1_reset(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2018-03-21 07:10:20 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
int rv;
|
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-03-21 07:10:20 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
|
|
|
S1AP_Reset_t *Reset = NULL;
|
|
|
|
|
|
|
|
S1AP_ResetIEs_t *ie = NULL;
|
|
|
|
S1AP_Cause_t *Cause = NULL;
|
|
|
|
S1AP_ResetType_t *ResetType = NULL;
|
|
|
|
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface = NULL;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2018-03-21 07:10:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-03-21 07:10:20 +00:00
|
|
|
initiatingMessage = message->choice.initiatingMessage;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(initiatingMessage);
|
2018-03-21 07:10:20 +00:00
|
|
|
Reset = &initiatingMessage->value.choice.Reset;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(Reset);
|
2018-03-21 07:10:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Reset");
|
2018-03-21 07:10:20 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
for (i = 0; i < Reset->protocolIEs.list.count; i++) {
|
2018-03-21 07:10:20 +00:00
|
|
|
ie = Reset->protocolIEs.list.array[i];
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ie->id) {
|
|
|
|
case S1AP_ProtocolIE_ID_id_Cause:
|
|
|
|
Cause = &ie->value.choice.Cause;
|
|
|
|
break;
|
|
|
|
case S1AP_ProtocolIE_ID_id_ResetType:
|
|
|
|
ResetType = &ie->value.choice.ResetType;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2018-03-21 07:10:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-03-21 07:10:20 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(Cause);
|
|
|
|
ogs_debug(" Cause[Group:%d Cause:%d]",
|
|
|
|
Cause->present, (int)Cause->choice.radioNetwork);
|
2018-03-21 07:10:20 +00:00
|
|
|
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (Cause->present) {
|
|
|
|
case S1AP_Cause_PR_radioNetwork:
|
|
|
|
case S1AP_Cause_PR_transport:
|
|
|
|
case S1AP_Cause_PR_protocol:
|
|
|
|
case S1AP_Cause_PR_misc:
|
|
|
|
break;
|
|
|
|
case S1AP_Cause_PR_nas:
|
|
|
|
ogs_warn("NAS-Cause[%d]", (int)Cause->choice.nas);
|
2019-10-27 08:41:14 +00:00
|
|
|
break;
|
2019-06-16 02:25:41 +00:00
|
|
|
default:
|
|
|
|
ogs_warn("Invalid cause group[%d]", Cause->present);
|
|
|
|
break;
|
2018-03-21 07:10:20 +00:00
|
|
|
}
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(ResetType);
|
2019-06-16 02:25:41 +00:00
|
|
|
switch (ResetType->present) {
|
|
|
|
case S1AP_ResetType_PR_s1_Interface:
|
|
|
|
ogs_debug(" S1AP_ResetType_PR_s1_Interface");
|
2018-03-21 07:37:15 +00:00
|
|
|
|
2019-06-30 11:46:15 +00:00
|
|
|
enb_ue_remove_in_enb(enb);
|
2019-06-16 02:25:41 +00:00
|
|
|
break;
|
|
|
|
case S1AP_ResetType_PR_partOfS1_Interface:
|
|
|
|
ogs_debug(" S1AP_ResetType_PR_partOfS1_Interface");
|
|
|
|
|
|
|
|
partOfS1_Interface = ResetType->choice.partOfS1_Interface;
|
|
|
|
ogs_assert(partOfS1_Interface);
|
|
|
|
for (i = 0; i < partOfS1_Interface->list.count; i++) {
|
|
|
|
S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *ie2 = NULL;
|
|
|
|
S1AP_UE_associatedLogicalS1_ConnectionItem_t *item = NULL;
|
|
|
|
|
|
|
|
enb_ue_t *enb_ue = NULL;
|
|
|
|
|
|
|
|
ie2 = (S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *)
|
|
|
|
partOfS1_Interface->list.array[i];
|
|
|
|
ogs_assert(ie2);
|
|
|
|
|
|
|
|
item = &ie2->value.choice.UE_associatedLogicalS1_ConnectionItem;
|
|
|
|
ogs_assert(item);
|
|
|
|
|
|
|
|
ogs_debug(" MME_UE_S1AP_ID[%d] ENB_UE_S1AP_ID[%d]",
|
|
|
|
item->mME_UE_S1AP_ID ? (int)*item->mME_UE_S1AP_ID : -1,
|
|
|
|
item->eNB_UE_S1AP_ID ? (int)*item->eNB_UE_S1AP_ID : -1);
|
|
|
|
|
|
|
|
if (item->mME_UE_S1AP_ID)
|
|
|
|
enb_ue = enb_ue_find_by_mme_ue_s1ap_id(
|
|
|
|
*item->mME_UE_S1AP_ID);
|
|
|
|
else if (item->eNB_UE_S1AP_ID)
|
|
|
|
enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb,
|
|
|
|
*item->eNB_UE_S1AP_ID);
|
|
|
|
|
|
|
|
if (enb_ue == NULL) {
|
|
|
|
ogs_warn("Cannot find S1 Context "
|
|
|
|
"(MME_UE_S1AP_ID[%d] ENB_UE_S1AP_ID[%d])",
|
|
|
|
item->mME_UE_S1AP_ID ? (int)*item->mME_UE_S1AP_ID : -1,
|
|
|
|
item->eNB_UE_S1AP_ID ? (int)*item->eNB_UE_S1AP_ID : -1);
|
|
|
|
continue;
|
2018-03-21 07:10:20 +00:00
|
|
|
}
|
2019-06-16 02:25:41 +00:00
|
|
|
|
2019-06-30 11:46:15 +00:00
|
|
|
enb_ue_remove(enb_ue);
|
|
|
|
}
|
2019-06-16 02:25:41 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ogs_warn("Invalid ResetType[%d]", ResetType->present);
|
|
|
|
break;
|
2018-03-21 07:10:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rv = s1ap_send_s1_reset_ack(enb, partOfS1_Interface);
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(rv == OGS_OK);
|
2018-03-21 07:10:20 +00:00
|
|
|
}
|
|
|
|
|
2018-09-14 02:38:33 +00:00
|
|
|
void s1ap_handle_write_replace_warning_response(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2018-09-14 02:38:33 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-09-14 02:38:33 +00:00
|
|
|
|
|
|
|
S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
|
|
|
|
S1AP_WriteReplaceWarningResponse_t *WriteReplaceWarningResponse = NULL;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2018-09-14 02:38:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-09-14 02:38:33 +00:00
|
|
|
successfulOutcome = message->choice.successfulOutcome;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(successfulOutcome);
|
2018-09-14 02:38:33 +00:00
|
|
|
WriteReplaceWarningResponse =
|
|
|
|
&successfulOutcome->value.choice.WriteReplaceWarningResponse;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(WriteReplaceWarningResponse);
|
2018-09-14 02:38:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Write replace warning response");
|
2018-09-14 02:38:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-09-14 02:38:33 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void s1ap_handle_kill_response(
|
2019-09-13 12:07:47 +00:00
|
|
|
mme_enb_t *enb, ogs_s1ap_message_t *message)
|
2018-09-14 02:38:33 +00:00
|
|
|
{
|
2019-04-27 14:54:30 +00:00
|
|
|
char buf[OGS_ADDRSTRLEN];
|
2018-09-14 02:38:33 +00:00
|
|
|
|
|
|
|
S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
|
|
|
|
S1AP_KillResponse_t *KillResponse = NULL;
|
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(enb);
|
|
|
|
ogs_assert(enb->sock);
|
2018-09-14 02:38:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(message);
|
2018-09-14 02:38:33 +00:00
|
|
|
successfulOutcome = message->choice.successfulOutcome;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(successfulOutcome);
|
2018-09-14 02:38:33 +00:00
|
|
|
KillResponse =
|
|
|
|
&successfulOutcome->value.choice.KillResponse;
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_assert(KillResponse);
|
2018-09-14 02:38:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug("[MME] Kill response");
|
2018-09-14 02:38:33 +00:00
|
|
|
|
2019-04-27 14:54:30 +00:00
|
|
|
ogs_debug(" IP[%s] ENB_ID[%d]",
|
|
|
|
OGS_ADDR(enb->addr, buf), enb->enb_id);
|
2018-09-14 02:38:33 +00:00
|
|
|
|
|
|
|
}
|