Commit c7483721 authored by gauthier's avatar gauthier

to be tested

parent d0f0e5e7
...@@ -163,7 +163,13 @@ typedef uint32_t mbms_session_id_t; ...@@ -163,7 +163,13 @@ typedef uint32_t mbms_session_id_t;
typedef uint16_t mbms_service_id_t; typedef uint16_t mbms_service_id_t;
typedef uint16_t rnti_t; typedef uint16_t rnti_t;
typedef uint8_t rrc_enb_index_t; typedef uint8_t rrc_enb_index_t;
typedef uint8_t mme_code_t;
typedef uint32_t m_tmsi_t;
//Random UE identity length = 40 bits
#if ! defined(NOT_A_RANDOM_UE_IDENTITY)
#define NOT_A_RANDOM_UE_IDENTITY (uint64_t)0xFFFFFFFF
#endif
#if ! defined(NOT_A_RNTI) #if ! defined(NOT_A_RNTI)
#define NOT_A_RNTI (rnti_t)0 #define NOT_A_RNTI (rnti_t)0
#endif #endif
......
...@@ -212,9 +212,9 @@ typedef struct UE_RRC_INFO_s { ...@@ -212,9 +212,9 @@ typedef struct UE_RRC_INFO_s {
} __attribute__ ((__packed__)) UE_RRC_INFO; } __attribute__ ((__packed__)) UE_RRC_INFO;
typedef struct UE_S_TMSI_s { typedef struct UE_S_TMSI_s {
uint8_t presence; boolean_t presence;
uint8_t mme_code; mme_code_t mme_code;
uint32_t m_tmsi; m_tmsi_t m_tmsi;
} __attribute__ ((__packed__)) UE_S_TMSI; } __attribute__ ((__packed__)) UE_S_TMSI;
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
......
...@@ -540,8 +540,8 @@ rrc_eNB_get_next_transaction_identifier( ...@@ -540,8 +540,8 @@ rrc_eNB_get_next_transaction_identifier(
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// return 1 if there is already an UE with ue_identityP, 0 otherwise // return the ue context if there is already an UE with ue_identityP, NULL otherwise
static int static struct rrc_eNB_ue_context_s*
rrc_eNB_ue_context_random_exist( rrc_eNB_ue_context_random_exist(
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
const uint64_t ue_identityP const uint64_t ue_identityP
...@@ -551,9 +551,28 @@ rrc_eNB_ue_context_random_exist( ...@@ -551,9 +551,28 @@ rrc_eNB_ue_context_random_exist(
struct rrc_eNB_ue_context_s* ue_context_p = NULL; struct rrc_eNB_ue_context_s* ue_context_p = NULL;
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head)) { RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head)) {
if (ue_context_p->ue_context.random_ue_identity == ue_identityP) if (ue_context_p->ue_context.random_ue_identity == ue_identityP)
return 1; return ue_context_p;
} }
return 0; return NULL;
}
//-----------------------------------------------------------------------------
// return the ue context if there is already an UE with the same S-TMSI(MMEC+M-TMSI), NULL otherwise
static struct rrc_eNB_ue_context_s*
rrc_eNB_ue_context_stmsi_exist(
const protocol_ctxt_t* const ctxt_pP,
const mme_code_t mme_codeP,
const m_tmsi_t m_tmsiP
)
//-----------------------------------------------------------------------------
{
struct rrc_eNB_ue_context_s* ue_context_p = NULL;
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head)) {
if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE)
if (ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi == m_tmsiP)
if (ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code == mme_codeP)
return ue_context_p;
}
return NULL;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -3670,15 +3689,7 @@ rrc_eNB_decode_ccch( ...@@ -3670,15 +3689,7 @@ rrc_eNB_decode_ccch(
} else { } else {
rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8;
{ {
if (rrcConnectionRequest->ue_Identity.present != InitialUE_Identity_PR_randomValue) { if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) {
LOG_E(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest with S-TMSI not supported yet, let's reject the UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
rrc_eNB_generate_RRCConnectionReject(ctxt_pP,
rrc_eNB_get_ue_context(&eNB_rrc_inst[ctxt_pP->module_id], ctxt_pP->rnti),
CC_id);
break;
}
AssertFatal(rrcConnectionRequest->ue_Identity.choice.randomValue.size == 5, AssertFatal(rrcConnectionRequest->ue_Identity.choice.randomValue.size == 5,
"wrong InitialUE-Identity randomValue size, expected 5, provided %d", "wrong InitialUE-Identity randomValue size, expected 5, provided %d",
rrcConnectionRequest->ue_Identity.choice.randomValue.size); rrcConnectionRequest->ue_Identity.choice.randomValue.size);
...@@ -3688,36 +3699,29 @@ rrc_eNB_decode_ccch( ...@@ -3688,36 +3699,29 @@ rrc_eNB_decode_ccch(
/* if there is already a registered UE (with another RNTI) with this random_value, /* if there is already a registered UE (with another RNTI) with this random_value,
* the current one must be removed from MAC/PHY (zombie UE) * the current one must be removed from MAC/PHY (zombie UE)
*/ */
if (rrc_eNB_ue_context_random_exist(ctxt_pP, random_value)) { if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) {
AssertFatal(0 == 1, "TODO: remove UE fro MAC/PHY (how?)"); AssertFatal(0 == 1, "TODO: remove UE from MAC/PHY (how?)");
ue_context_p = NULL; ue_context_p = NULL;
} else { } else {
ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value);
} }
} } else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) {
LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE context: %X\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_context_p);
if (ue_context_p != NULL) {
#if defined(ENABLE_ITTI)
/* Check s-TMSI presence in message */
ue_context_p->ue_context.Initialue_identity_s_TMSI.presence =
(rrcConnectionRequest->ue_Identity.present == InitialUE_Identity_PR_s_TMSI);
if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence) {
/* Save s-TMSI */ /* Save s-TMSI */
S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI; S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI;
mme_code_t mme_code = BIT_STRING_to_uint8(&s_TMSI.mmec);
m_tmsi_t m_tmsi = BIT_STRING_to_uint32(&s_TMSI.m_TMSI);
random_value = (((uint64_t)mme_code) << 32) | m_tmsi;
if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) {
AssertFatal(0 == 1, "TODO: remove UE from MAC/PHY (how?)");
ue_context_p = NULL;
} else {
ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY);
}
ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE;
ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code;
ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi = m_tmsi;
ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = MSC_LOG_RX_MESSAGE(
BIT_STRING_to_uint8(&s_TMSI.mmec);
ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi =
BIT_STRING_to_uint32(&s_TMSI.m_TMSI);
MSC_LOG_RX_DISCARDED_MESSAGE(
MSC_RRC_ENB, MSC_RRC_ENB,
MSC_RRC_UE, MSC_RRC_UE,
Srb_info->Rx_buffer.Payload, Srb_info->Rx_buffer.Payload,
...@@ -3726,25 +3730,30 @@ rrc_eNB_decode_ccch( ...@@ -3726,25 +3730,30 @@ rrc_eNB_decode_ccch(
MSC_AS_TIME_ARGS(ctxt_pP), MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti,
dec_rval.consumed, dec_rval.consumed,
s_TMSI.mmec, ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code,
s_TMSI.m_TMSI, ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
ue_context_p->ue_context.random_ue_identity); ue_context_p->ue_context.random_ue_identity);
} else { } else {
MSC_LOG_RX_DISCARDED_MESSAGE( LOG_E(RRC,
MSC_RRC_ENB, PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n",
MSC_RRC_UE, PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
Srb_info->Rx_buffer.Payload, rrc_eNB_generate_RRCConnectionReject(ctxt_pP,
dec_rval.consumed, rrc_eNB_get_ue_context(&eNB_rrc_inst[ctxt_pP->module_id], ctxt_pP->rnti),
MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u random UE id (0x%" PRIx64 ")", CC_id);
MSC_AS_TIME_ARGS(ctxt_pP), break;
ue_context_p->ue_context.rnti,
dec_rval.consumed,
ue_context_p->ue_context.random_ue_identity);
} }
ue_context_p->ue_context.establishment_cause = }
rrcConnectionRequest->establishmentCause; LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE context: %X\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_context_p);
if (ue_context_p != NULL) {
#if defined(ENABLE_ITTI)
ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause;
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %u\n", LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %u\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_context_p->ue_context.random_ue_identity, ue_context_p->ue_context.random_ue_identity,
......
...@@ -16,7 +16,7 @@ eNBs = ...@@ -16,7 +16,7 @@ eNBs =
tracking_area_code = "1"; tracking_area_code = "1";
mobile_country_code = "208"; mobile_country_code = "208";
mobile_network_code = "92"; mobile_network_code = "95";
////////// Physical parameters: ////////// Physical parameters:
...@@ -130,18 +130,18 @@ eNBs = ...@@ -130,18 +130,18 @@ eNBs =
}; };
////////// MME parameters: ////////// MME parameters:
mme_ip_address = ( {ipv4 = "192.168.12.26"; mme_ip_address = ( {ipv4 = "192.168.12.17";
ipv6="192:168:30::17"; ipv6="192:168:30::17";
active="yes"; active="yes";
preference="ipv4";}); preference="ipv4";});
NETWORK_INTERFACES : NETWORK_INTERFACES :
{ {
ENB_INTERFACE_NAME_FOR_S1_MME = "eth1"; ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.82/24"; ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.213/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth1"; ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.82/24"; ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.213/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152 ENB_PORT_FOR_S1U = 2152; # Spec 2152
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment