diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2021-09-07 01:22:53 +0200 |
---|---|---|
committer | Alexander Couzens <lynxis@fe80.eu> | 2021-09-07 20:46:04 +0200 |
commit | a7a757f2eec39c3f4ce01055327c3ec84ee39ef0 (patch) | |
tree | 9a422c0c784cdc0040bc3ce1d177b7b1011c98af /src | |
parent | e7873336a22cdf195ed077d1f2768ded1c14dcdb (diff) |
gprs_ns2: nsvc: react on STATUS PDUs with cause code NSVC UNKNOWN/NSVC BLOCKED
A STATUS PDU with cause code NSVC UNKNOWN/NSVC BLOCKED informs the other
side about a state mismatch between the side.
Change-Id: Ib6a2424f3027a30f14ef0a9fc2230e6aae9a2a04
Diffstat (limited to 'src')
-rw-r--r-- | src/gb/gprs_ns2_vc_fsm.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c index 989a00c0..03a355b8 100644 --- a/src/gb/gprs_ns2_vc_fsm.c +++ b/src/gb/gprs_ns2_vc_fsm.c @@ -616,7 +616,9 @@ static void ns2_vc_fsm_allstate_action(struct osmo_fsm_inst *fi, { struct gprs_ns2_vc_priv *priv = fi->priv; struct gprs_ns2_inst *nsi = ns_inst_from_fi(fi); + struct tlv_parsed *tp; struct msgb *msg = data; + uint8_t cause; switch (event) { case GPRS_NS2_EV_REQ_OM_RESET: @@ -707,6 +709,27 @@ static void ns2_vc_fsm_allstate_action(struct osmo_fsm_inst *fi, if (fi->state == GPRS_NS2_ST_BLOCKED) osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED, nsi->timeout[NS_TOUT_TNS_BLOCK], 0); break; + case GPRS_NS2_EV_RX_STATUS: + tp = data; + cause = tlvp_val8(tp, NS_IE_CAUSE, 0); + switch (cause) { + case NS_CAUSE_NSVC_BLOCKED: + if (fi->state != GPRS_NS2_ST_BLOCKED) { + LOG_NS_SIGNAL(priv->nsvc, "Rx", NS_PDUT_STATUS, LOGL_ERROR, ": remote side reported blocked state.\n"); + priv->initiate_block = false; + priv->accept_unitdata = false; + osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED, nsi->timeout[NS_TOUT_TNS_BLOCK], 0); + } + break; + case NS_CAUSE_NSVC_UNKNOWN: + if (fi->state != GPRS_NS2_ST_RESET && fi->state != GPRS_NS2_ST_UNCONFIGURED) { + LOG_NS_SIGNAL(priv->nsvc, "Rx", NS_PDUT_STATUS, LOGL_ERROR, ": remote side reported unknown nsvc.\n"); + osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_RESET, nsi->timeout[NS_TOUT_TNS_RESET], 0); + } + break; + } + + break; } } @@ -726,6 +749,7 @@ static struct osmo_fsm ns2_vc_fsm = { S(GPRS_NS2_EV_RX_RESET) | S(GPRS_NS2_EV_RX_ALIVE) | S(GPRS_NS2_EV_RX_ALIVE_ACK) | + S(GPRS_NS2_EV_RX_STATUS) | S(GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED) | S(GPRS_NS2_EV_REQ_OM_RESET) | S(GPRS_NS2_EV_REQ_OM_BLOCK) | @@ -894,6 +918,9 @@ int ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp) /* UNITDATA have to free msg because it might send the msg layer upwards */ osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_UNITDATA, msg); return 0; + case NS_PDUT_STATUS: + osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_STATUS, tp); + break; default: LOGPFSML(fi, LOGL_ERROR, "NSEI=%u Rx unknown NS PDU type %s\n", nsvc->nse->nsei, get_value_string(gprs_ns_pdu_strings, nsh->pdu_type)); |