Change in libosmocore[master]: gprs_ns2_vc_fsm: check NSEI match the NSE

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 Jan 20 12:34:30 UTC 2021


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


Change subject: gprs_ns2_vc_fsm: check NSEI match the NSE
......................................................................

gprs_ns2_vc_fsm: check NSEI match the NSE

The NSE must match the PDUs. The only exception is a RESET with
dialect ipaccess. However those will be handled later.

Change-Id: Ic8fc49d850490feb0ff69171a6b0881ae8696c0b
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 10 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/25/22325/1

diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 5de86f5..bae17cb 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -750,6 +750,7 @@
 	struct osmo_fsm_inst *fi = nsvc->fi;
 	int rc = 0;
 	uint8_t cause;
+	uint16_t nsei;
 
 	/* TODO: 7.2: on UNBLOCK/BLOCK: check if NS-VCI is correct,
 	 *  if not answer STATUS with "NS-VC unknown" */
@@ -763,6 +764,15 @@
 		}
 	}
 
+	if (TLVP_PRESENT(tp, NS_IE_NSEI)) {
+		nsei = tlvp_val16be(tp, NS_IE_NSEI);
+		if (nsei != nsvc->nse->nsei) {
+			LOGP(DLNS, LOGL_ERROR, "NSEI=%05u Rx %s with wrong NSEI=%05u on NSVC %s. Ignoring PDU.\n",
+			     nsvc->nse->nsei, get_value_string(gprs_ns_pdu_strings, nsh->pdu_type), nsei, gprs_ns2_ll_str(nsvc));
+			goto out;
+		}
+	}
+
 	switch (nsh->pdu_type) {
 	case NS_PDUT_RESET:
 		osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_RESET, tp);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ic8fc49d850490feb0ff69171a6b0881ae8696c0b
Gerrit-Change-Number: 22325
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/20210120/004c1572/attachment.htm>


More information about the gerrit-log mailing list