Change in libosmocore[master]: ns2: correct parse a BLOCK PDU which was received over a different NSVC

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
Thu Sep 23 11:41:04 UTC 2021


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


Change subject: ns2: correct parse a BLOCK PDU which was received over a different NSVC
......................................................................

ns2: correct parse a BLOCK PDU which was received over a different NSVC

BLOCK PDU can be send over a different NSVC than the NSVC.
E.g. informing a NSVC got blocked in case of a lower-layer failure.

Change-Id: I483e3a1d3b8c43bbb0cc6185b7f7f772bcb264bf
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 33 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/58/25558/1

diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 3395254..b528a06 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -118,6 +118,7 @@
 	GPRS_NS2_EV_REQ_OM_RESET,		/* vty cmd: reset */
 	GPRS_NS2_EV_REQ_OM_BLOCK,		/* vty cmd: block */
 	GPRS_NS2_EV_REQ_OM_UNBLOCK,		/* vty cmd: unblock*/
+	GPRS_NS2_EV_RX_BLOCK_FOREIGN,		/* received a BLOCK over another NSVC */
 };
 
 static const struct value_string ns2_vc_event_names[] = {
@@ -127,6 +128,7 @@
 	{ GPRS_NS2_EV_RX_UNBLOCK,		"RX-UNBLOCK" },
 	{ GPRS_NS2_EV_RX_UNBLOCK_ACK,		"RX-UNBLOCK_ACK" },
 	{ GPRS_NS2_EV_RX_BLOCK,			"RX-BLOCK" },
+	{ GPRS_NS2_EV_RX_BLOCK_FOREIGN,		"RX-BLOCK_FOREIGN" },
 	{ GPRS_NS2_EV_RX_BLOCK_ACK,		"RX-BLOCK_ACK" },
 	{ GPRS_NS2_EV_RX_ALIVE,			"RX-ALIVE" },
 	{ GPRS_NS2_EV_RX_ALIVE_ACK,		"RX-ALIVE_ACK" },
@@ -368,8 +370,12 @@
 			osmo_timer_del(&fi->timer);
 			break;
 		case GPRS_NS2_EV_RX_BLOCK:
+		case GPRS_NS2_EV_RX_BLOCK_FOREIGN:
 			priv->accept_unitdata = false;
-			ns2_tx_block_ack(priv->nsvc, NULL);
+			/* the BLOCK ACK for foreign BLOCK PDUs (rx over another nsvc) will be send
+			 * from the receiving nsvc */
+			if (event == GPRS_NS2_EV_RX_BLOCK)
+				ns2_tx_block_ack(priv->nsvc, NULL);
 			osmo_timer_del(&fi->timer);
 			break;
 		case GPRS_NS2_EV_RX_UNBLOCK:
@@ -380,6 +386,9 @@
 		}
 	} else if (priv->initiate_block) {
 		switch (event) {
+		case GPRS_NS2_EV_RX_BLOCK_FOREIGN:
+			/* the block ack will be send by the rx NSVC */
+			break;
 		case GPRS_NS2_EV_RX_BLOCK:
 			/* TODO: BLOCK is a UNBLOCK_NACK */
 			ns2_tx_block_ack(priv->nsvc, NULL);
@@ -396,6 +405,9 @@
 	} else {
 		/* we are on the receiving end. The initiator who sent RESET is responsible to UNBLOCK! */
 		switch (event) {
+		case GPRS_NS2_EV_RX_BLOCK_FOREIGN:
+			/* the block ack will be send by the rx NSVC */
+			break;
 		case GPRS_NS2_EV_RX_BLOCK:
 			ns2_tx_block_ack(priv->nsvc, NULL);
 			break;
@@ -438,10 +450,14 @@
 	case GPRS_NS2_EV_RX_UNBLOCK:
 		ns2_tx_unblock_ack(priv->nsvc);
 		break;
+	case GPRS_NS2_EV_RX_BLOCK_FOREIGN:
 	case GPRS_NS2_EV_RX_BLOCK:
 		priv->initiate_block = false;
 		priv->accept_unitdata = false;
-		ns2_tx_block_ack(priv->nsvc, NULL);
+		/* the BLOCK ACK for foreign BLOCK PDUs (rx over another nsvc) will be send
+		 * from the receiving nsvc */
+		if (event == GPRS_NS2_EV_RX_BLOCK)
+			ns2_tx_block_ack(priv->nsvc, NULL);
 		osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED,
 					0, 2);
 		break;
@@ -887,21 +903,26 @@
 			/* 48.016 § 7.3.1 send RESET_ACK to wrong NSVCI + ignore */
 			if (nsh->pdu_type == NS_PDUT_RESET) {
 				ns2_tx_reset_ack(nsvc);
-			} else if (nsh->pdu_type == NS_PDUT_STATUS) {
-				/* this is a PDU received over a NSVC and reports a status for another NSVC */
+			} else if (nsh->pdu_type == NS_PDUT_BLOCK || nsh->pdu_type == NS_PDUT_STATUS) {
+				/* this is a PDU received over a NSVC and reports a status/block for another NSVC */
 				target_nsvc = gprs_ns2_nsvc_by_nsvci(nsvc->nse->nsi,  nsvci);
 				if (!target_nsvc) {
 					LOGPFSML(fi, LOGL_ERROR, "Received a STATUS PDU for unknown NSVC (NSVCI %d)\n", nsvci);
+					if (nsh->pdu_type == NS_PDUT_BLOCK) {
+						/* send out status */
+					}
 					goto out;
 				}
 
 				if (target_nsvc->nse != nsvc->nse) {
 					LOGPFSML(fi, LOGL_ERROR, "Received a STATUS PDU for a NSVC (NSVCI %d) but it belongs to a different NSE!\n", nsvci);
-					/* send out status */
+					if (nsh->pdu_type == NS_PDUT_BLOCK) {
+						/* send out status */
+					}
 					goto out;
 				}
 
-				/* the status will be passed to the nsvc/target nsvc in the switch */
+				/* the status/block will be passed to the nsvc/target nsvc in the switch */
 			} else {
 				LOG_NS_SIGNAL(nsvc, "Rx", nsh->pdu_type, LOGL_ERROR, " with wrong NSVCI=%05u. Ignoring PDU.\n", nsvci);
 				goto out;
@@ -917,7 +938,12 @@
 		osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_RESET_ACK, tp);
 		break;
 	case NS_PDUT_BLOCK:
-		osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_BLOCK, tp);
+		if (target_nsvc) {
+			osmo_fsm_inst_dispatch(target_nsvc->fi, GPRS_NS2_EV_RX_BLOCK_FOREIGN, tp);
+			ns2_tx_block_ack(nsvc, &nsvci);
+		} else {
+			osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_BLOCK, tp);
+		}
 		break;
 	case NS_PDUT_BLOCK_ACK:
 		osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_BLOCK_ACK, tp);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I483e3a1d3b8c43bbb0cc6185b7f7f772bcb264bf
Gerrit-Change-Number: 25558
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/20210923/3b310090/attachment.htm>


More information about the gerrit-log mailing list