fix reestablishment after S1 handover by setting ncc accordingly

master
Francisco Paisana 4 years ago
parent 78a3370396
commit cc469fc7a3

@ -36,9 +36,11 @@ public:
bool set_security_capabilities(const asn1::s1ap::ue_security_cap_s& caps);
void set_security_key(const asn1::fixed_bitstring<256, false, true>& key);
void set_ncc(uint8_t ncc_) { ncc = ncc_; }
asn1::rrc::security_algorithm_cfg_s get_security_algorithm_cfg();
const srslte::as_security_config_t& get_as_sec_cfg() const { return sec_cfg; }
uint8_t get_ncc() const { return ncc; }
bool is_as_sec_cfg_valid() const { return k_enb_present; }
void regenerate_keys_handover(uint32_t new_pci, uint32_t new_dl_earfcn);
@ -52,6 +54,7 @@ private:
asn1::s1ap::ue_security_cap_s security_capabilities = {};
uint8_t k_enb[32] = {}; // Provided by MME
srslte::as_security_config_t sec_cfg = {};
uint8_t ncc = 0;
};
class bearer_cfg_handler

@ -50,7 +50,7 @@ public:
rrc_state_t get_state();
void send_connection_setup();
void send_connection_reest();
void send_connection_reest(uint8_t ncc);
void send_connection_reject();
void send_connection_release();
void send_connection_reest_rej();

@ -1050,6 +1050,7 @@ void rrc::ue::rrc_mobility::handle_ho_req(idle_st& s, const ho_req_rx_ev& ho_req
rrc_conn_recfg_r8_ies_s& recfg_r8 = dl_dcch_msg.msg.c1().rrc_conn_recfg().crit_exts.c1().rrc_conn_recfg_r8();
// Apply new Security Config based on HandoverRequest
// See TS 33.401, Sec. 7.2.8.4.3
recfg_r8.security_cfg_ho_present = true;
recfg_r8.security_cfg_ho.handov_type.set(security_cfg_ho_s::handov_type_c_::types_opts::intra_lte);
recfg_r8.security_cfg_ho.handov_type.intra_lte().security_algorithm_cfg_present = true;
@ -1143,8 +1144,10 @@ bool rrc::ue::rrc_mobility::apply_ho_prep_cfg(const ho_prep_info_r8_ies_s& ho
}
// Regenerate AS Keys
// See TS 33.401, Sec. 7.2.8.4.3
rrc_ue->ue_security_cfg.set_security_capabilities(ho_req_msg.protocol_ies.ue_security_cap.value);
rrc_ue->ue_security_cfg.set_security_key(ho_req_msg.protocol_ies.security_context.value.next_hop_param);
rrc_ue->ue_security_cfg.set_ncc(ho_req_msg.protocol_ies.security_context.value.next_hop_chaining_count);
rrc_ue->ue_security_cfg.regenerate_keys_handover(target_cell_cfg.pci, target_cell_cfg.dl_earfcn);
// Save UE Capabilities

@ -340,7 +340,7 @@ void rrc::ue::handle_rrc_con_reest_req(rrc_conn_reest_request_s* msg)
if (parent->users.count(old_rnti)) {
parent->rrc_log->info("ConnectionReestablishmentRequest for rnti=0x%x. Sending Connection Reestablishment\n",
old_rnti);
send_connection_reest();
send_connection_reest(parent->users[old_rnti]->ue_security_cfg.get_ncc());
// Cancel Handover in Target eNB if on-going
parent->users[old_rnti]->mobility_handler->trigger(rrc_mobility::ho_cancel_ev{});
@ -386,7 +386,7 @@ void rrc::ue::handle_rrc_con_reest_req(rrc_conn_reest_request_s* msg)
return;
}
void rrc::ue::send_connection_reest()
void rrc::ue::send_connection_reest(uint8_t ncc)
{
// Re-Establish SRB1
bearer_list.add_srb(1);
@ -403,6 +403,9 @@ void rrc::ue::send_connection_reest()
fill_rrc_setup_rr_config_dedicated(rr_cfg);
phys_cfg_ded_s* phy_cfg = &rr_cfg->phys_cfg_ded;
// Set NCC
reest.next_hop_chaining_count = ncc;
// Apply ConnectionReest Configuration to MAC scheduler
mac_ctrl->handle_con_reest(reest);

Loading…
Cancel
Save