Change in osmo-pcu[master]: WIP: gprs_bssgp: add remaining stuff for PCU to react on SGSN origina...

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/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Wed Feb 17 01:38:08 UTC 2021


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/22946 )


Change subject: WIP: gprs_bssgp: add remaining stuff for PCU to react on SGSN originated BSSGP-RESET
......................................................................

WIP: gprs_bssgp: add remaining stuff for PCU to react on SGSN originated BSSGP-RESET

Change-Id: I3afaf826798e362270ffa622c24bfd124ef25cd1
---
M src/gprs_bssgp_pcu.c
1 file changed, 43 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/46/22946/1

diff --git a/src/gprs_bssgp_pcu.c b/src/gprs_bssgp_pcu.c
index a6b6f7e..ff37451 100644
--- a/src/gprs_bssgp_pcu.c
+++ b/src/gprs_bssgp_pcu.c
@@ -418,6 +418,7 @@
 	uint16_t ns_bvci = msgb_bvci(msg), nsei = msgb_nsei(msg);
 	int data_len;
 	int rc = 0;
+	uint16_t bvci;
 	struct bssgp_bvc_ctx *bctx;
 
 	switch (pdu_type) {
@@ -461,14 +462,12 @@
 		if (ns_bvci != BVCI_SIGNALLING)
 			return rc;
 
-		if (TLVP_PRES_LEN(&tp, BSSGP_IE_CAUSE, 1))
-			cause = (enum gprs_bssgp_cause)*TLVP_VAL(&tp, BSSGP_IE_CAUSE);
-		else
+		if (TLVP_PRES_LEN(&tp, BSSGP_IE_BVCI, 1)) {
+			bvci = osmo_ntohs(tlvp_val16_unal(&tp, BSSGP_IE_BVCI));
+		} else {
 			LOGP(DBSSGP, LOGL_ERROR, "NSEI=%u BVC RESET without cause?!\n", nsei);
-
-		rc = bssgp_tx_bvc_ptp_reset(nsei, cause);
-		if (rc < 0)
-			LOGP(DBSSGP, LOGL_ERROR, "NSEI=%u BVC PTP reset procedure failed: %d\n", nsei, rc);
+			return rc;
+		}
 
 		return rc;
 	}
@@ -558,12 +557,47 @@
 int bssgp_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
 {
 	struct osmo_bssgp_prim *bp;
+	int rc;
+	enum gprs_bssgp_cause cause;
 	bp = container_of(oph, struct osmo_bssgp_prim, oph);
 
 	switch (oph->sap) {
 	case SAP_BSSGP_NM:
-		if (oph->primitive == PRIM_NM_STATUS)
+		switch (oph->primitive) {
+		case PRIM_NM_STATUS:
 			handle_nm_status(bp);
+			break;
+		case PRIM_NM_BVC_RESET:
+			/* received a BVC PTP reset */
+			LOGP(DPCU, LOGL_ERROR, "PRIM: rx BVC_RESET on bvci %d\n", bp->bvci);
+			LOGP(DPCU, LOGL_ERROR, "PRIM: flags %d %d %d\n",
+			     the_pcu->bssgp.bvc_sig_reset,
+			     the_pcu->bssgp.bvc_reset,
+			     the_pcu->bssgp.bvc_unblocked);
+			/* Rx Reset from SGSN */
+			if (bp->bvci == 0) {
+				if (TLVP_PRES_LEN(bp->tp, BSSGP_IE_CAUSE, 1))
+					cause = (enum gprs_bssgp_cause)*TLVP_VAL(bp->tp, BSSGP_IE_CAUSE);
+				else {
+					LOGP(DBSSGP, LOGL_ERROR, "NSEI=%u BVC RESET without cause?!\n", bp->nsei);
+					break;
+				}
+
+				rc = bssgp_tx_bvc_ptp_reset(bp->nsei, cause);
+				if (rc < 0) {
+					LOGP(DBSSGP, LOGL_ERROR, "NSEI=%u BVC PTP reset procedure failed: %d\n", bp->nsei, rc);
+					break;
+				}
+				the_pcu->bssgp.bvc_sig_reset = 1;
+				the_pcu->bssgp.bvc_reset = 0;
+				the_pcu->bssgp.bvc_unblocked = 0;
+			} else if (bp->bvci == the_pcu->bssgp.bctx->bvci) {
+				the_pcu->bssgp.bvc_reset = 1;
+				the_pcu->bssgp.bvc_unblocked = 0;
+				bvc_timeout(NULL);
+			}
+			break;
+		}
 		break;
 	case SAP_BSSGP_RIM:
 		return handle_rim(bp);
@@ -1161,6 +1195,7 @@
 		the_pcu->bssgp.bts->nse = NULL;
 		return NULL;
 	}
+	the_pcu->bssgp.bctx->is_sgsn = false;
 	the_pcu->bssgp.bctx->ra_id.mcc = spoof_mcc ? : mcc;
 	if (spoof_mnc) {
 		the_pcu->bssgp.bctx->ra_id.mnc = spoof_mnc;

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I3afaf826798e362270ffa622c24bfd124ef25cd1
Gerrit-Change-Number: 22946
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/20210217/fa14c34c/attachment.htm>


More information about the gerrit-log mailing list