cnpool prep: add SCCP_EV_USER_ABORT

To ease patch review, I decided to submit this separately from the
caller, which follows in subsequent patch
I5479eded786ec26062d49403a8be12967f113cdb

The new event will be dispatched when there are SCCP config changes
pending, and the human user types 'apply sccp' on the telnet VTY. The
aim is to disconnect all connections so we can create a new SCCP User.

Related: SYS#6412
Change-Id: Idff8e09b5328c904b175e4d4df7d4044a34f4a20
This commit is contained in:
Neels Hofmeyr 2023-05-24 23:57:04 +02:00
parent c6393a1f80
commit bd5901d3f9
2 changed files with 20 additions and 0 deletions

View File

@ -55,6 +55,9 @@ enum map_sccp_fsm_event {
MAP_SCCP_EV_RAN_LINK_LOST,
/* Receiving an SCCP RLSD from CN, or libosmo-sigtran tells us about SCCP connection timeout. All done. */
MAP_SCCP_EV_RX_RELEASED,
/* The human admin asks to drop the current SCCP connection, by telnet VTY 'apply sccp' in presence of SCCP
* config changes. */
MAP_SCCP_EV_USER_ABORT,
};
/* For context_map_get_state(), to combine the RUA and SCCP states, for VTY reporting only. */

View File

@ -54,6 +54,7 @@ static const struct value_string map_sccp_fsm_event_names[] = {
OSMO_VALUE_STRING(MAP_SCCP_EV_RAN_DISC),
OSMO_VALUE_STRING(MAP_SCCP_EV_RAN_LINK_LOST),
OSMO_VALUE_STRING(MAP_SCCP_EV_RX_RELEASED),
OSMO_VALUE_STRING(MAP_SCCP_EV_USER_ABORT),
{}
};
@ -281,6 +282,7 @@ static void map_sccp_init_action(struct osmo_fsm_inst *fi, uint32_t event, void
case MAP_SCCP_EV_RAN_LINK_LOST:
case MAP_SCCP_EV_RAN_DISC:
case MAP_SCCP_EV_USER_ABORT:
/* No CR has been sent yet, just go to disconnected state. */
if (msg_has_l2_data(ranap_msg))
LOG_MAP(map, DLSCCP, LOGL_ERROR, "SCCP not connected, cannot dispatch RANAP message\n");
@ -317,6 +319,7 @@ static void map_sccp_wait_cc_action(struct osmo_fsm_inst *fi, uint32_t event, vo
case MAP_SCCP_EV_RAN_LINK_LOST:
case MAP_SCCP_EV_RAN_DISC:
case MAP_SCCP_EV_USER_ABORT:
/* RUA connection was terminated. First wait for the CC before releasing the SCCP conn. */
if (msg_has_l2_data(ranap_msg))
LOGPFSML(fi, LOGL_ERROR, "Connection not yet confirmed, cannot forward RANAP to CN\n");
@ -373,6 +376,9 @@ static void map_sccp_connected_action(struct osmo_fsm_inst *fi, uint32_t event,
case MAP_SCCP_EV_RAN_LINK_LOST:
/* RUA has disconnected ungracefully, so there is no Iu Release that told the CN to disconnect.
* Disconnect on the SCCP layer, ungracefully. */
case MAP_SCCP_EV_USER_ABORT:
/* The user is asking for disconnection, so there is no Iu Release in progress. Disconnect now. */
/* There won't be any ranap_msg, but if a caller wants to dispatch a msg, forward it before
* disconnecting. */
tx_sccp_df1(fi, ranap_msg);
@ -440,6 +446,12 @@ static void map_sccp_wait_rlsd_action(struct osmo_fsm_inst *fi, uint32_t event,
handle_rx_sccp(fi, ranap_msg);
return;
case MAP_SCCP_EV_USER_ABORT:
/* Stop waiting for RLSD, send RLSD now. */
tx_sccp_rlsd(fi);
map_sccp_fsm_state_chg(MAP_SCCP_ST_DISCONNECTED);
return;
default:
OSMO_ASSERT(false);
}
@ -511,6 +523,7 @@ static const struct osmo_fsm_state map_sccp_fsm_states[] = {
| S(MAP_SCCP_EV_RAN_DISC)
| S(MAP_SCCP_EV_RAN_LINK_LOST)
| S(MAP_SCCP_EV_RX_RELEASED)
| S(MAP_SCCP_EV_USER_ABORT)
,
.out_state_mask = 0
| S(MAP_SCCP_ST_INIT)
@ -527,6 +540,7 @@ static const struct osmo_fsm_state map_sccp_fsm_states[] = {
| S(MAP_SCCP_EV_RAN_DISC)
| S(MAP_SCCP_EV_RAN_LINK_LOST)
| S(MAP_SCCP_EV_RX_RELEASED)
| S(MAP_SCCP_EV_USER_ABORT)
,
.out_state_mask = 0
| S(MAP_SCCP_ST_CONNECTED)
@ -543,6 +557,7 @@ static const struct osmo_fsm_state map_sccp_fsm_states[] = {
| S(MAP_SCCP_EV_RAN_LINK_LOST)
| S(MAP_SCCP_EV_RX_RELEASED)
| S(MAP_SCCP_EV_RX_CONNECTION_CONFIRM)
| S(MAP_SCCP_EV_USER_ABORT)
,
.out_state_mask = 0
| S(MAP_SCCP_ST_WAIT_RLSD)
@ -560,6 +575,7 @@ static const struct osmo_fsm_state map_sccp_fsm_states[] = {
| S(MAP_SCCP_EV_RAN_DISC)
| S(MAP_SCCP_EV_RAN_LINK_LOST)
| S(MAP_SCCP_EV_RX_CONNECTION_CONFIRM)
| S(MAP_SCCP_EV_USER_ABORT)
,
.out_state_mask = 0
| S(MAP_SCCP_ST_DISCONNECTED)
@ -573,6 +589,7 @@ static const struct osmo_fsm_state map_sccp_fsm_states[] = {
| S(MAP_SCCP_EV_TX_DATA_REQUEST)
| S(MAP_SCCP_EV_RAN_DISC)
| S(MAP_SCCP_EV_RAN_LINK_LOST)
| S(MAP_SCCP_EV_USER_ABORT)
,
.onenter = map_sccp_disconnected_onenter,
.action = map_sccp_disconnected_action,