From c4d69677aa5f97e974fcc97bd3c20530d4634a79 Mon Sep 17 00:00:00 2001 From: ikercosta Date: Fri, 10 Mar 2023 15:48:23 +0100 Subject: [PATCH] FIX: Changed EPS bearer id validation --- lib/include/srsran/common/common_lte.h | 7 +++++++ srsenb/src/stack/upper/gtpu.cc | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/include/srsran/common/common_lte.h b/lib/include/srsran/common/common_lte.h index 5b1ee9cfa..44f324ec2 100644 --- a/lib/include/srsran/common/common_lte.h +++ b/lib/include/srsran/common/common_lte.h @@ -51,9 +51,16 @@ const uint32_t MAX_LTE_SRB_ID = 2; enum class lte_drb { drb1 = 1, drb2, drb3, drb4, drb5, drb6, drb7, drb8, drb9, drb10, drb11, invalid }; const uint32_t MAX_LTE_DRB_ID = 11; const uint32_t MAX_LTE_LCID = 10; // logicalChannelIdentity 3..10 in TS 36.331 v15.3 +const uint32_t MAX_EPS_BEARER_ID = 15; // EPS Bearer ID range [5, 15] in 36 413 +const uint32_t MIN_EPS_BEARER_ID = 5; const uint32_t INVALID_LCID = 99; // random invalid LCID const uint32_t INVALID_EPS_BEARER_ID = 99; // random invalid eps bearer id +constexpr bool is_eps_bearer_id(uint32_t eps_bearer_id) +{ + return eps_bearer_id >= MIN_EPS_BEARER_ID and eps_bearer_id <= MAX_EPS_BEARER_ID; +} + constexpr bool is_lte_rb(uint32_t lcid) { return lcid <= MAX_LTE_LCID; diff --git a/srsenb/src/stack/upper/gtpu.cc b/srsenb/src/stack/upper/gtpu.cc index bca2cf6b4..764e7c55b 100644 --- a/srsenb/src/stack/upper/gtpu.cc +++ b/srsenb/src/stack/upper/gtpu.cc @@ -57,7 +57,7 @@ gtpu_tunnel_manager::ue_bearer_tunnel_list* gtpu_tunnel_manager::find_rnti_tunne srsran::span gtpu_tunnel_manager::find_rnti_bearer_tunnels(uint16_t rnti, uint32_t eps_bearer_id) { - if (not is_lte_rb(eps_bearer_id)) { + if (not is_eps_bearer_id(eps_bearer_id)) { logger.warning("Searching for bearer with invalid eps-BearerID=%d", eps_bearer_id); return {}; } @@ -74,7 +74,7 @@ gtpu_tunnel_manager::find_rnti_bearer_tunnels(uint16_t rnti, uint32_t eps_bearer const gtpu_tunnel* gtpu_tunnel_manager::add_tunnel(uint16_t rnti, uint32_t eps_bearer_id, uint32_t teidout, uint32_t spgw_addr) { - if (not is_lte_rb(eps_bearer_id)) { + if (not is_eps_bearer_id(eps_bearer_id)) { logger.warning("Adding TEID with invalid eps-BearerID=%d", eps_bearer_id); return nullptr; }