From 95774e5b714101d2fc9cf615585ebef32755fb40 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Wed, 23 Apr 2014 15:09:55 +0000 Subject: [PATCH] * 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 --- openair-cn/S1AP/Makefile.eNB | 1 - openair-cn/S1AP/s1ap_eNB_default_values.h | 4 +- openair1/ARCH/CBMIMO1/DEVICE_DRIVER/Makefile | 2 +- openair1/SCHED/phy_procedures_lte_eNb.c | 4 +- openair2/ENB_APP/enb_config.c | 36 +++-- openair2/LAYER2/MAC/eNB_scheduler.c | 8 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 11 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 2 +- openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c | 16 +- openair2/LAYER2/RLC/rlc_mac.c | 2 +- openair2/RRC/LITE/rrc_eNB.c | 147 +++++++++++++----- openair2/RRC/LITE/rrc_eNB_S1AP.c | 113 ++++++++++++-- openair2/UTIL/LOG/log.c | 6 +- openair2/UTIL/OSA/osa_stream_eia.c | 5 +- targets/Makefile.common | 5 +- .../GENERIC-LTE-EPC/CONF/enb.centos.nord.conf | 103 ++---------- .../GENERIC-LTE-EPC/CONF/enb.pft.memphis.conf | 3 - .../GENERIC-LTE-EPC/CONF/enb.pft.sud.conf | 32 ++-- .../GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf | 38 ++++- .../PROJECTS/GENERIC-LTE-EPC/start_enb.bash | 2 +- .../start_enb_and_ue_virt.bash | 2 +- .../PROJECTS/GENERIC-LTE-EPC/start_ue.bash | 2 +- targets/RTAI/USER/lte-softmodem.c | 13 +- 23 files changed, 354 insertions(+), 203 deletions(-) diff --git a/openair-cn/S1AP/Makefile.eNB b/openair-cn/S1AP/Makefile.eNB index 8624cb228d..bc8c31265f 100644 --- a/openair-cn/S1AP/Makefile.eNB +++ b/openair-cn/S1AP/Makefile.eNB @@ -50,7 +50,6 @@ CFLAGS = \ -Wall \ -DENB_MODE \ -DENABLE_USE_MME \ - -DEMIT_ASN_DEBUG=1 \ -DUSER_MODE \ -I./MESSAGES \ -I$(OUTDIR) \ diff --git a/openair-cn/S1AP/s1ap_eNB_default_values.h b/openair-cn/S1AP/s1ap_eNB_default_values.h index 11fd0a81c6..cd12994427 100644 --- a/openair-cn/S1AP/s1ap_eNB_default_values.h +++ b/openair-cn/S1AP/s1ap_eNB_default_values.h @@ -1,9 +1,9 @@ #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") diff --git a/openair1/ARCH/CBMIMO1/DEVICE_DRIVER/Makefile b/openair1/ARCH/CBMIMO1/DEVICE_DRIVER/Makefile index 7f885a5523..7b9502ba8a 100755 --- a/openair1/ARCH/CBMIMO1/DEVICE_DRIVER/Makefile +++ b/openair1/ARCH/CBMIMO1/DEVICE_DRIVER/Makefile @@ -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 diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index d2c6209ac5..d090146455 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -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 { diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 696fe88881..ec9e58555f 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -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, diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index c21c204ad6..e54a630d85 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -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); + } } } } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 83e59da9b5..4b2a2a0ece 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -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 */ diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index c14d24d602..cf948f0698 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -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 diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c index afde26ef89..efac38b556 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c @@ -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) diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index 3b9644deb3..06c2543ea0 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -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) { diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 0d9a4e5b1d..ae5b88ead6 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -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); diff --git a/openair2/RRC/LITE/rrc_eNB_S1AP.c b/openair2/RRC/LITE/rrc_eNB_S1AP.c index 37ffb007e6..e976052421 100644 --- a/openair2/RRC/LITE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LITE/rrc_eNB_S1AP.c @@ -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; } @@ -259,10 +270,78 @@ static void process_eNB_security_key (uint8_t mod_id, uint8_t ue_index, uint8_t } ascii_buffer[2 * i] = '\0'; - LOG_I (RRC, "[eNB %d][UE %d] Saved security key %s", mod_id, ue_index, ascii_buffer); + LOG_I (RRC, "[eNB %d][UE %d] Saved security key %s\n", mod_id, ue_index, ascii_buffer); #endif } + +static void rrc_pdcp_config_security(uint8_t enb_mod_idP, uint8_t ue_mod_idP, uint8_t send_security_mode_command ){ + +#if defined(ENABLE_SECURITY) + + + SRB_ToAddModList_t *SRB_configList = eNB_rrc_inst[enb_mod_idP].SRB_configList[ue_mod_idP]; + uint8_t *kRRCenc = NULL; + uint8_t *kRRCint = NULL; + uint8_t *kUPenc = NULL; + pdcp_t *pdcp_p = NULL; + static int print_keys= 1; + /* Derive the keys from kenb */ + if (SRB_configList != NULL) { + derive_key_up_enc(eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[ue_mod_idP], + eNB_rrc_inst[enb_mod_idP].kenb[ue_mod_idP], &kUPenc); + } + + derive_key_rrc_enc(eNB_rrc_inst[enb_mod_idP].ciphering_algorithm[ue_mod_idP], + 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); + +#define DEBUG_SECURITY 1 + +#if defined (DEBUG_SECURITY) +#define msg printf + if (print_keys ==1 ) { + print_keys =0; + int i; + msg("\nKeNB:"); + for(i = 0; i < 32; i++) + msg("%02x", eNB_rrc_inst[enb_mod_idP].kenb[ue_mod_idP][i]); + msg("\n"); + + msg("\nKRRCenc:"); + for(i = 0; i < 32; i++) + msg("%02x", kRRCenc[i]); + msg("\n"); + + msg("\nKRRCint:"); + for(i = 0; i < 32; i++) + msg("%02x", kRRCint[i]); + msg("\n"); + + } +#endif //DEBUG_SECURITY + + + pdcp_p = &pdcp_array_srb_eNB[enb_mod_idP][ue_mod_idP][DCCH-1]; + + pdcp_config_set_security(pdcp_p, + enb_mod_idP, + ue_mod_idP, + 0, + ENB_FLAG_YES, + DCCH, + DCCH+2, + (send_security_mode_command == TRUE) ? + 0 | (eNB_rrc_inst[enb_mod_idP].integrity_algorithm[ue_mod_idP] << 4) : + (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); +#endif +} + /*------------------------------------------------------------------------------*/ void rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(uint8_t mod_id, uint8_t ue_index) { eNB_RRC_UE_INFO *UE_info = &eNB_rrc_inst[mod_id].Info.UE[ue_index]; @@ -508,11 +587,18 @@ int rrc_eNB_process_S1AP_DOWNLINK_NAS(MessageDef *msg_p, const char *msg_name, i if (eNB_rrc_inst[instance].Info.UE[ue_index].eNB_ue_s1ap_id == 0) { eNB_rrc_inst[instance].Info.UE[ue_index].eNB_ue_s1ap_id = S1AP_DOWNLINK_NAS (msg_p).eNB_ue_s1ap_id; } - /* Create message for PDCP (DLInformationTransfer_t) */ + + /* Create message for PDCP (DLInformationTransfer_t) */ length = do_DLInformationTransfer (instance, &buffer, rrc_eNB_get_next_transaction_identifier (instance), S1AP_DOWNLINK_NAS (msg_p).nas_pdu.length, S1AP_DOWNLINK_NAS (msg_p).nas_pdu.buffer); +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"RRC DL Information Transfer\n"); + for (i = 0; i < length; i++) + LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + LOG_F(RRC,"\n"); +#endif /* Transfer data to PDCP */ pdcp_rrc_data_req (instance, ue_index, 0 /* TODO put frame number ! */, 1, DCCH, *rrc_eNB_mui++, 0, length, buffer, 1); @@ -590,15 +676,22 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char process_eNB_security_key (instance, ue_index, S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).security_key); { - uint8_t send_security_mode_command = TRUE; - - if ((eNB_rrc_inst[instance].ciphering_algorithm[ue_index] == SecurityAlgorithmConfig__cipheringAlgorithm_eea0) + uint8_t send_security_mode_command = TRUE; + +#ifndef EXMIMO_IOT + if ((eNB_rrc_inst[instance].ciphering_algorithm[ue_index] == SecurityAlgorithmConfig__cipheringAlgorithm_eea0) && (eNB_rrc_inst[instance].integrity_algorithm[ue_index] == INTEGRITY_ALGORITHM_NONE)) { send_security_mode_command = FALSE; } - +#endif + rrc_pdcp_config_security(instance, ue_index,send_security_mode_command); + if (send_security_mode_command) { - rrc_eNB_generate_SecurityModeCommand (instance, 0 /* TODO put frame number ! */, ue_index); + + rrc_eNB_generate_SecurityModeCommand (instance, 0 /* TODO put frame number ! */, ue_index); + send_security_mode_command = FALSE; + // apply ciphering after RRC security command mode + rrc_pdcp_config_security(instance, ue_index,send_security_mode_command); } else { rrc_eNB_generate_UECapabilityEnquiry (instance, 0 /* TODO put frame number ! */, ue_index); diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c index 25dadb47f2..1874c9d6e1 100755 --- a/openair2/UTIL/LOG/log.c +++ b/openair2/UTIL/LOG/log.c @@ -153,7 +153,7 @@ int logInit (void) g_log->log_component[RRC].flag = LOG_MED; g_log->log_component[RRC].interval = 1; g_log->log_component[RRC].fd = 0; - g_log->log_component[RRC].filelog = 0; + g_log->log_component[RRC].filelog = 1; g_log->log_component[RRC].filelog_name = "/tmp/rrc.log"; g_log->log_component[NAS].name = "NAS"; @@ -627,10 +627,12 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, // do not apply filtering for LOG_F // only log messages which are enabled and are below the global log level and component's level threshold - if ((level != LOG_FILE) && + if ((level != LOG_FILE) && ((level > c->level) && (level > g_log->level))) { + /* if ((level != LOG_FILE) && ((level > c->level) || (level > g_log->level) || ( c->level > g_log->level))) { + */ return; } diff --git a/openair2/UTIL/OSA/osa_stream_eia.c b/openair2/UTIL/OSA/osa_stream_eia.c index 820086cbb2..70a281cbd1 100644 --- a/openair2/UTIL/OSA/osa_stream_eia.c +++ b/openair2/UTIL/OSA/osa_stream_eia.c @@ -61,7 +61,7 @@ int stream_compute_integrity_eia2(stream_cipher_t *stream_cipher, uint8_t out[4] stream_cipher->blength, zero_bit); for (i = 0; i < sizeof(m); i++) index += sprintf(&payload[index], "0x%02x ", m[i]); - LOG_T(OSA, "Payload: %s\n", payload); + LOG_D(OSA, "Payload: %s\n", payload); } #endif @@ -86,7 +86,8 @@ int stream_compute_integrity(uint8_t algorithm, stream_cipher_t *stream_cipher, LOG_E(OSA, "SNOW-3G algorithms are currently not implemented for integrity\n"); return -1; } else if (algorithm == EIA2_128_ALG_ID) { - return stream_compute_integrity_eia2(stream_cipher, out); + LOG_D(OSA, "EIA2 algorithm applied for integrity\n"); + return stream_compute_integrity_eia2(stream_cipher, out); } LOG_E(OSA, "Provided integrity algorithm is currently not supported = %u\n", algorithm); return -1; diff --git a/targets/Makefile.common b/targets/Makefile.common index ee5c9946b4..bbdffca917 100644 --- a/targets/Makefile.common +++ b/targets/Makefile.common @@ -67,7 +67,8 @@ LIBS += $(UDP_OBJ_DIR)/libudp.a $(GTPV1U_OBJ_DIR)/libgtpv1u.a #LG SHARED_DEPENDENCIES += $(UE_NAS_OBJ_DIR)/libuenas.a $(X2AP_OBJ_DIR)/libx2ap.a $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a $(UDP_OBJ_DIR)/libudp.a $(GTPV1U_OBJ_DIR)/libgtpv1u.a SHARED_DEPENDENCIES += $(UE_NAS_OBJ_DIR)/libuenas.a $(S1AP_OBJ_DIR)/libs1ap.a $(SCTP_OBJ_DIR)/libsctp.a $(UDP_OBJ_DIR)/libudp.a $(GTPV1U_OBJ_DIR)/libgtpv1u.a -COMMON_CFLAGS += -DLOG_NO_THREAD -DEMIT_ASN_DEBUG +COMMON_CFLAGS += -DLOG_NO_THREAD +#-DEMIT_ASN_DEBUG openair_cn_available = $(shell if [ -d "$(UE_NAS_DIR)" ]; then echo "0" ; else echo "1" ; fi ) ifeq ($(openair_cn_available), 0) @@ -198,4 +199,4 @@ common-cleanall: @if [ -d $(SCTP_OBJ_DIR) ]; then $(MAKE) -C $(SCTP_DIR) -f Makefile.eNB cleanall OUTDIR=$(SCTP_OBJ_DIR); fi @if [ -d $(UDP_OBJ_DIR) ]; then $(MAKE) -C $(UDP_DIR) -f Makefile.eNB cleanall OUTDIR=$(UDP_OBJ_DIR); fi @if [ -d $(GTPV1U_OBJ_DIR) ]; then $(MAKE) -C $(GTPV1U_DIR) -f Makefile.eNB cleanall OUTDIR=$(GTPV1U_OBJ_DIR); fi - \ No newline at end of file + diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.centos.nord.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.centos.nord.conf index f015119353..01754227d3 100755 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.centos.nord.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.centos.nord.conf @@ -1,5 +1,6 @@ -//Active_eNBs = ( "eNB_Eurecom_0", "eNB_Eurecom_1", "eNB_Eurecom_2", "eNB_Eurecom_3"); Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; eNBs = ( @@ -23,102 +24,28 @@ eNBs = default_paging_drx = "PAGING_DRX_256"; ////////// Physical parameters: - frame_type = "FDD"; + frame_type = "FDD"; prefix_type = "NORMAL"; - downlink_frequency = 2680000000; + eutra_band = 7; + downlink_frequency = 2680000000L; uplink_frequency_offset = -120000000; ////////// MME parameters: mme_ip_address = ( { ipv4 = "192.168.13.11"; - ipv6 = "2192:168:30::17"; + ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; - }, - { ipv4 = "192.168.13.11"; - ipv6 = "2192:168:30::18"; - active = "no"; - preference = "ipv4"; } ); - }, - { - ////////// Identification parameters: - cell_type = "CELL_MACRO_ENB"; - - eNB_name = "eNB_Eurecom_1"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; - - mobile_country_code = "208"; - - mobile_network_code = "92"; - ////////// Channel parameters: - // Default Paging DRX of the eNB as defined in TS 36.304 - default_paging_drx = "PAGING_DRX_256"; - - ////////// Physical parameters: - frame_type = "FDD"; - prefix_type = "NORMAL"; - downlink_frequency = 2680000000; - uplink_frequency_offset = -120000000; - - ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.170"; - ipv6 = "2192:168:30::17"; - active = "yes"; - preference = "ipv4"; - }, - { ipv4 = "192.168.12.86"; - ipv6 = "2192:168:30::18"; - active = "no"; - preference = "ipv4"; - } - ); - }, - { - cell_type = "CELL_MACRO_ENB"; - - eNB_name = "eNB_Eurecom_2"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; - - mobile_country_code = "208"; - - mobile_network_code = "92"; - - // Default Paging DRX of the eNB as defined in TS 36.304 - default_paging_drx = "PAGING_DRX_256"; - - mme_ip_address = ( { ipv4 = "192.168.12.170"; - ipv6 = "2192:168:30::17"; - active = "yes"; - preference = "ipv4"; - } - ); - }, - { - cell_type = "CELL_MACRO_ENB"; - - eNB_name = "eNB_Eurecom_3"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; - - mobile_country_code = "208"; - - mobile_network_code = "92"; - - // Default Paging DRX of the eNB as defined in TS 36.304 - default_paging_drx = "PAGING_DRX_256"; - - mme_ip_address = ( { ipv4 = "192.168.12.170"; - ipv6 = "2192:168:30::17"; - active = "yes"; - preference = "ipv4"; - } - ); + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.13.10/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.13.10/24"; + }; + } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.pft.memphis.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.pft.memphis.conf index 17340b6123..a9a94cb2e4 100755 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.pft.memphis.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.pft.memphis.conf @@ -3,9 +3,6 @@ Active_eNBs = ( "eNB_Eurecom_0"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; - - - eNBs = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.pft.sud.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.pft.sud.conf index 646c29ac36..ba95ccf1a9 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.pft.sud.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.pft.sud.conf @@ -1,5 +1,5 @@ -Active_eNBs = ( "eNB_Eurecom_0", "eNB_Eurecom_1", "eNB_Eurecom_2", "eNB_Eurecom_3"); -//Active_eNBs = ( "eNB_Eurecom_0"); +//Active_eNBs = ( "eNB_Eurecom_0", "eNB_Eurecom_1", "eNB_Eurecom_2", "eNB_Eurecom_3"); +Active_eNBs = ( "eNB_Eurecom_0"); eNBs = ( @@ -12,11 +12,11 @@ eNBs = eNB_name = "eNB_Eurecom_0"; // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = 1; + tracking_area_code = "1"; - mobile_country_code = 208; + mobile_country_code = "208"; - mobile_network_code = 92; + mobile_network_code = "92"; ////////// Channel parameters: // Default Paging DRX of the eNB as defined in TS 36.304 @@ -48,12 +48,12 @@ eNBs = eNB_name = "eNB_Eurecom_1"; - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = 1; + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; - mobile_country_code = 208; + mobile_country_code = "208"; - mobile_network_code = 92; + mobile_network_code = "92"; ////////// Channel parameters: // Default Paging DRX of the eNB as defined in TS 36.304 @@ -85,12 +85,11 @@ eNBs = eNB_name = "eNB_Eurecom_2"; // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = 1; + tracking_area_code = "1"; - mobile_country_code = 208; + mobile_country_code = "208"; - // EXMIMO_IOT mobile_network_code = 92; - mobile_network_code = 92; + mobile_network_code = "92"; // Default Paging DRX of the eNB as defined in TS 36.304 default_paging_drx = "PAGING_DRX_256"; @@ -108,12 +107,11 @@ eNBs = eNB_name = "eNB_Eurecom_3"; // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = 1; + tracking_area_code = "1"; - mobile_country_code = 208; + mobile_country_code = "208"; - // EXMIMO_IOT mobile_network_code = 92; - mobile_network_code = 92; + mobile_network_code = "92"; // Default Paging DRX of the eNB as defined in TS 36.304 default_paging_drx = "PAGING_DRX_256"; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf index daafd72223..1998d65ca5 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.sfr.sud.conf @@ -1,5 +1,6 @@ Active_eNBs = ( "eNB_Eurecom_0"); - +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; eNBs = ( { @@ -42,6 +43,16 @@ eNBs = preference = "ipv4"; } ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.31/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.31/24"; + }; + }, { ////////// Identification parameters: @@ -79,6 +90,14 @@ eNBs = preference = "ipv4"; } ); + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.31/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.31/24"; + }; }, { ////////// Identification parameters: @@ -116,6 +135,14 @@ eNBs = preference = "ipv4"; } ); + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.31/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.31/24"; + }; }, { ////////// Identification parameters: @@ -142,5 +169,14 @@ eNBs = active = "yes"; preference = "ipv4"; }; + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.31/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.31/24"; + }; + } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/start_enb.bash b/targets/PROJECTS/GENERIC-LTE-EPC/start_enb.bash index 90a080234a..72aecee003 100755 --- a/targets/PROJECTS/GENERIC-LTE-EPC/start_enb.bash +++ b/targets/PROJECTS/GENERIC-LTE-EPC/start_enb.bash @@ -95,7 +95,7 @@ # Parameters ########################################################### declare EMULATION_DEV_INTERFACE="eth2" -declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim DEBUG=1 ENABLE_ITTI=1 USE_MME=R10 LINK_PDCP_TO_GTPV1U=1 NAS=1 Rel10=1 ASN_DEBUG=1 EMIT_ASN_DEBUG=1" +declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim DEBUG=1 ENABLE_ITTI=1 USE_MME=R10 LINK_PDCP_TO_GTPV1U=1 NAS=1 Rel10=1 " ########################################################### THIS_SCRIPT_PATH=$(dirname $(readlink -f $0)) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/start_enb_and_ue_virt.bash b/targets/PROJECTS/GENERIC-LTE-EPC/start_enb_and_ue_virt.bash index c1941df941..44a4ef7f9f 100755 --- a/targets/PROJECTS/GENERIC-LTE-EPC/start_enb_and_ue_virt.bash +++ b/targets/PROJECTS/GENERIC-LTE-EPC/start_enb_and_ue_virt.bash @@ -93,7 +93,7 @@ ########################################################### # Parameters ########################################################### -declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim DEBUG=1 ENABLE_ITTI=1 USE_MME=R10 LINK_PDCP_TO_GTPV1U=1 NAS=1 Rel10=1 ASN_DEBUG=1 EMIT_ASN_DEBUG=1" +declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim DEBUG=1 ENABLE_ITTI=1 USE_MME=R10 LINK_PDCP_TO_GTPV1U=1 NAS=1 Rel10=1" declare MAKE_IP_DRIVER_TARGET="ue_ip.ko" declare IP_DRIVER_NAME="ue_ip" declare LTEIF="oip1" diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/start_ue.bash b/targets/PROJECTS/GENERIC-LTE-EPC/start_ue.bash index 2b9c7580a6..6d896baa5f 100755 --- a/targets/PROJECTS/GENERIC-LTE-EPC/start_ue.bash +++ b/targets/PROJECTS/GENERIC-LTE-EPC/start_ue.bash @@ -94,7 +94,7 @@ # Parameters ########################################################### declare -x EMULATION_DEV_INTERFACE="eth1" -declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim DEBUG=1 ENABLE_ITTI=1 USE_MME=R10 NAS=1 Rel10=1 ASN_DEBUG=1 EMIT_ASN_DEBUG=1" +declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim DEBUG=1 ENABLE_ITTI=1 USE_MME=R10 NAS=1 Rel10=1" declare MAKE_IP_DRIVER_TARGET="ue_ip.ko" declare IP_DRIVER_NAME="ue_ip" declare LTEIF="oip1" diff --git a/targets/RTAI/USER/lte-softmodem.c b/targets/RTAI/USER/lte-softmodem.c index ecd6ada6a6..1df2cb3ebb 100644 --- a/targets/RTAI/USER/lte-softmodem.c +++ b/targets/RTAI/USER/lte-softmodem.c @@ -201,7 +201,7 @@ static char UE_flag=0; static uint8_t eNB_id=0,UE_id=0; uint32_t carrier_freq[4] = {1907600000,1907600000,1907600000,1907600000}; /* For UE! */ -static uint32_t downlink_frequency[4] = {1907600000,1907600000,1907600000,1907600000}; +static uint32_t downlink_frequency[4] = {1907600000,1907600000,1907600000,1907600000}; static int32_t uplink_frequency_offset[4]= {-120000000,-120000000,-120000000,-120000000}; static char *conf_config_file_name = NULL; @@ -569,6 +569,7 @@ void *l2l1_task(void *arg) switch (ITTI_MSG_ID(message_p)) { case INITIALIZE_MESSAGE: /* Start eNB thread */ + LOG_D(EMU, "L2L1 TASK received %s\n", ITTI_MSG_NAME(message_p)); start_eNB = 1; break; @@ -1281,6 +1282,7 @@ static void get_options (int argc, char **argv) frame_parms->tdd_config_S = enb_properties->properties[0]->tdd_config_s; for (i = 0 ; i < (sizeof(downlink_frequency) / sizeof (downlink_frequency[0])); i++) { downlink_frequency[i] = enb_properties->properties[0]->downlink_frequency; + printf("Downlink frequency set to %u\n", downlink_frequency[i]); uplink_frequency_offset[i] = enb_properties->properties[0]->uplink_frequency_offset; } } @@ -1367,15 +1369,18 @@ int main(int argc, char **argv) { #endif set_comp_log(MAC, LOG_INFO, LOG_HIGH, 1); set_comp_log(RLC, LOG_INFO, LOG_HIGH, 1); - set_comp_log(PDCP, LOG_INFO, LOG_HIGH, 1); + set_comp_log(PDCP, LOG_DEBUG, LOG_HIGH, 1); set_comp_log(OTG, LOG_INFO, LOG_HIGH, 1); set_comp_log(RRC, LOG_INFO, LOG_HIGH, 1); #if defined(ENABLE_ITTI) set_comp_log(EMU, LOG_INFO, LOG_MED, 1); # if defined(ENABLE_USE_MME) - set_comp_log(S1AP, LOG_INFO, LOG_HIGH, 1); + set_comp_log(S1AP, LOG_DEBUG, LOG_HIGH, 1); set_comp_log(SCTP, LOG_INFO, LOG_HIGH, 1); # endif +#if defined(ENABLE_SECURITY) + set_comp_log(OSA, LOG_DEBUG, LOG_HIGH, 1); +#endif #endif set_comp_log(ENB_APP, LOG_INFO, LOG_HIGH, 1);; } @@ -1565,7 +1570,7 @@ int main(int argc, char **argv) { NB_INST=1; openair_daq_vars.ue_dl_rb_alloc=0x1fff; - openair_daq_vars.target_ue_dl_mcs=20; + openair_daq_vars.target_ue_dl_mcs=16; openair_daq_vars.ue_ul_nb_rb=6; openair_daq_vars.target_ue_ul_mcs=6; -- GitLab