mgw_fsm: Add some OSMO_ASSERT() to ensure only CS maps passed

The mgw_fsm only supports CS RABs in the CS domain; let's add some
ASSERTs to make sure the impossible doesn't happen.

Change-Id: I264c4b3da17b6f59ebcdd02031318402a483041a
This commit is contained in:
Harald Welte 2024-03-08 15:45:10 +01:00
parent 5a2cf382ef
commit ffae71bc14
1 changed files with 7 additions and 0 deletions

View File

@ -807,6 +807,8 @@ int handle_cs_rab_ass_req(struct hnbgw_context_map *map, struct msgb *ranap_msg,
struct mgw_fsm_priv *mgw_fsm_priv;
char fsm_name[255];
OSMO_ASSERT(!map->is_ps);
/* Initialize FSM if not done yet */
if (!initialized) {
OSMO_ASSERT(osmo_fsm_register(&mgw_fsm) == 0);
@ -878,6 +880,7 @@ int mgw_fsm_handle_cs_rab_ass_resp(struct hnbgw_context_map *map, struct msgb *r
struct mgw_fsm_priv *mgw_fsm_priv;
OSMO_ASSERT(ranap_msg);
OSMO_ASSERT(!map->is_ps);
if (!map->mgw_fi) {
/* NOTE: This situation is a corner-case. We may end up here when the co-located MGW caused a problem
@ -916,6 +919,8 @@ int mgw_fsm_handle_cs_rab_ass_resp(struct hnbgw_context_map *map, struct msgb *r
* \returns 0 on success; negative on error. */
int mgw_fsm_release(struct hnbgw_context_map *map)
{
OSMO_ASSERT(!map->is_ps);
if (!map->mgw_fi)
return -EINVAL;
@ -930,6 +935,8 @@ uint64_t mgw_fsm_get_elapsed_ms(struct hnbgw_context_map *map, const struct time
struct timespec elapsed;
uint64_t elapsed_ms;
OSMO_ASSERT(!map->is_ps);
if (!map->mgw_fi)
return 0;