From c9478a43064cf45015a172a82b53bf45fc4fcda2 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Thu, 16 Sep 2021 11:54:25 +0200 Subject: [PATCH] enb,erab: fix error handling when setting up ERABs when handling ERAB setup requests from MME, don't add the ERAB before all checks have been performed, otherwise the ERAB needs to be removed again. Since this was not the case, invalid NAS PDUs have been transmitted. Also raise error level for some events to error since the eNB misses a config or is mal-configured and cant recover from that. --- srsenb/src/stack/rrc/rrc_bearer_cfg.cc | 26 ++++++++++++++------------ srsenb/src/stack/rrc/rrc_ue.cc | 2 ++ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/srsenb/src/stack/rrc/rrc_bearer_cfg.cc b/srsenb/src/stack/rrc/rrc_bearer_cfg.cc index c300ba9ac..88807add3 100644 --- a/srsenb/src/stack/rrc/rrc_bearer_cfg.cc +++ b/srsenb/src/stack/rrc/rrc_bearer_cfg.cc @@ -258,19 +258,14 @@ int bearer_cfg_handler::add_erab(uint8_t } const rrc_cfg_qci_t& qci_cfg = qci_it->second; - erabs[erab_id].id = erab_id; - erabs[erab_id].lcid = lcid; - erabs[erab_id].qos_params = qos; - erabs[erab_id].address = addr; - erabs[erab_id].teid_out = teid_out; - + // perform checks on QCI config if (addr.length() > 32) { logger->error("Only addresses with length <= 32 are supported"); cause.set_radio_network().value = asn1::s1ap::cause_radio_network_opts::invalid_qos_combination; return SRSRAN_ERROR; } if (qos.gbr_qos_info_present and not qci_cfg.configured) { - logger->warning("Provided E-RAB id=%d QoS not supported", erab_id); + logger->error("Provided E-RAB id=%d QoS not supported", erab_id); cause.set_radio_network().value = asn1::s1ap::cause_radio_network_opts::invalid_qos_combination; return SRSRAN_ERROR; } @@ -280,21 +275,28 @@ int bearer_cfg_handler::add_erab(uint8_t int16_t pbr_kbps = qci_cfg.lc_cfg.prioritised_bit_rate.to_number(); uint64_t pbr = pbr_kbps < 0 ? std::numeric_limits::max() : pbr_kbps * 1000u; if (req_bitrate > pbr) { - logger->warning("Provided E-RAB id=%d QoS not supported (guaranteed bitrates)", erab_id); + logger->error("Provided E-RAB id=%d QoS not supported (guaranteed bitrates)", erab_id); cause.set_radio_network().value = asn1::s1ap::cause_radio_network_opts::invalid_qos_combination; return SRSRAN_ERROR; } } if (qos.alloc_retention_prio.pre_emption_cap.value == asn1::s1ap::pre_emption_cap_opts::may_trigger_pre_emption and qos.alloc_retention_prio.prio_level < qci_cfg.lc_cfg.prio) { - logger->warning("Provided E-RAB id=%d QoS not supported (priority %d < %d)", - erab_id, - qos.alloc_retention_prio.prio_level, - qci_cfg.lc_cfg.prio); + logger->error("Provided E-RAB id=%d QoS not supported (priority %d < %d)", + erab_id, + qos.alloc_retention_prio.prio_level, + qci_cfg.lc_cfg.prio); cause.set_radio_network().value = asn1::s1ap::cause_radio_network_opts::invalid_qos_combination; return SRSRAN_ERROR; } + // Consider ERAB as accepted + erabs[erab_id].id = erab_id; + erabs[erab_id].lcid = lcid; + erabs[erab_id].qos_params = qos; + erabs[erab_id].address = addr; + erabs[erab_id].teid_out = teid_out; + if (not nas_pdu.empty()) { erab_info_list[erab_id].assign(nas_pdu.begin(), nas_pdu.end()); logger->info( diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index b6510c7e7..059d0f288 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -1163,11 +1163,13 @@ int rrc::ue::setup_erab(uint16_t erab_ return SRSRAN_ERROR; } if (bearer_list.add_erab(erab_id, qos_params, addr, gtpu_teid_out, nas_pdu, cause) != SRSRAN_SUCCESS) { + parent->logger.error("Couldn't add E-RAB id=%d for rnti=0x%x", erab_id, rnti); return SRSRAN_ERROR; } if (bearer_list.add_gtpu_bearer(erab_id) != SRSRAN_SUCCESS) { cause.set_radio_network().value = asn1::s1ap::cause_radio_network_opts::radio_res_not_available; bearer_list.release_erab(erab_id); + parent->logger.error("Couldn't add E-RAB id=%d for rnti=0x%x", erab_id, rnti); return SRSRAN_ERROR; } return SRSRAN_SUCCESS;