FIX: Changed EPS bearer id validation

master
ikercosta 2 years ago committed by Justin Tallon
parent 3abf9f8e0b
commit c4d69677aa

@ -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 }; 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_DRB_ID = 11;
const uint32_t MAX_LTE_LCID = 10; // logicalChannelIdentity 3..10 in TS 36.331 v15.3 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_LCID = 99; // random invalid LCID
const uint32_t INVALID_EPS_BEARER_ID = 99; // random invalid eps bearer id 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) constexpr bool is_lte_rb(uint32_t lcid)
{ {
return lcid <= MAX_LTE_LCID; return lcid <= MAX_LTE_LCID;

@ -57,7 +57,7 @@ gtpu_tunnel_manager::ue_bearer_tunnel_list* gtpu_tunnel_manager::find_rnti_tunne
srsran::span<gtpu_tunnel_manager::bearer_teid_pair> srsran::span<gtpu_tunnel_manager::bearer_teid_pair>
gtpu_tunnel_manager::find_rnti_bearer_tunnels(uint16_t rnti, uint32_t eps_bearer_id) 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); logger.warning("Searching for bearer with invalid eps-BearerID=%d", eps_bearer_id);
return {}; return {};
} }
@ -74,7 +74,7 @@ gtpu_tunnel_manager::find_rnti_bearer_tunnels(uint16_t rnti, uint32_t eps_bearer
const gtpu_tunnel* const gtpu_tunnel*
gtpu_tunnel_manager::add_tunnel(uint16_t rnti, uint32_t eps_bearer_id, uint32_t teidout, uint32_t spgw_addr) 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); logger.warning("Adding TEID with invalid eps-BearerID=%d", eps_bearer_id);
return nullptr; return nullptr;
} }

Loading…
Cancel
Save