aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2021-07-20 22:16:09 +0200
committerAlexander Couzens <lynxis@fe80.eu>2021-09-04 01:26:28 +0200
commit1adfd23290dc9d9f7a2d850034c7c80e2ae5e7bb (patch)
treefd5514d7219df942df429ae3d27918154050c9e5
parent8a612de92bf554205a5c19b645fc748b0441b1a4 (diff)
gprs_ns2_sns: ensure the SNS fsm behave correct when no signalling NSVCs are present
When no remaining signalling NSVCs are available the SNS must be restarted (BSS) or go into unconfigured state (SGSN). Change-Id: I95e6bbb7a418d647a8426804879571597ae06ff8
-rw-r--r--src/gb/gprs_ns2_sns.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 22ca7b2a..c1be0ab8 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -201,6 +201,7 @@ static void _sns_failed(struct osmo_fsm_inst *fi, const char *reason, const char
if (reason)
LOGPFSMLSRC(fi, LOGL_ERROR, file, line, "NSE %d: SNS failed: %s\n", gss->nse->nsei, reason);
+ gss->alive = false;
if (gss->role == GPRS_SNS_ROLE_SGSN) {
if (!gss->nse->persistent)
gprs_ns2_free_nse(gss->nse);
@@ -2599,19 +2600,33 @@ void ns2_sns_notify_alive(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, bo
if (gss->block_no_nsvc_events)
return;
- if (alive == gss->alive)
+ if (gss->alive && nse->sum_sig_weight == 0) {
+ sns_failed(nse->bss_sns_fi, "No signalling NSVC available");
return;
+ }
/* check if this is the current SNS NS-VC */
- if (nsvc == gss->sns_nsvc) {
+ if (nsvc == gss->sns_nsvc && !alive) {
/* only replace the SNS NS-VC if there are other alive NS-VC.
* There aren't any other alive NS-VC when the SNS fsm just reached CONFIGURED
* and couldn't confirm yet if the NS-VC comes up */
- if (gss->alive && !alive)
- ns2_sns_replace_nsvc(nsvc);
+ llist_for_each_entry(tmp, &nse->nsvc, list) {
+ if (nsvc == tmp)
+ continue;
+ if (ns2_vc_is_unblocked(nsvc)) {
+ ns2_sns_replace_nsvc(nsvc);
+ break;
+ }
+ }
}
+ if (alive == gss->alive)
+ return;
+
if (alive) {
+ /* we need at least a signalling NSVC before become alive */
+ if (nse->sum_sig_weight == 0)
+ return;
gss->alive = true;
osmo_fsm_inst_dispatch(nse->bss_sns_fi, NS2_SNS_EV_REQ_NSVC_ALIVE, NULL);
} else {