Commit 95774e5b authored by nikaeinn's avatar nikaeinn

* fix the mac header parser when receving long BSR

* update the ciphering and integrity handling at the eNB
* add SECU complication directive to lte-softmodem  makefile
* update the config files, revert the log.c (modif by LG)
* pre-ci tests passed except for eMBMS


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5287 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 9c194d17
......@@ -50,7 +50,6 @@ CFLAGS = \
-Wall \
-DENB_MODE \
-DENABLE_USE_MME \
-DEMIT_ASN_DEBUG=1 \
-DUSER_MODE \
-I./MESSAGES \
-I$(OUTDIR) \
......
#ifndef S1AP_ENB_DEFAULT_VALUES_H_
#define S1AP_ENB_DEFAULT_VALUES_H_
#define ENB_TAC (0)
#define ENB_TAC (1)
#define ENB_MCC (208)
#define ENB_MNC (34)
#define ENB_MNC (92)
#define ENB_NAME "Eurecom ENB"
#define ENB_NAME_FORMAT (ENB_NAME" %u")
......
......@@ -103,7 +103,7 @@ endif
EXTRA_CFLAGS += -I/usr/include -I/usr/realtime/include
EXTRA_CFLAGS += -I$(OPENAIR1_DIR)
EXTRA_CFLAGS += -DEMIT_ASN_DEBUG=0
#EXTRA_CFLAGS += -DEMIT_ASN_DEBUG=0
include $(OPENAIR1_DIR)/SCHED/Makefile.inc
include $(OPENAIR1_DIR)/PHY/Makefile.inc
......
......@@ -3060,7 +3060,7 @@ void phy_procedures_eNB_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,ui
}
// If we've dropped the UE, go back to PRACH mode for this UE
#if !defined(EXMIMO_IOT)
//#if !defined(EXMIMO_IOT)
if (phy_vars_eNB->eNB_UE_stats[i].ulsch_consecutive_errors[harq_pid] == 20) {
LOG_I(PHY,"[eNB %d] frame %d, subframe %d, UE %d: ULSCH consecutive error count reached %u, removing UE\n",
phy_vars_eNB->Mod_id,frame,last_slot>>1, i, phy_vars_eNB->eNB_UE_stats[i].ulsch_consecutive_errors[harq_pid]);
......@@ -3073,7 +3073,7 @@ void phy_procedures_eNB_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,ui
remove_ue(phy_vars_eNB->eNB_UE_stats[i].crnti,phy_vars_eNB,abstraction_flag);
phy_vars_eNB->eNB_UE_stats[i].ulsch_consecutive_errors[harq_pid]=0;
}
#endif
//#endif
}
} // ulsch in error
else {
......
......@@ -149,12 +149,16 @@ static void enb_config_display(void) {
printf( "----------------------------------------------------------------------\n");
for (i = 0; i < enb_properties.number; i++) {
printf( "ENB CONFIG no %u:\n\n", i);
printf( "\teNB name: \t%s:\n",enb_properties.properties[i]->eNB_name);
printf( "\teNB ID: \t%u:\n",enb_properties.properties[i]->eNB_id);
printf( "\tCell type:\t%s:\n",enb_properties.properties[i]->cell_type == CELL_MACRO_ENB ? "CELL_MACRO_ENB":"CELL_HOME_ENB");
printf( "\tTAC: \t%u:\n",enb_properties.properties[i]->tac);
printf( "\tMCC: \t%u:\n",enb_properties.properties[i]->mcc);
printf( "\tMNC: \t%u:\n",enb_properties.properties[i]->mnc);
printf( "\teNB name: \t%s:\n",enb_properties.properties[i]->eNB_name);
printf( "\teNB ID: \t%u:\n",enb_properties.properties[i]->eNB_id);
printf( "\tCell type: \t%s:\n",enb_properties.properties[i]->cell_type == CELL_MACRO_ENB ? "CELL_MACRO_ENB":"CELL_HOME_ENB");
printf( "\tTAC: \t%u:\n",enb_properties.properties[i]->tac);
printf( "\tMCC: \t%u:\n",enb_properties.properties[i]->mcc);
printf( "\tMNC: \t%u:\n",enb_properties.properties[i]->mnc);
printf( "\teutra band: \t%d:\n",enb_properties.properties[i]->eutra_band);
printf( "\tdownlink freq:\t%u:\n",enb_properties.properties[i]->downlink_frequency);
printf( "\tuplink freq: \t%d:\n",enb_properties.properties[i]->uplink_frequency_offset);
printf( "\n--------------------------------------------------------\n");
}
}
......@@ -233,8 +237,8 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
long int tdd_config_s;
const char* prefix_type;
long int eutra_band;
double downlink_frequency;
double uplink_frequency_offset;
long long downlink_frequency;
long long uplink_frequency_offset;
char* ipv4 = NULL;
char* ipv6 = NULL;
char* active = NULL;
......@@ -271,7 +275,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
if( (config_lookup_string( &cfg, ENB_CONFIG_STRING_ASN1_VERBOSITY, (const char **)&astring) )) {
if (strcasecmp(astring , ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE) == 0) {
asn_debug = 1;
asn_debug = 0;
asn1_xer_print = 0;
} else if (strcasecmp(astring , ENB_CONFIG_STRING_ASN1_VERBOSITY_INFO) == 0) {
asn_debug = 1;
......@@ -329,6 +333,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
&& config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_MOBILE_COUNTRY_CODE, &mcc)
&& config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_MOBILE_NETWORK_CODE, &mnc)
&& config_setting_lookup_string(setting_enb, ENB_CONFIG_STRING_DEFAULT_PAGING_DRX, &default_drx)
)
) {
AssertError (0, parse_errors ++,
......@@ -423,14 +428,13 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
enb_properties.properties[enb_properties_index]->eutra_band = 7; // Default band
}
if(config_setting_lookup_float(setting_enb, ENB_CONFIG_STRING_DOWNLINK_FREQUENCY, &downlink_frequency)) {
enb_properties.properties[enb_properties_index]->downlink_frequency = downlink_frequency;
if(config_setting_lookup_int64(setting_enb, ENB_CONFIG_STRING_DOWNLINK_FREQUENCY, &downlink_frequency)) {
enb_properties.properties[enb_properties_index]->downlink_frequency = (unsigned int) downlink_frequency;
} else {
enb_properties.properties[enb_properties_index]->downlink_frequency = 2680000000UL; // Default downlink frequency
enb_properties.properties[enb_properties_index]->downlink_frequency = 2680000000UL; // Default downlink frequency
}
if(config_setting_lookup_float(setting_enb, ENB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET, &uplink_frequency_offset)) {
enb_properties.properties[enb_properties_index]->uplink_frequency_offset = uplink_frequency_offset;
if(config_setting_lookup_int64(setting_enb, ENB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET, &uplink_frequency_offset)) {
enb_properties.properties[enb_properties_index]->uplink_frequency_offset = (unsigned int) uplink_frequency_offset;
} else {
// Default uplink frequency offset
if (enb_properties.properties[enb_properties_index]->frame_type == FDD) {
......@@ -439,7 +443,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
enb_properties.properties[enb_properties_index]->uplink_frequency_offset = 0;
}
}
parse_errors += enb_check_band_frequencies(lib_config_file_name_pP,
enb_properties_index,
enb_properties.properties[enb_properties_index]->eutra_band,
......
......@@ -256,7 +256,7 @@ void terminate_ra_proc(module_id_t module_idP,frame_t frameP,rnti_t rnti,unsigne
payload_ptr = parse_ulsch_header(msg3,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,msg3_len);
LOG_D(MAC,"[eNB %d][RAPROC] Frame %d Received CCCH: length %d, offset %d\n",
module_idP,frameP,rx_lengths[0],payload_ptr-msg3);
if ((num_ce == 0) && (num_sdu==1) && (rx_lcids[0] == CCCH)) { // This is an RRCConnectionRequest/Restablishment
if (/*(num_ce == 0) &&*/ (num_sdu==1) && (rx_lcids[0] == CCCH)) { // This is an RRCConnectionRequest/Restablishment
memcpy(&eNB_mac_inst[module_idP].RA_template[i].cont_res_id[0],payload_ptr,6);
LOG_D(MAC,"[eNB %d][RAPROC] Frame %d Received CCCH: length %d, offset %d\n",
module_idP,frameP,rx_lengths[0],payload_ptr-msg3);
......@@ -496,11 +496,15 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header,
num_ces++;
mac_header_ptr++;
if (lcid==LONG_BSR)
ce_len+=4;
ce_len+=3;
else if (lcid==CRNTI)
ce_len+=2;
else if ((lcid==POWER_HEADROOM) || (lcid==TRUNCATED_BSR)|| (lcid== SHORT_BSR))
ce_len++;
else {
LOG_E(MAC,"unknown CE %d \n", lcid);
exit(-1);
}
}
}
}
......
......@@ -273,8 +273,8 @@ boolean_t pdcp_data_req(
#if defined(ENABLE_SECURITY)
if ((pdcp_p->security_activated != 0) &&
((pdcp_p->cipheringAlgorithm) != 0) &&
((pdcp_p->integrityProtAlgorithm) != 0)) {
(((pdcp_p->cipheringAlgorithm) != 0) ||
((pdcp_p->integrityProtAlgorithm) != 0))) {
if (enb_flagP == ENB_FLAG_NO)
start_meas(&eNB_pdcp_stats[enb_mod_idP].apply_security);
......@@ -289,6 +289,13 @@ boolean_t pdcp_data_req(
else
stop_meas(&UE_pdcp_stats[ue_mod_idP].apply_security);
}
LOG_D(PDCP,"MAC_I is %02x.%02x.%02x.%02x\n",
pdcp_pdu_p->data[pdcp_header_len + sdu_buffer_sizeP ],
pdcp_pdu_p->data[pdcp_header_len + sdu_buffer_sizeP +1],
pdcp_pdu_p->data[pdcp_header_len + sdu_buffer_sizeP +2],
pdcp_pdu_p->data[pdcp_header_len + sdu_buffer_sizeP +3]);
#endif
/* Print octets of outgoing data in hexadecimal form */
......
......@@ -444,7 +444,7 @@ public_pdcp(pdcp_stats_t UE_pdcp_stats[NUMBER_OF_UE_MAX];)
public_pdcp(pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX];)
protected_pdcp(pdcp_t pdcp_array_srb_ue[NUMBER_OF_UE_MAX][2];)
protected_pdcp(pdcp_t pdcp_array_drb_ue[NUMBER_OF_UE_MAX][maxDRB];)
protected_pdcp(pdcp_t pdcp_array_srb_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][2];)
public_pdcp(pdcp_t pdcp_array_srb_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][2];)
protected_pdcp(pdcp_t pdcp_array_drb_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][maxDRB];)
#if defined(Rel10)
public_pdcp(pdcp_mbms_t pdcp_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
......
......@@ -108,12 +108,12 @@ int pdcp_apply_security(pdcp_t *pdcp_entity, rb_id_t rb_id,
/* SRBs */
uint8_t *mac_i;
LOG_D(PDCP, "[OSA][RB %d] %s Applying control-plane security\n",
rb_id, (pdcp_entity->is_ue != 0) ? "UE -> eNB" : "eNB -> UE");
LOG_D(PDCP, "[OSA][RB %d] %s Applying control-plane security %d \n",
rb_id, (pdcp_entity->is_ue != 0) ? "UE -> eNB" : "eNB -> UE", pdcp_entity->integrityProtAlgorithm);
encrypt_params.message = pdcp_pdu_buffer;
encrypt_params.blength = (pdcp_header_len + sdu_buffer_size) << 3;
encrypt_params.key = pdcp_entity->kRRCint + 128;
encrypt_params.key = pdcp_entity->kRRCint + 16; // + 128;
mac_i = &pdcp_pdu_buffer[pdcp_header_len + sdu_buffer_size];
......@@ -122,12 +122,12 @@ int pdcp_apply_security(pdcp_t *pdcp_entity, rb_id_t rb_id,
stream_compute_integrity(pdcp_entity->integrityProtAlgorithm, &encrypt_params,
mac_i);
encrypt_params.key = pdcp_entity->kRRCenc + 128;
encrypt_params.key = pdcp_entity->kRRCenc; // + 128 // bit key
} else {
LOG_D(PDCP, "[OSA][RB %d] %s Applying user-plane security\n",
rb_id, (pdcp_entity->is_ue != 0) ? "UE -> eNB" : "eNB -> UE");
encrypt_params.key = pdcp_entity->kUPenc + 128;
encrypt_params.key = pdcp_entity->kUPenc;// + 128;
}
encrypt_params.message = &pdcp_pdu_buffer[pdcp_header_len];
......@@ -170,11 +170,11 @@ int pdcp_validate_security(pdcp_t *pdcp_entity, rb_id_t rb_id,
if (rb_id < DTCH) {
LOG_D(PDCP, "[OSA][RB %d] %s Validating control-plane security\n",
rb_id, (pdcp_entity->is_ue != 0) ? "eNB -> UE" : "UE -> eNB");
decrypt_params.key = pdcp_entity->kRRCenc + 128;
decrypt_params.key = pdcp_entity->kRRCenc;// + 128;
} else {
LOG_D(PDCP, "[OSA][RB %d] %s Validating user-plane security\n",
rb_id, (pdcp_entity->is_ue != 0) ? "eNB -> UE" : "UE -> eNB");
decrypt_params.key = pdcp_entity->kUPenc + 128;
decrypt_params.key = pdcp_entity->kUPenc;// + 128;
}
/* Uncipher the block */
......@@ -184,7 +184,7 @@ int pdcp_validate_security(pdcp_t *pdcp_entity, rb_id_t rb_id,
/* Now check the integrity of the complete PDU */
decrypt_params.message = pdcp_pdu_buffer;
decrypt_params.blength = sdu_buffer_size << 3;
decrypt_params.key = pdcp_entity->kRRCint + 128;
decrypt_params.key = pdcp_entity->kRRCint + 16;// 128;
if (stream_check_integrity(pdcp_entity->integrityProtAlgorithm,
&decrypt_params, &pdcp_pdu_buffer[sdu_buffer_size]) != 0)
......
......@@ -306,7 +306,7 @@ void mac_rlc_data_ind (
rlc_mode = rlc_union_p->mode;
} else {
rlc_mode = RLC_MODE_NONE;
AssertFatal (0 , "%s RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP);
//AssertFatal (0 , "%s RLC not configured rb id %u lcid %u module %u!\n", __FUNCTION__, rb_id, channel_idP, ue_module_idP);
}
struct mac_data_ind data_ind = mac_rlc_deserialize_tb(buffer_pP, tb_sizeP, num_tbP, crcs_pP);
switch (rlc_mode) {
......
......@@ -534,9 +534,16 @@ void rrc_eNB_generate_SecurityModeCommand(
uint8_t size;
size = do_SecurityModeCommand(enb_mod_idP, buffer, ue_mod_idP, rrc_eNB_get_next_transaction_identifier(enb_mod_idP),
eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[ue_mod_idP],
eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[ue_mod_idP],
eNB_rrc_inst[enb_mod_idP].integrity_algorithm[ue_mod_idP]);
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"RRC Security Mode Command\n");
for (i = 0; i < size; i++)
LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
LOG_F(RRC,"\n");
#endif
LOG_I(RRC,
"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d, UE id %d)\n",
enb_mod_idP, frameP, size, ue_mod_idP);
......@@ -714,7 +721,7 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config));
DRB_config->rlc_Config = DRB_rlc_config;
#ifdef EXMIMO_IOT
#ifndef EXMIMO_IOT
DRB_rlc_config->present = RLC_Config_PR_am;
DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50;
DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16;
......@@ -731,16 +738,12 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
DRB_config->pdcp_Config = DRB_pdcp_config;
#ifdef EXMIMO_IOT
DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long));
*DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity;
#else
DRB_pdcp_config->discardTimer = NULL;
#endif
DRB_pdcp_config->rlc_AM = NULL;
DRB_pdcp_config->rlc_UM = NULL;
#ifdef EXMIMO_IOT
#ifndef EXMIMO_IOT
PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM));
DRB_pdcp_config->rlc_AM = PDCP_rlc_AM;
PDCP_rlc_AM->statusReportRequired = FALSE;
......@@ -1075,7 +1078,7 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
for (i = 0; i < UE_info->nb_of_e_rabs; i++) {
if (UE_info->e_rab[i].param.nas_pdu.buffer != NULL) {
dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t));
memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t));
OCTET_STRING_fromBuf(dedicatedInfoNas, (char *)UE_info->e_rab[i].param.nas_pdu.buffer,
UE_info->e_rab[i].param.nas_pdu.length);
ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas);
......@@ -1101,17 +1104,28 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration(
memset(buffer, 0, RRC_BUF_SIZE);
size = do_RRCConnectionReconfiguration(enb_mod_idP, buffer, ue_mod_idP, rrc_eNB_get_next_transaction_identifier(enb_mod_idP), //Transaction_id,
SRB_configList2, *DRB_configList, NULL, // DRB2_list,
#ifdef EXMIMO_IOT
NULL,
#else
SRB_configList2,
#endif
*DRB_configList, NULL, // DRB2_list,
NULL, // *sps_Config,
physicalConfigDedicated[ue_mod_idP], MeasObj_list, ReportConfig_list,
quantityConfig,
#ifdef EXMIMO_IOT
NULL,
NULL, NULL, NULL, NULL,NULL,
#else
MeasId_list,
physicalConfigDedicated[ue_mod_idP], MeasObj_list, ReportConfig_list, quantityConfig, MeasId_list,
#endif
mac_MainConfig, NULL, NULL, Sparams, rsrp, cba_RNTI, dedicatedInfoNASList);
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"RRC Connection Reconfiguration\n");
for (i = 0; i < size; i++)
LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]);
LOG_F(RRC,"\n");
////////////////////////////////////////
#endif
#if defined(ENABLE_ITTI)
/* Free all NAS PDUs */
for (i = 0; i < UE_info->nb_of_e_rabs; i++) {
......@@ -2207,6 +2221,7 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete(
eNB_rrc_inst[enb_mod_idP].kenb[ue_mod_idP], &kRRCenc);
derive_key_rrc_int(eNB_rrc_inst[enb_mod_idP].integrity_algorithm[ue_mod_idP],
eNB_rrc_inst[enb_mod_idP].kenb[ue_mod_idP], &kRRCint);
#endif
#ifdef ENABLE_RAL
{
......@@ -2237,13 +2252,17 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete(
itti_send_msg_to_task(TASK_RAL_ENB, enb_mod_idP, message_ral_p);
}
#endif
// Refresh SRBs/DRBs
rrc_pdcp_config_asn1_req(enb_mod_idP, ue_mod_idP, frameP, ENB_FLAG_YES,
SRB_configList,
DRB_configList, (DRB_ToReleaseList_t *) NULL,
eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[ue_mod_idP] |
(eNB_rrc_inst[enb_mod_idP].integrity_algorithm[ue_mod_idP] << 4), kRRCenc, kRRCint, kUPenc
/*eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[ue_mod_idP] |
(eNB_rrc_inst[enb_mod_idP].integrity_algorithm[ue_mod_idP] << 4),
*/
0xff, // already configured during the securitymodecommand
kRRCenc,
kRRCint,
kUPenc
#ifdef Rel10
, (PMCH_InfoList_r9_t *) NULL
#endif
......@@ -2414,6 +2433,14 @@ void rrc_eNB_generate_RRCConnectionSetup(
mac_xface->lte_frame_parms,
SRB_configList, &eNB_rrc_inst[enb_mod_idP].physicalConfigDedicated[ue_mod_idP]);
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"RRC Connection Setup\n");
for (cnt = 0; cnt < eNB_rrc_inst[Mod_id].Srb0.Tx_buffer.payload_size; cnt++)
LOG_F(RRC,"%02x ", ((uint8_t*)eNB_rrc_inst[Mod_id].Srb0.Tx_buffer.Payload)[cnt]);
LOG_F(RRC,"\n");
//////////////////////////////////
#endif
// configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE
if (*SRB_configList != NULL) {
......@@ -2495,9 +2522,9 @@ char openair_rrc_lite_eNB_init(
{
/* Init security parameters */
for (j = 0; j < NUMBER_OF_UE_MAX; j++) {
eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[j] = SecurityAlgorithmConfig__cipheringAlgorithm_eea2;
eNB_rrc_inst[enb_mod_idP].integrity_algorithm[j] = SecurityAlgorithmConfig__integrityProtAlgorithm_eia2;
rrc_lite_eNB_init_security(enb_mod_idP, j);
eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[j] = SecurityAlgorithmConfig__cipheringAlgorithm_eea0;
eNB_rrc_inst[enb_mod_idP].integrity_algorithm[j] = SecurityAlgorithmConfig__integrityProtAlgorithm_eia2;
rrc_lite_eNB_init_security(enb_mod_idP, j);
}
}
......@@ -2574,7 +2601,7 @@ char openair_rrc_lite_eNB_init(
return 0;
}
/*------------------------------------------------------------------------------*/
int rrc_eNB_decode_ccch(
module_id_t enb_mod_idP,
......@@ -2590,7 +2617,7 @@ int rrc_eNB_decode_ccch(
//memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t));
LOG_T(RRC, "[eNB %d] Frame %d: Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n",
LOG_D(RRC, "[eNB %d] Frame %d: Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n",
enb_mod_idP, frameP, ((uint8_t *) Srb_info->Rx_buffer.Payload)[0],
((uint8_t *) Srb_info->Rx_buffer.Payload)[1],
((uint8_t *) Srb_info->Rx_buffer.Payload)[2],
......@@ -2653,7 +2680,13 @@ int rrc_eNB_decode_ccch(
break;
case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest:
LOG_D(RRC,
#ifdef RRC_MSG_PRINT
LOG_F(RRC, "RRC Connection Request\n");
for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++)
LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]);
LOG_F(RRC,"\n");
#endif
LOG_D(RRC,
"[FRAME %05d][MAC_eNB][MOD %02d][][--- MAC_DATA_IND (rrcConnectionRequest on SRB0) -->][RRC_eNB][MOD %02d][]\n",
frameP, enb_mod_idP, enb_mod_idP);
......@@ -2863,11 +2896,18 @@ int rrc_eNB_decode_dcch(
break;
case UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete:
LOG_D(RRC,
"[FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes "
"(RRCConnectionReconfigurationComplete) --->][RRC_eNB][MOD %02d][]\n",
frameP, enb_mod_idP, DCCH, sdu_sizeP, enb_mod_idP);
if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.
#ifdef RRC_MSG_PRINT
LOG_F(RRC," RRC Connection Reconfiguration Complete\n");
for (i = 0; i < sdu_size; i++)
LOF_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
LOG_F(RRC,"\n");
#endif
LOG_D(RRC,
"[FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes "
"(RRCConnectionReconfigurationComplete) --->][RRC_eNB][MOD %02d][]\n",
frameP, enb_mod_idP, DCCH, sdu_sizeP, enb_mod_idP);
if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.
present ==
RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8)
{
......@@ -2889,14 +2929,26 @@ int rrc_eNB_decode_dcch(
break;
case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete:
LOG_D(RRC,
"[FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes "
"(rrcConnectionReestablishmentComplete) --->][RRC_eNB][MOD %02d][]\n",
frameP, enb_mod_idP, DCCH, sdu_sizeP, enb_mod_idP);
break;
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"RRC Connection Reestablishment Complete\n");
for (i = 0; i < sdu_size; i++)
LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
LOG_F(RRC,"\n");
#endif
LOG_I(RRC,
"[FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes "
"(rrcConnectionReestablishmentComplete) --->][RRC_eNB][MOD %02d][]\n",
frameP, enb_mod_idP, DCCH, sdu_sizeP, enb_mod_idP);
break;
case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete:
LOG_D(RRC,
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"RRC Connection SetupComplete\n");
for (i = 0; i < sdu_size; i++)
LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
LOG_F(RRC,"\n");
#endif
LOG_D(RRC,
"[FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes "
"(RRCConnectionSetupComplete) --->][RRC_eNB][MOD %02d][]\n",
frameP, enb_mod_idP, DCCH, sdu_sizeP, enb_mod_idP);
......@@ -2920,7 +2972,13 @@ int rrc_eNB_decode_dcch(
break;
case UL_DCCH_MessageType__c1_PR_securityModeComplete:
LOG_I(RRC,
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"RRC Security Mode Complete\n");
for (i = 0; i < sdu_size; i++)
LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
LOG_F(RRC,"\n");
#endif
LOG_I(RRC,
"[eNB %d] Frame %d received securityModeComplete on UL-DCCH %d from UE %d\n",
enb_mod_idP, frameP, DCCH, ue_mod_idP);
LOG_D(RRC,
......@@ -2936,7 +2994,13 @@ int rrc_eNB_decode_dcch(
break;
case UL_DCCH_MessageType__c1_PR_securityModeFailure:
LOG_D(RRC,
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"RRC Security Mode Failure\n");
for (i = 0; i < sdu_size; i++)
LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
LOG_F(RRC,"\n");
#endif
LOG_D(RRC,
"[FRAME %05d][RLC][MOD %02d][RB %02d][--- RLC_DATA_IND %d bytes "
"(securityModeFailure) --->][RRC_eNB][MOD %02d][]\n", frameP, enb_mod_idP, DCCH, sdu_sizeP, enb_mod_idP);
#ifdef XER_PRINT
......@@ -2949,6 +3013,12 @@ int rrc_eNB_decode_dcch(
break;
case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation:
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"RRC UECapablility Information \n");
for (i = 0; i < sdu_size; i++)
LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
LOG_F(RRC,"\n");
#endif
LOG_I(RRC,
"[eNB %d] Frame %d received ueCapabilityInformation on UL-DCCH %d from UE %d\n",
enb_mod_idP, frameP, DCCH, ue_mod_idP);
......@@ -2985,6 +3055,13 @@ int rrc_eNB_decode_dcch(
break;
case UL_DCCH_MessageType__c1_PR_ulInformationTransfer:
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"RRC UL Information Transfer \n");
for (i = 0; i < sdu_size; i++)
LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
LOG_F(RRC,"\n");
#endif
#if defined(ENABLE_USE_MME)
if (EPC_MODE_ENABLED == 1) {
rrc_eNB_send_S1AP_UPLINK_NAS(enb_mod_idP, ue_mod_idP, ul_dcch_msg);
......
......@@ -32,7 +32,7 @@ Address : EURECOM,
/*! \file rrc_eNB_S1AP.c
* \brief rrc S1AP procedures for eNB
* \author Laurent Winckel
* \author Laurent Winckel and Navid Nikaein
* \date 2013
* \version 1.0
* \company Eurecom
......@@ -50,11 +50,16 @@ Address : EURECOM,
# include "asn1_conversions.h"
# include "intertask_interface.h"
# include "pdcp.h"
# include "pdcp_primitives.h"
# include "s1ap_eNB.h"
# else
# include "../../S1AP/s1ap_eNB.h"
# endif
#if defined(ENABLE_SECURITY)
# include "UTIL/OSA/osa_defs.h"
#endif
/* Value to indicate an invalid UE initial id */
static const uint16_t UE_INITIAL_ID_INVALID = 0;
......@@ -69,8 +74,12 @@ static const uint16_t S1AP_INTEGRITY_EIA2_MASK = 0x2;
#ifdef Rel10
# define INTEGRITY_ALGORITHM_NONE SecurityAlgorithmConfig__integrityProtAlgorithm_eia0_v920
#else
#ifdef EXMIMO_IOT
# define INTEGRITY_ALGORITHM_NONE SecurityAlgorithmConfig__integrityProtAlgorithm_eia2
#else
# define INTEGRITY_ALGORITHM_NONE SecurityAlgorithmConfig__integrityProtAlgorithm_reserved
#endif
#endif
# if defined(ENABLE_ITTI)
/*! \fn uint16_t get_next_ue_initial_id(uint8_t mod_id)
......@@ -174,6 +183,7 @@ static uint8_t get_UE_index_from_s1ap_ids(uint8_t mod_id, uint16_t ue_initial_id
*\return the selected algorithm.
*/
static e_SecurityAlgorithmConfig__cipheringAlgorithm rrc_eNB_select_ciphering(uint16_t algorithms) {
if (algorithms & S1AP_ENCRYPTION_EEA2_MASK) {
return SecurityAlgorithmConfig__cipheringAlgorithm_eea2;
}
......@@ -193,6 +203,7 @@ static e_SecurityAlgorithmConfig__cipheringAlgorithm rrc_eNB_select_ciphering(ui
*\return the selected algorithm.
*/
static e_SecurityAlgorithmConfig__integrityProtAlgorithm rrc_eNB_select_integrity(uint16_t algorithms) {
if (algorithms & S1AP_INTEGRITY_EIA2_MASK) {
return SecurityAlgorithmConfig__integrityProtAlgorithm_eia2;
}
......@@ -234,8 +245,8 @@ static int rrc_eNB_process_security (uint8_t mod_id, uint8_t ue_index, security_
changed = TRUE;
}
LOG_I (RRC, "[eNB %d][UE %d] Selected security algorithms: %x, %x, %s",
mod_id, ue_index, cipheringAlgorithm, integrityProtAlgorithm, changed ? "changed" : "same");
LOG_I (RRC, "[eNB %d][UE %d] Selected security algorithms (%x): %x, %x, %s\n",
mod_id, ue_index, security_capabilities, cipheringAlgorithm, integrityProtAlgorithm, changed ? "changed" : "same");
return changed;