Change in libosmocore[master]: gprs_ns2_sns: ensure the SNS fsm behave correct when no signalling NS...

lynxis lazus gerrit-no-reply at lists.osmocom.org
Fri Aug 6 20:18:45 UTC 2021


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/25151 )


Change subject: gprs_ns2_sns: ensure the SNS fsm behave correct when no signalling NSVCs are present
......................................................................

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
---
M src/gb/gprs_ns2_sns.c
1 file changed, 25 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/51/25151/1

diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 306332b..91ec495 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -196,6 +196,7 @@
 	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);
@@ -2584,22 +2585,36 @@
 		return;
 
 	gss = nse->bss_sns_fi->priv;
-	if(nse->bss_sns_fi->state != GPRS_SNS_ST_CONFIGURED && nse->bss_sns_fi->state != GPRS_SNS_ST_LOCAL_PROCEDURE)
+	if (nse->bss_sns_fi->state != GPRS_SNS_ST_CONFIGURED && nse->bss_sns_fi->state != GPRS_SNS_ST_LOCAL_PROCEDURE)
 		return;
 
+	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 && !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 */
+		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;
 
-	/* check if this is the current SNS NS-VC */
-	if (nsvc == gss->sns_nsvc) {
-		/* 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);
-	}
-
 	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, GPRS_SNS_EV_REQ_NSVC_ALIVE, NULL);
 	} else {

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25151
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I95e6bbb7a418d647a8426804879571597ae06ff8
Gerrit-Change-Number: 25151
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210806/1276257d/attachment.htm>


More information about the gerrit-log mailing list