Commit aaf50cbb authored by David Kim's avatar David Kim

revert to previous openair3/S1AP/s1ap_eNB_handlers.c version due to compile error

parent b90c0680
...@@ -191,10 +191,10 @@ eNBs = ...@@ -191,10 +191,10 @@ eNBs =
NETWORK_INTERFACES : NETWORK_INTERFACES :
{ {
ENB_INTERFACE_NAME_FOR_S1_MME = "enp68s0"; ENB_INTERFACE_NAME_FOR_S1_MME = "vpn";
ENB_IPV4_ADDRESS_FOR_S1_MME = "10.1.1.68"; ENB_IPV4_ADDRESS_FOR_S1_MME = "10.1.3.2";
ENB_INTERFACE_NAME_FOR_S1U = "enp68s0"; ENB_INTERFACE_NAME_FOR_S1U = "vpn";
ENB_IPV4_ADDRESS_FOR_S1U = "10.1.1.68"; ENB_IPV4_ADDRESS_FOR_S1U = "10.1.3.2";
ENB_PORT_FOR_S1U = 2152; # Spec 2152 ENB_PORT_FOR_S1U = 2152; # Spec 2152
ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.1"; ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.1";
ENB_PORT_FOR_X2C = 36422; # Spec 36422 ENB_PORT_FOR_X2C = 36422; # Spec 36422
......
...@@ -277,10 +277,6 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, ...@@ -277,10 +277,6 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
S1AP_S1SetupFailure_t *container; S1AP_S1SetupFailure_t *container;
S1AP_S1SetupFailureIEs_t *ie; S1AP_S1SetupFailureIEs_t *ie;
s1ap_eNB_mme_data_t *mme_desc_p; s1ap_eNB_mme_data_t *mme_desc_p;
uint32_t interval_sec = 0;
uint32_t timer_kind = 0;
s1ap_eNB_instance_t *instance_p;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.unsuccessfulOutcome.value.choice.S1SetupFailure; container = &pdu->choice.unsuccessfulOutcome.value.choice.S1SetupFailure;
...@@ -291,7 +287,7 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, ...@@ -291,7 +287,7 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
} }
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
S1AP_ERROR("[SCTP %d] Received S1 setup failure for non existing " S1AP_ERROR("[SCTP %d] Received S1 setup response for non existing "
"MME context\n", assoc_id); "MME context\n", assoc_id);
return -1; return -1;
} }
...@@ -299,10 +295,6 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, ...@@ -299,10 +295,6 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupFailureIEs_t, ie, container, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupFailureIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_Cause,true); S1AP_ProtocolIE_ID_id_Cause,true);
if(ie == NULL) {
return -1;
}
if ((ie->value.choice.Cause.present == S1AP_Cause_PR_misc) && if ((ie->value.choice.Cause.present == S1AP_Cause_PR_misc) &&
(ie->value.choice.Cause.choice.misc == S1AP_CauseMisc_unspecified)) { (ie->value.choice.Cause.choice.misc == S1AP_CauseMisc_unspecified)) {
S1AP_WARN("Received s1 setup failure for MME... MME is not ready\n"); S1AP_WARN("Received s1 setup failure for MME... MME is not ready\n");
...@@ -310,56 +302,8 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, ...@@ -310,56 +302,8 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
S1AP_ERROR("Received s1 setup failure for MME... please check your parameters\n"); S1AP_ERROR("Received s1 setup failure for MME... please check your parameters\n");
} }
if( mme_desc_p->timer_id != S1AP_TIMERID_INIT ) { mme_desc_p->state = S1AP_ENB_STATE_WAITING;
s1ap_timer_remove( mme_desc_p->timer_id ); s1ap_handle_s1_setup_message(mme_desc_p, 0);
mme_desc_p->timer_id = S1AP_TIMERID_INIT;
}
instance_p = mme_desc_p->s1ap_eNB_instance;
if( ( instance_p->s1_setupreq_count >= mme_desc_p->s1_setupreq_cnt) ||
( instance_p->s1_setupreq_count == 0xffff) ) {
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupFailureIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_TimeToWait, false);
if( ie != NULL ) {
switch(ie->value.choice.TimeToWait)
{
case S1AP_TimeToWait_v1s:
interval_sec = 1;
break;
case S1AP_TimeToWait_v2s:
interval_sec = 2;
break;
case S1AP_TimeToWait_v5s:
interval_sec = 5;
break;
case S1AP_TimeToWait_v10s:
interval_sec = 10;
break;
case S1AP_TimeToWait_v20s:
interval_sec = 20;
break;
case S1AP_TimeToWait_v60s:
interval_sec = 60;
break;
default:
interval_sec = instance_p->s1_setupreq_wait_timer;
break;
}
} else {
interval_sec = instance_p->s1_setupreq_wait_timer;
}
timer_kind = mme_desc_p->cnx_id;
timer_kind = timer_kind | S1AP_MMEIND;
timer_kind = timer_kind | S1_SETREQ_WAIT;
if( s1ap_timer_setup(interval_sec, 0, TASK_S1AP, instance_p->instance, timer_kind, S1AP_TIMER_ONE_SHOT,
NULL, &mme_desc_p->timer_id) < 0 ) {
S1AP_ERROR("Timer Start NG(S1 Setup Request) : MME=%d\n",mme_desc_p->cnx_id);
s1ap_eNB_snd_s1_setup_request( instance_p, mme_desc_p );
}
} else {
S1AP_ERROR("Retransmission count exceeded of S1 SETUP REQUEST : MME=%d\n",mme_desc_p->cnx_id);
}
return 0; return 0;
} }
...@@ -387,27 +331,9 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, ...@@ -387,27 +331,9 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
return -1; return -1;
} }
/* Set the capacity of this MME */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_RelativeMMECapacity, true);
if(ie == NULL) {
return -1;
}
mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity;
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_ServedGUMMEIs, true); S1AP_ProtocolIE_ID_id_ServedGUMMEIs, true);
if(ie == NULL) {
return -1;
}
if( mme_desc_p->timer_id != S1AP_TIMERID_INIT )
{
s1ap_timer_remove( mme_desc_p->timer_id );
mme_desc_p->timer_id = S1AP_TIMERID_INIT;
}
mme_desc_p->s1_setupreq_cnt = 0;
mme_desc_p->sctp_req_cnt = 0;
/* The list of served gummei can contain at most 8 elements. /* The list of served gummei can contain at most 8 elements.
* LTE related gummei is the first element in the list, i.e with an id of 0. * LTE related gummei is the first element in the list, i.e with an id of 0.
*/ */
...@@ -459,7 +385,13 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, ...@@ -459,7 +385,13 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id,
STAILQ_INSERT_TAIL(&mme_desc_p->served_gummei, new_gummei_p, next); STAILQ_INSERT_TAIL(&mme_desc_p->served_gummei, new_gummei_p, next);
} }
/* Set the capacity of this MME */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_RelativeMMECapacity, true);
mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity;
/* Optionaly set the mme name */ /* Optionaly set the mme name */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_MMEname, false); S1AP_ProtocolIE_ID_id_MMEname, false);
...@@ -810,9 +742,6 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, ...@@ -810,9 +742,6 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id,
S1AP_ProtocolIE_ID_id_CriticalityDiagnostics, false); S1AP_ProtocolIE_ID_id_CriticalityDiagnostics, false);
if (ie) { if (ie) {
if( ie->value.choice.CriticalityDiagnostics.procedureCode ) {
S1AP_WARN("Received S1 Error indication CriticalityDiagnostics procedureCode = %ld\n", *ie->value.choice.CriticalityDiagnostics.procedureCode);
}
// TODO continue // TODO continue
} }
...@@ -895,11 +824,9 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, ...@@ -895,11 +824,9 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
&(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_dl)); &(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_dl));
/* id-E-RABToBeSetupListCtxtSUReq */ /* id-E-RABToBeSetupListCtxtSUReq */
} else { } else {
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_E_RABToBeSetupListCtxtSUReq, true); S1AP_ProtocolIE_ID_id_E_RABToBeSetupListCtxtSUReq, true);
...@@ -942,7 +869,6 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, ...@@ -942,7 +869,6 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; item_p->e_RABlevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability;
} /* for i... */ } /* for i... */
} else {/* ie != NULL */ } else {/* ie != NULL */
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
...@@ -956,7 +882,6 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, ...@@ -956,7 +882,6 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.integrity_algorithms = S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.integrity_algorithms =
BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.integrityProtectionAlgorithms); BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.integrityProtectionAlgorithms);
} else {/* ie != NULL */ } else {/* ie != NULL */
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
...@@ -968,10 +893,9 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, ...@@ -968,10 +893,9 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
memcpy(&S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_key, memcpy(&S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_key,
ie->value.choice.SecurityKey.buf, ie->value.choice.SecurityKey.size); ie->value.choice.SecurityKey.buf, ie->value.choice.SecurityKey.size);
} else {/* ie != NULL */ } else {/* ie != NULL */
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
/* id-NRUESecurityCapabilities */ /* id-NRUESecurityCapabilities */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_NRUESecurityCapabilities, false); S1AP_ProtocolIE_ID_id_NRUESecurityCapabilities, false);
...@@ -984,7 +908,7 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, ...@@ -984,7 +908,7 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id,
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).nr_security_capabilities.encryption_algorithms = 0; S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).nr_security_capabilities.encryption_algorithms = 0;
S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).nr_security_capabilities.integrity_algorithms = 0; S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).nr_security_capabilities.integrity_algorithms = 0;
} }
itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p);
return 0; return 0;
...@@ -1011,13 +935,6 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, ...@@ -1011,13 +935,6 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id,
return -1; return -1;
} }
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_UEContextReleaseCommand_IEs_t, ie, container,
S1AP_ProtocolIE_ID_id_Cause, true);
if( ie == NULL ) {
S1AP_ERROR( "Mandatory Element Nothing : UEContextReleaseCommand(Cause)\n" );
return -1;
}
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_UEContextReleaseCommand_IEs_t, ie, container, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_UEContextReleaseCommand_IEs_t, ie, container,
S1AP_ProtocolIE_ID_id_UE_S1AP_IDs, true); S1AP_ProtocolIE_ID_id_UE_S1AP_IDs, true);
...@@ -1065,26 +982,9 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, ...@@ -1065,26 +982,9 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id,
//#warning "TODO mapping mme_ue_s1ap_id enb_ue_s1ap_id?" //#warning "TODO mapping mme_ue_s1ap_id enb_ue_s1ap_id?"
case S1AP_UE_S1AP_IDs_PR_mME_UE_S1AP_ID: case S1AP_UE_S1AP_IDs_PR_mME_UE_S1AP_ID:
mme_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.mME_UE_S1AP_ID; mme_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID;
S1AP_ERROR("TO DO mapping mme_ue_s1ap_id enb_ue_s1ap_id");
RB_FOREACH(ue_desc_p, s1ap_ue_map, &mme_desc_p->s1ap_eNB_instance->s1ap_ue_head) (void)mme_ue_s1ap_id; /* TODO: remove - it's to remove gcc warning about unused var */
{
if( ue_desc_p->mme_ue_s1ap_id == mme_ue_s1ap_id )
{
enb_ue_s1ap_id = ue_desc_p->eNB_ue_s1ap_id;
message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_UE_CONTEXT_RELEASE_COMMAND);
S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id;
itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p);
return 0;
}
}
S1AP_ERROR("[SCTP %d] Received UE context release command(mME_UE_S1AP_ID) for non "
"existing UE context 0x%06lx\n",
assoc_id,
mme_ue_s1ap_id);
return -1;
case S1AP_UE_S1AP_IDs_PR_NOTHING: case S1AP_UE_S1AP_IDs_PR_NOTHING:
default: default:
...@@ -1092,10 +992,12 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, ...@@ -1092,10 +992,12 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id,
return -1; return -1;
} }
} else { } else {
S1AP_ERROR( "Mandatory Element Nothing : UEContextReleaseCommand(UE_S1AP_IDs)\n" );
return -1; return -1;
} }
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_UEContextReleaseCommand_IEs_t, ie, container,
S1AP_ProtocolIE_ID_id_Cause, true);
/* TBD */
} }
static static
...@@ -1114,7 +1016,7 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, ...@@ -1114,7 +1016,7 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id,
container = &pdu->choice.initiatingMessage.value.choice.E_RABSetupRequest; container = &pdu->choice.initiatingMessage.value.choice.E_RABSetupRequest;
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
S1AP_ERROR("[SCTP %d] Received E-RAB setup request for non " S1AP_ERROR("[SCTP %d] Received initial context setup request for non "
"existing MME context\n", assoc_id); "existing MME context\n", assoc_id);
return -1; return -1;
} }
...@@ -1141,7 +1043,7 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, ...@@ -1141,7 +1043,7 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id,
if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance,
enb_ue_s1ap_id)) == NULL) { enb_ue_s1ap_id)) == NULL) {
S1AP_ERROR("[SCTP %d] Received E-RAB setup request for non " S1AP_ERROR("[SCTP %d] Received initial context setup request for non "
"existing UE context 0x%06lx\n", assoc_id, "existing UE context 0x%06lx\n", assoc_id,
enb_ue_s1ap_id); enb_ue_s1ap_id);
return -1; return -1;
...@@ -1214,7 +1116,6 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, ...@@ -1214,7 +1116,6 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id,
itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p);
} else { } else {
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
...@@ -1235,6 +1136,13 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, ...@@ -1235,6 +1136,13 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
// received Paging Message from MME // received Paging Message from MME
S1AP_DEBUG("[SCTP %d] Received Paging Message From MME\n",assoc_id); S1AP_DEBUG("[SCTP %d] Received Paging Message From MME\n",assoc_id);
/* Paging procedure -> stream != 0 */
if (stream == 0) {
LOG_W(S1AP,"[SCTP %d] Received Paging procedure on stream (%d)\n",
assoc_id, stream);
return -1;
}
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
S1AP_ERROR("[SCTP %d] Received Paging for non " S1AP_ERROR("[SCTP %d] Received Paging for non "
"existing MME context\n", assoc_id); "existing MME context\n", assoc_id);
...@@ -1262,7 +1170,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, ...@@ -1262,7 +1170,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code = 0; S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code = 0;
S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi = 0; S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi = 0;
} else { } else {
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
...@@ -1290,7 +1197,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, ...@@ -1290,7 +1197,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
if(i != ie->value.choice.UEPagingID.choice.iMSI.size - 1) { if(i != ie->value.choice.UEPagingID.choice.iMSI.size - 1) {
/* invalid paging_p->uePagingID.choise.iMSI.buffer */ /* invalid paging_p->uePagingID.choise.iMSI.buffer */
S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI error(i %d 0x0F)\n", assoc_id,i); S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI error(i %d 0x0F)\n", assoc_id,i);
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
} else { } else {
...@@ -1301,17 +1207,14 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, ...@@ -1301,17 +1207,14 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
if (S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length >= S1AP_IMSI_LENGTH) { if (S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length >= S1AP_IMSI_LENGTH) {
/* invalid paging_p->uePagingID.choise.iMSI.size */ /* invalid paging_p->uePagingID.choise.iMSI.size */
S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI.size(%d) is over IMSI length(%d)\n", assoc_id, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, S1AP_IMSI_LENGTH); S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI.size(%d) is over IMSI length(%d)\n", assoc_id, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, S1AP_IMSI_LENGTH);
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
} else { /* of if (ie->value.choice.UEPagingID.present == S1AP_UEPagingID_PR_iMSI) */ } else { /* of if (ie->value.choice.UEPagingID.present == S1AP_UEPagingID_PR_iMSI) */
/* invalid paging_p->uePagingID.present */ /* invalid paging_p->uePagingID.present */
S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.present(%d) is unknown\n", assoc_id, ie->value.choice.UEPagingID.present); S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.present(%d) is unknown\n", assoc_id, ie->value.choice.UEPagingID.present);
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
} else { /* of ie != NULL */ } else { /* of ie != NULL */
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
...@@ -1344,7 +1247,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, ...@@ -1344,7 +1247,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
return -1; return -1;
} }
} else { } else {
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
...@@ -1372,7 +1274,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, ...@@ -1372,7 +1274,6 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id,
S1AP_PAGING_IND(message_p).tac[i]); S1AP_PAGING_IND(message_p).tac[i]);
} }
} else { } else {
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
...@@ -1467,7 +1368,6 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, ...@@ -1467,7 +1368,6 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id,
S1AP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id; S1AP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id;
} }
} else { } else {
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
...@@ -1520,7 +1420,6 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, ...@@ -1520,7 +1420,6 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id,
itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p);
} else { /* of if (ie != NULL)*/ } else { /* of if (ie != NULL)*/
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
...@@ -1594,6 +1493,22 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, ...@@ -1594,6 +1493,22 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id,
message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_E_RAB_RELEASE_COMMAND); message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_E_RAB_RELEASE_COMMAND);
S1AP_E_RAB_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; S1AP_E_RAB_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id;
S1AP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id; S1AP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id;
/* id-NAS-PDU */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_NAS_PDU, false);
if(ie && ie->value.choice.NAS_PDU.size > 0) {
S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = ie->value.choice.NAS_PDU.size;
S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer =
malloc(sizeof(uint8_t) * ie->value.choice.NAS_PDU.size);
memcpy(S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer,
ie->value.choice.NAS_PDU.buf,
ie->value.choice.NAS_PDU.size);
} else {
S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = 0;
S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = NULL;
}
/* id-E-RABToBeReleasedList */ /* id-E-RABToBeReleasedList */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_E_RABToBeReleasedList, true); S1AP_ProtocolIE_ID_id_E_RABToBeReleasedList, true);
...@@ -1608,25 +1523,9 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, ...@@ -1608,25 +1523,9 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id,
S1AP_DEBUG("[SCTP] Received E-RAB release command for e-rab id %ld\n", item_p->e_RAB_ID); S1AP_DEBUG("[SCTP] Received E-RAB release command for e-rab id %ld\n", item_p->e_RAB_ID);
} }
} else { } else {
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
/* id-NAS-PDU */
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_NAS_PDU, false);
if(ie && ie->value.choice.NAS_PDU.size > 0) {
S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = ie->value.choice.NAS_PDU.size;
S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer =
malloc(sizeof(uint8_t) * ie->value.choice.NAS_PDU.size);
memcpy(S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer,
ie->value.choice.NAS_PDU.buf,
ie->value.choice.NAS_PDU.size);
} else {
S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = 0;
S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = NULL;
}
itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p);
return 0; return 0;
} }
...@@ -1651,6 +1550,7 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, ...@@ -1651,6 +1550,7 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id,
if (stream == 0) { if (stream == 0) {
S1AP_ERROR("[SCTP %d] Received s1 path switch request ack on stream (%d)\n", S1AP_ERROR("[SCTP %d] Received s1 path switch request ack on stream (%d)\n",
assoc_id, stream); assoc_id, stream);
//return -1;
} }
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
...@@ -1667,7 +1567,6 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, ...@@ -1667,7 +1567,6 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id,
if (ie == NULL) { if (ie == NULL) {
S1AP_ERROR("[SCTP %d] Received path switch request ack for non " S1AP_ERROR("[SCTP %d] Received path switch request ack for non "
"ie context is NULL\n", assoc_id); "ie context is NULL\n", assoc_id);
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
...@@ -1690,7 +1589,6 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, ...@@ -1690,7 +1589,6 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id,
if (ie == NULL) { if (ie == NULL) {
S1AP_ERROR("[SCTP %d] Received path switch request ack for non " S1AP_ERROR("[SCTP %d] Received path switch request ack for non "
"ie context is NULL\n", assoc_id); "ie context is NULL\n", assoc_id);
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
...@@ -1708,7 +1606,6 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, ...@@ -1708,7 +1606,6 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id,
if (ie == NULL) { if (ie == NULL) {
S1AP_ERROR("[SCTP %d] Received path switch request ack for non " S1AP_ERROR("[SCTP %d] Received path switch request ack for non "
"ie context is NULL\n", assoc_id); "ie context is NULL\n", assoc_id);
itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p);
return -1; return -1;
} }
...@@ -1722,10 +1619,14 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, ...@@ -1722,10 +1619,14 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id,
S1AP_ProtocolIE_ID_id_uEaggregateMaximumBitrate, false); S1AP_ProtocolIE_ID_id_uEaggregateMaximumBitrate, false);
if (ie) { if (ie) {
asn_INTEGER2ulong(&ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateUL, OCTET_STRING_TO_INT32 (
&S1AP_PATH_SWITCH_REQ_ACK(message_p).ue_ambr.br_ul); &ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateUL,
asn_INTEGER2ulong(&ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateDL, S1AP_PATH_SWITCH_REQ_ACK(message_p).ue_ambr.br_ul
&S1AP_PATH_SWITCH_REQ_ACK(message_p).ue_ambr.br_dl); );
OCTET_STRING_TO_INT32 (
&ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateDL,
S1AP_PATH_SWITCH_REQ_ACK(message_p).ue_ambr.br_dl
);
} else { } else {
S1AP_WARN("UEAggregateMaximumBitrate not supported\n"); S1AP_WARN("UEAggregateMaximumBitrate not supported\n");
S1AP_PATH_SWITCH_REQ_ACK(message_p).ue_ambr.br_ul = 0; S1AP_PATH_SWITCH_REQ_ACK(message_p).ue_ambr.br_ul = 0;
...@@ -1804,8 +1705,9 @@ int s1ap_eNB_handle_s1_path_switch_request_failure(uint32_t assoc_ ...@@ -1804,8 +1705,9 @@ int s1ap_eNB_handle_s1_path_switch_request_failure(uint32_t assoc_
pathSwitchRequestFailure = &pdu->choice.unsuccessfulOutcome.value.choice.PathSwitchRequestFailure; pathSwitchRequestFailure = &pdu->choice.unsuccessfulOutcome.value.choice.PathSwitchRequestFailure;
if (stream != 0) { if (stream != 0) {
S1AP_WARN("[SCTP %d] Received s1 path switch request failure on stream != 0 (%d)\n", S1AP_ERROR("[SCTP %d] Received s1 path switch request failure on stream != 0 (%d)\n",
assoc_id, stream); assoc_id, stream);
return -1;
} }
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
...@@ -1869,144 +1771,3 @@ int s1ap_eNB_handle_s1_ENDC_e_rab_modification_confirm(uint32_t as ...@@ -1869,144 +1771,3 @@ int s1ap_eNB_handle_s1_ENDC_e_rab_modification_confirm(uint32_t as
return 0; return 0;
} }
//-----------------------------------------------------------------------------
/*
* eNB generate a S1 setup request towards MME
*/
static int s1ap_eNB_snd_s1_setup_request(
s1ap_eNB_instance_t *instance_p,
s1ap_eNB_mme_data_t *s1ap_mme_data_p)
//-----------------------------------------------------------------------------
{
S1AP_S1AP_PDU_t pdu;
S1AP_S1SetupRequest_t *out = NULL;
S1AP_S1SetupRequestIEs_t *ie = NULL;
S1AP_SupportedTAs_Item_t *ta = NULL;
S1AP_PLMNidentity_t *plmn = NULL;
uint8_t *buffer = NULL;
uint32_t len = 0;
int ret = 0;
uint32_t timer_kind = 0;
DevAssert(instance_p != NULL);
DevAssert(s1ap_mme_data_p != NULL);
s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
/* Prepare the S1AP message to encode */
memset(&pdu, 0, sizeof(pdu));
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_S1Setup;
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_reject;
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_S1SetupRequest;
out = &pdu.choice.initiatingMessage.value.choice.S1SetupRequest;
/* mandatory */
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_Global_ENB_ID;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_Global_ENB_ID;
MCC_MNC_TO_PLMNID(instance_p->mcc[s1ap_mme_data_p->broadcast_plmn_index[0]],
instance_p->mnc[s1ap_mme_data_p->broadcast_plmn_index[0]],
instance_p->mnc_digit_length[s1ap_mme_data_p->broadcast_plmn_index[0]],
&ie->value.choice.Global_ENB_ID.pLMNidentity);
ie->value.choice.Global_ENB_ID.eNB_ID.present = S1AP_ENB_ID_PR_macroENB_ID;
MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id,
&ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID);
S1AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id,
ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[0],
ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[1],
ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[2]);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */
if (instance_p->eNB_name) {
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNBname;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_ENBname;
OCTET_STRING_fromBuf(&ie->value.choice.ENBname, instance_p->eNB_name,
strlen(instance_p->eNB_name));
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
/* mandatory */
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_SupportedTAs;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_SupportedTAs;
{
ta = (S1AP_SupportedTAs_Item_t *)calloc(1, sizeof(S1AP_SupportedTAs_Item_t));
INT16_TO_OCTET_STRING(instance_p->tac, &ta->tAC);
{
for (int i = 0; i < s1ap_mme_data_p->broadcast_plmn_num; ++i) {
plmn = (S1AP_PLMNidentity_t *)calloc(1, sizeof(S1AP_PLMNidentity_t));
MCC_MNC_TO_TBCD(instance_p->mcc[s1ap_mme_data_p->broadcast_plmn_index[i]],
instance_p->mnc[s1ap_mme_data_p->broadcast_plmn_index[i]],
instance_p->mnc_digit_length[s1ap_mme_data_p->broadcast_plmn_index[i]],
plmn);
ASN_SEQUENCE_ADD(&ta->broadcastPLMNs.list, plmn);
}
}
ASN_SEQUENCE_ADD(&ie->value.choice.SupportedTAs.list, ta);
}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_DefaultPagingDRX;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_PagingDRX;
ie->value.choice.PagingDRX = instance_p->default_drx;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* optional */
if (0) {
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_CSG_IdList;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_CSG_IdList;
// ie->value.choice.CSG_IdList = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
/* optional */
#if (S1AP_VERSION >= MAKE_VERSION(13, 0, 0))
if (0) {
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_UE_RetentionInformation;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_UE_RetentionInformation;
// ie->value.choice.UE_RetentionInformation = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
/* optional */
if (0) {
ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_NB_IoT_DefaultPagingDRX;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_S1SetupRequestIEs__value_PR_NB_IoT_DefaultPagingDRX;
// ie->value.choice.NB_IoT_DefaultPagingDRX = ;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
}
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(14, 0, 0)) */
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
S1AP_ERROR("Failed to encode S1 setup request\n");
return -1;
}
timer_kind = s1ap_mme_data_p->cnx_id;
timer_kind = timer_kind | S1AP_MMEIND;
timer_kind = timer_kind | S1_SETRSP_WAIT;
if( s1ap_timer_setup(instance_p->s1_setuprsp_wait_timer, 0, TASK_S1AP, instance_p->instance, timer_kind, S1AP_TIMER_ONE_SHOT,
NULL, &s1ap_mme_data_p->timer_id) < 0 )
{
S1AP_ERROR("Timer Start NG(S1 Setup Response) : MME=%d\n",s1ap_mme_data_p->cnx_id);
}
s1ap_mme_data_p->s1_setupreq_cnt++;
/* Non UE-Associated signalling -> stream = 0 */
s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, s1ap_mme_data_p->assoc_id, buffer, len, 0);
return ret;
}
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