pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/42129?usp=email )
Change subject: Integrate mgw/mgcp failures more tightly into context_map fsm ......................................................................
Integrate mgw/mgcp failures more tightly into context_map fsm
Similar to what we already do in RAN/CN link lost. As a result, we now trigger RLSD instead of Iu RANAP Release Req, which adequates better to the level where hnbgw is espected to operate.
Change-Id: Ief051e1384d2282708302dc1756454d8f88a6fae --- M include/osmocom/hnbgw/context_map.h M src/osmo-hnbgw/context_map.c M src/osmo-hnbgw/context_map_sccp.c M src/osmo-hnbgw/mgw_fsm.c 4 files changed, 26 insertions(+), 19 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved osmith: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve
diff --git a/include/osmocom/hnbgw/context_map.h b/include/osmocom/hnbgw/context_map.h index 55743ed..ea12462 100644 --- a/include/osmocom/hnbgw/context_map.h +++ b/include/osmocom/hnbgw/context_map.h @@ -91,6 +91,9 @@ * context map. * Parameter: no parameter, NULL. */ MAP_SCCP_EV_CN_LINK_LOST, + /* The MGCP link can no longer work, for example it received an unexpected answer from the MGW. + * Parameter: no parameter, NULL. */ + MAP_SCCP_EV_MGCP_LINK_LOST, };
/* For context_map_get_state(), to combine the RUA and SCCP states, for VTY reporting only. */ @@ -243,6 +246,7 @@ bool map_rua_is_active(struct hnbgw_context_map *map); bool map_sccp_is_active(struct hnbgw_context_map *map); void context_map_cnlink_lost(struct hnbgw_context_map *map); +void context_map_mgcp_link_lost(struct hnbgw_context_map *map); void context_map_free(struct hnbgw_context_map *map);
unsigned int msg_has_l2_data(const struct msgb *msg); diff --git a/src/osmo-hnbgw/context_map.c b/src/osmo-hnbgw/context_map.c index 35a0fef..59029d7 100644 --- a/src/osmo-hnbgw/context_map.c +++ b/src/osmo-hnbgw/context_map.c @@ -190,6 +190,11 @@ map_sccp_dispatch(map, MAP_SCCP_EV_CN_LINK_LOST, NULL); }
+void context_map_mgcp_link_lost(struct hnbgw_context_map *map) +{ + map_sccp_dispatch(map, MAP_SCCP_EV_MGCP_LINK_LOST, NULL); +} + void context_map_free(struct hnbgw_context_map *map) { /* guard against FSM termination infinitely looping back here */ diff --git a/src/osmo-hnbgw/context_map_sccp.c b/src/osmo-hnbgw/context_map_sccp.c index f060ad9..e10d313 100644 --- a/src/osmo-hnbgw/context_map_sccp.c +++ b/src/osmo-hnbgw/context_map_sccp.c @@ -50,6 +50,7 @@ OSMO_VALUE_STRING(MAP_SCCP_EV_RX_RELEASED), OSMO_VALUE_STRING(MAP_SCCP_EV_USER_ABORT), OSMO_VALUE_STRING(MAP_SCCP_EV_CN_LINK_LOST), + OSMO_VALUE_STRING(MAP_SCCP_EV_MGCP_LINK_LOST), {} };
@@ -215,6 +216,7 @@ case MAP_SCCP_EV_RAN_LINK_LOST: case MAP_SCCP_EV_USER_ABORT: case MAP_SCCP_EV_CN_LINK_LOST: + case MAP_SCCP_EV_MGCP_LINK_LOST: map_sccp_fsm_state_chg(MAP_SCCP_ST_DISCONNECTED); return;
@@ -260,6 +262,7 @@ case MAP_SCCP_EV_RAN_LINK_LOST: case MAP_SCCP_EV_USER_ABORT: case MAP_SCCP_EV_CN_LINK_LOST: + case MAP_SCCP_EV_MGCP_LINK_LOST: map->please_disconnect = true; return;
@@ -347,6 +350,8 @@ /* The user is asking for disconnection, so there is no Iu Release in progress. Disconnect now. */ case MAP_SCCP_EV_CN_LINK_LOST: /* The CN peer has sent a RANAP RESET, so the old link that this map ran on is lost */ + case MAP_SCCP_EV_MGCP_LINK_LOST: + /* The MGW failed somehow, we cannot continue */ tx_sccp_rlsd(fi); map_sccp_fsm_state_chg(MAP_SCCP_ST_DISCONNECTED); return; @@ -418,6 +423,7 @@ case MAP_SCCP_EV_RAN_LINK_LOST: case MAP_SCCP_EV_USER_ABORT: case MAP_SCCP_EV_CN_LINK_LOST: + case MAP_SCCP_EV_MGCP_LINK_LOST: case MAP_SCCP_EV_RAN_DISC: /* Stop waiting for RLSD, send RLSD now. */ tx_sccp_rlsd(fi); @@ -498,6 +504,7 @@ | S(MAP_SCCP_EV_RX_RELEASED) | S(MAP_SCCP_EV_USER_ABORT) | S(MAP_SCCP_EV_CN_LINK_LOST) + | S(MAP_SCCP_EV_MGCP_LINK_LOST) , .out_state_mask = 0 | S(MAP_SCCP_ST_INIT) @@ -516,6 +523,7 @@ | S(MAP_SCCP_EV_RX_RELEASED) | S(MAP_SCCP_EV_USER_ABORT) | S(MAP_SCCP_EV_CN_LINK_LOST) + | S(MAP_SCCP_EV_MGCP_LINK_LOST) , .out_state_mask = 0 | S(MAP_SCCP_ST_CONNECTED) @@ -534,6 +542,7 @@ | S(MAP_SCCP_EV_RX_CONNECTION_CONFIRM) | S(MAP_SCCP_EV_USER_ABORT) | S(MAP_SCCP_EV_CN_LINK_LOST) + | S(MAP_SCCP_EV_MGCP_LINK_LOST) , .out_state_mask = 0 | S(MAP_SCCP_ST_WAIT_RLSD) @@ -553,6 +562,7 @@ | S(MAP_SCCP_EV_RX_CONNECTION_CONFIRM) | S(MAP_SCCP_EV_USER_ABORT) | S(MAP_SCCP_EV_CN_LINK_LOST) + | S(MAP_SCCP_EV_MGCP_LINK_LOST) , .out_state_mask = 0 | S(MAP_SCCP_ST_DISCONNECTED) @@ -568,6 +578,7 @@ | S(MAP_SCCP_EV_RAN_LINK_LOST) | S(MAP_SCCP_EV_USER_ABORT) | S(MAP_SCCP_EV_CN_LINK_LOST) + | S(MAP_SCCP_EV_MGCP_LINK_LOST) , .onenter = map_sccp_disconnected_onenter, .action = map_sccp_disconnected_action, diff --git a/src/osmo-hnbgw/mgw_fsm.c b/src/osmo-hnbgw/mgw_fsm.c index 3d230c6..c9d6463 100644 --- a/src/osmo-hnbgw/mgw_fsm.c +++ b/src/osmo-hnbgw/mgw_fsm.c @@ -51,22 +51,6 @@ * context). This simplification was made because usually a voice call will require only one RAB at a time. An exception * may be corner cases like video calls, which we do not support at the moment. */
-/* Send Iu Release Request, this is done in erroneous cases from which we cannot recover */ -static void tx_release_req(struct hnbgw_context_map *map) -{ - struct msgb *msg; - static const struct RANAP_Cause cause = { - .present = RANAP_Cause_PR_transmissionNetwork, - .choice.transmissionNetwork = - RANAP_CauseTransmissionNetwork_iu_transport_connection_failed_to_establish, - }; - - msg = ranap_new_msg_iu_rel_req(&cause); - msg->l2h = msg->data; - talloc_steal(OTC_SELECT, msg); - map_sccp_dispatch(map, MAP_SCCP_EV_TX_DATA_REQUEST, msg); -} - #define S(x) (1 << (x))
extern int asn1_xer_print; @@ -571,8 +555,11 @@ static void mgw_fsm_failure_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) { struct mgw_fsm_priv *mgw_fsm_priv = fi->priv; - tx_release_req(mgw_fsm_priv->map); + struct hnbgw_context_map *map = mgw_fsm_priv->map; + /* terminate map->mgw_fi before communicating the loss, + * to avoid it trying to access while terminating: */ osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL); + context_map_mgcp_link_lost(map); }
static void mgw_fsm_allstate_action(struct osmo_fsm_inst *fi, uint32_t event, void *data) @@ -849,7 +836,7 @@ LOG_MAP(map, DMGW, LOGL_ERROR, "%s() RAB-AssignmentRequest with more than one RAB assignment -- abort!\n", __func__); - tx_release_req(map); + context_map_mgcp_link_lost(map); return -1; }
@@ -891,7 +878,7 @@ __func__);
/* Send a release request, to make sure that the MSC is aware of the problem. */ - tx_release_req(map); + context_map_mgcp_link_lost(map); return -1; }