Change in libosmocore[master]: ns2: Send NSVC representation in NS_AFF_CAUSE_VC_* status indication

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

daniel gerrit-no-reply at lists.osmocom.org
Tue Nov 3 22:13:09 UTC 2020


daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21040 )


Change subject: ns2: Send NSVC representation in NS_AFF_CAUSE_VC_* status indication
......................................................................

ns2: Send NSVC representation in NS_AFF_CAUSE_VC_* status indication

NS_AFF_CAUSE_VC_* failure and recovery should indicate the NSVC in
question. Use the string representation reported by gprs_ns2_ll_str()
for that.

NS_AFF_CAUSE_VC_RECOVERY was never sent so do that on unblock as well.

Change-Id: Iad6f0dc4565a46868cbbe17c361dcd473006c83d
Related: SYS#4998
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
M src/gb/gprs_ns2_vc_fsm.c
5 files changed, 18 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/40/21040/1

diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index 728ca9f..c90d459 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -101,6 +101,7 @@
 		} congestion;
 		struct {
 			enum gprs_ns2_affecting_cause cause;
+			char *nsvc;
 			/* 48.016 5.2.2.6 transfer capability */
 			int transfer;
 			/* osmocom specific */
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index f86608f..20f9337 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -363,6 +363,7 @@
  *  \param[in] bvci BVCI to which the status relates
  *  \param[in] cause The cause of the status */
 void ns2_prim_status_ind(struct gprs_ns2_nse *nse,
+			 struct gprs_ns2_vc *nsvc,
 			 uint16_t bvci,
 			 enum gprs_ns2_affecting_cause cause)
 {
@@ -373,9 +374,14 @@
 	nsp.u.status.transfer = -1;
 	nsp.u.status.first = nse->first;
 	nsp.u.status.persistent = nse->persistent;
+	if (nsvc)
+		nsp.u.status.nsvc = gprs_ns2_ll_str_c(nse, nsvc);
+
 	osmo_prim_init(&nsp.oph, SAP_NS, PRIM_NS_STATUS,
 			PRIM_OP_INDICATION, NULL);
 	nse->nsi->cb(&nsp.oph, nse->nsi->cb_data);
+	if (nsp.u.status.nsvc)
+		talloc_free(nsp.u.status.nsvc);
 }
 
 /*! Allocate a NS-VC within the given bind + NSE.
@@ -430,7 +436,7 @@
 	if (!nsvc)
 		return;
 
-	ns2_prim_status_ind(nsvc->nse, 0, NS_AFF_CAUSE_VC_FAILURE);
+	ns2_prim_status_ind(nsvc->nse, nsvc, 0, NS_AFF_CAUSE_VC_FAILURE);
 
 	llist_del(&nsvc->list);
 	llist_del(&nsvc->blist);
@@ -608,7 +614,7 @@
 		gprs_ns2_free_nsvc(nsvc);
 	}
 
-	ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_FAILURE);
+	ns2_prim_status_ind(nse, NULL, 0, NS_AFF_CAUSE_FAILURE);
 
 	llist_del(&nse->list);
 	if (nse->bss_sns_fi)
@@ -986,7 +992,7 @@
 	if (unblocked) {
 		/* this is the first unblocked NSVC on an unavailable NSE */
 		nse->alive = true;
-		ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_RECOVERY);
+		ns2_prim_status_ind(nse, NULL, 0, NS_AFF_CAUSE_RECOVERY);
 		nse->first = false;
 		return;
 	}
@@ -1004,7 +1010,7 @@
 
 	/* nse became unavailable */
 	nse->alive = false;
-	ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_FAILURE);
+	ns2_prim_status_ind(nse, NULL, 0, NS_AFF_CAUSE_FAILURE);
 }
 
 /*! Create a new GPRS NS instance
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index b480391..dee3ab7 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -221,6 +221,7 @@
 
 void gprs_ns2_sns_dump_vty(struct vty *vty, const struct gprs_ns2_nse *nse, bool stats);
 void ns2_prim_status_ind(struct gprs_ns2_nse *nse,
+			 struct gprs_ns2_vc *nsvc,
 			 uint16_t bvci,
 			 enum gprs_ns2_affecting_cause cause);
 void ns2_nse_notify_alive(struct gprs_ns2_vc *nsvc, bool alive);
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index b2754f5..31f8a5f 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -686,7 +686,7 @@
 	struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
 
 	if (old_state != GPRS_SNS_ST_UNCONFIGURED)
-		ns2_prim_status_ind(gss->nse, 0, NS_AFF_CAUSE_SNS_FAILURE);
+		ns2_prim_status_ind(gss->nse, NULL, 0, NS_AFF_CAUSE_SNS_FAILURE);
 
 	if (gss->num_max_ip4_remote > 0)
 		ns2_tx_sns_size(gss->sns_nsvc, true, gss->num_max_nsvcs, gss->num_max_ip4_remote, -1);
@@ -1126,7 +1126,7 @@
 static void ns2_sns_st_configured_onenter(struct osmo_fsm_inst *fi, uint32_t old_state)
 {
 	struct gprs_ns2_nse *nse = nse_inst_from_fi(fi);
-	ns2_prim_status_ind(nse, 0, NS_AFF_CAUSE_SNS_CONFIGURED);
+	ns2_prim_status_ind(nse, NULL, 0, NS_AFF_CAUSE_SNS_CONFIGURED);
 }
 
 static const struct osmo_fsm_state ns2_sns_bss_states[] = {
diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 451437f..c6acdb2 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -318,8 +318,11 @@
 static void gprs_ns2_st_unblocked_on_enter(struct osmo_fsm_inst *fi, uint32_t old_state)
 {
 	struct gprs_ns2_vc_priv *priv = fi->priv;
+	struct gprs_ns2_vc *nsvc = priv->nsvc;
+	struct gprs_ns2_nse *nse = nsvc->nse;
 
-	ns2_nse_notify_unblocked(priv->nsvc, true);
+	ns2_nse_notify_unblocked(nsvc, true);
+	ns2_prim_status_ind(nse, nsvc, 0, NS_AFF_CAUSE_VC_RECOVERY);
 }
 
 static void gprs_ns2_st_unblocked(struct osmo_fsm_inst *fi, uint32_t event, void *data)

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iad6f0dc4565a46868cbbe17c361dcd473006c83d
Gerrit-Change-Number: 21040
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201103/fc21e5f0/attachment.htm>


More information about the gerrit-log mailing list