@ -1021,6 +1021,7 @@ void rrc_nr::ue::handle_security_mode_complete(const asn1::rrc_nr::security_mode
parent - > logger . info ( " SecurityModeComplete transaction ID: %d " , msg . rrc_transaction_id ) ;
parent - > logger . info ( " SecurityModeComplete transaction ID: %d " , msg . rrc_transaction_id ) ;
parent - > pdcp - > enable_encryption ( rnti , srb_to_lcid ( srsran : : nr_srb : : srb1 ) ) ;
parent - > pdcp - > enable_encryption ( rnti , srb_to_lcid ( srsran : : nr_srb : : srb1 ) ) ;
send_rrc_reconfiguration ( ) ;
// Note: Skip UE capabilities
// Note: Skip UE capabilities
// Send RRCReconfiguration if necessary
// Send RRCReconfiguration if necessary
@ -1040,50 +1041,57 @@ void rrc_nr::ue::send_rrc_reconfiguration()
ies . radio_bearer_cfg_present =
ies . radio_bearer_cfg_present =
compute_diff_radio_bearer_cfg ( parent - > cfg , radio_bearer_cfg , next_radio_bearer_cfg , ies . radio_bearer_cfg ) ;
compute_diff_radio_bearer_cfg ( parent - > cfg , radio_bearer_cfg , next_radio_bearer_cfg , ies . radio_bearer_cfg ) ;
ies . non_crit_ext_present = true ;
// If no bearer to add/mod/remove, do not include master_cell_group
ies . non_crit_ext . master_cell_group_present = true ;
// Set ies.non_crit_ext_present only if master_cell_group_present = true or
if ( ies . radio_bearer_cfg_present ) {
// Fill masterCellGroup
ies . non_crit_ext . master_cell_group_present = true ;
cell_group_cfg_s master_cell_group ;
master_cell_group . cell_group_id = 0 ;
fill_cellgroup_with_radio_bearer_cfg ( parent - > cfg , ies . radio_bearer_cfg , master_cell_group ) ;
// Pack masterCellGroup into container
// Fill masterCellGroup
srsran : : unique_byte_buffer_t pdu = parent - > pack_into_pdu ( master_cell_group , __FUNCTION__ ) ;
cell_group_cfg_s master_cell_group ;
if ( pdu = = nullptr ) {
master_cell_group . cell_group_id = 0 ;
send_rrc_release ( ) ;
fill_cellgroup_with_radio_bearer_cfg ( parent - > cfg , ies . radio_bearer_cfg , master_cell_group ) ;
return ;
}
ies . non_crit_ext . master_cell_group . resize ( pdu - > N_bytes ) ;
memcpy ( ies . non_crit_ext . master_cell_group . data ( ) , pdu - > data ( ) , pdu - > N_bytes ) ;
if ( logger . debug . enabled ( ) ) {
asn1 : : json_writer js ;
master_cell_group . to_json ( js ) ;
logger . debug ( " Containerized MasterCellGroup: %s " , js . to_string ( ) . c_str ( ) ) ;
}
// Pass stored NAS PDUs
// Pack masterCellGroup into container
ies . non_crit_ext . ded_nas_msg_list_present = true ;
srsran : : unique_byte_buffer_t pdu = parent - > pack_into_pdu ( master_cell_group , __FUNCTION__ ) ;
ies . non_crit_ext . ded_nas_msg_list . resize ( nas_pdu_queue . size ( ) ) ;
if ( pdu = = nullptr ) {
for ( uint32_t i = 0 ; i < nas_pdu_queue . size ( ) ; + + i ) {
send_rrc_release ( ) ;
ies . non_crit_ext . ded_nas_msg_list [ i ] . resize ( nas_pdu_queue [ i ] - > size ( ) ) ;
return ;
memcpy ( ies . non_crit_ext . ded_nas_msg_list [ i ] . data ( ) , nas_pdu_queue [ i ] - > data ( ) , nas_pdu_queue [ i ] - > size ( ) ) ;
}
}
ies . non_crit_ext . master_cell_group . resize ( pdu - > N_bytes ) ;
ies . non_crit_ext . ded_nas_msg_list_present = nas_pdu_queue . size ( ) > 0 ;
memcpy ( ies . non_crit_ext . master_cell_group . data ( ) , pdu - > data ( ) , pdu - > N_bytes ) ;
nas_pdu_queue . clear ( ) ;
if ( logger . debug . enabled ( ) ) {
asn1 : : json_writer js ;
master_cell_group . to_json ( js ) ;
logger . debug ( " Containerized MasterCellGroup: %s " , js . to_string ( ) . c_str ( ) ) ;
}
// Update lower layers
if ( ies . radio_bearer_cfg_present ) {
// add PDCP bearers
update_pdcp_bearers ( ies . radio_bearer_cfg , master_cell_group ) ;
// Update lower layers
// add RLC bearers
if ( ies . radio_bearer_cfg_present ) {
update_rlc_bearers ( master_cell_group ) ;
// add PDCP bearers
update_pdcp_bearers ( ies . radio_bearer_cfg , master_cell_group ) ;
// add RLC bearers
// add MAC bearers
update_rlc_bearers ( master_cell_group ) ;
update_mac ( master_cell_group , false ) ;
}
}
// add MAC bearers
if ( nas_pdu_queue . size ( ) > 0 ) {
update_mac ( master_cell_group , false ) ;
// Pass stored NAS PDUs
ies . non_crit_ext . ded_nas_msg_list_present = true ;
ies . non_crit_ext . ded_nas_msg_list . resize ( nas_pdu_queue . size ( ) ) ;
for ( uint32_t i = 0 ; i < nas_pdu_queue . size ( ) ; + + i ) {
ies . non_crit_ext . ded_nas_msg_list [ i ] . resize ( nas_pdu_queue [ i ] - > size ( ) ) ;
memcpy ( ies . non_crit_ext . ded_nas_msg_list [ i ] . data ( ) , nas_pdu_queue [ i ] - > data ( ) , nas_pdu_queue [ i ] - > size ( ) ) ;
}
nas_pdu_queue . clear ( ) ;
}
}
ies . non_crit_ext_present = ies . non_crit_ext . master_cell_group_present or ies . non_crit_ext . ded_nas_msg_list_present ;
if ( send_dl_dcch ( srsran : : nr_srb : : srb1 , dl_dcch_msg ) ! = SRSRAN_SUCCESS ) {
if ( send_dl_dcch ( srsran : : nr_srb : : srb1 , dl_dcch_msg ) ! = SRSRAN_SUCCESS ) {
send_rrc_release ( ) ;
send_rrc_release ( ) ;
}
}