aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2021-01-20 13:03:03 +0100
committerAlexander Couzens <lynxis@fe80.eu>2021-01-20 17:47:10 +0100
commit842599ca6252b9d65504fbe55148c6aad86f7025 (patch)
tree27655d41f9df6e2a349dfaae7e634bc51b95e9c8 /src/gb
parentf294974e054c0df16c10c2adfe0f6d50fc6d5b1b (diff)
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
Diffstat (limited to 'src/gb')
-rw-r--r--src/gb/gprs_ns2_vc_fsm.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index fc2a86a8..3ec69097 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -750,6 +750,7 @@ int gprs_ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed
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,19 @@ int gprs_ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed
}
}
+ if (TLVP_PRESENT(tp, NS_IE_NSEI)) {
+ nsei = tlvp_val16be(tp, NS_IE_NSEI);
+ if (nsei != nsvc->nse->nsei) {
+ /* 48.016 ยง 7.3.1 send, RESET_ACK to wrong NSVCI + ignore */
+ if (nsh->pdu_type == NS_PDUT_RESET)
+ ns2_tx_reset_ack(nsvc);
+
+ LOGNSVC(nsvc, LOGL_ERROR, "Rx %s with wrong NSEI=%05u. Ignoring PDU.\n",
+ get_value_string(gprs_ns_pdu_strings, nsh->pdu_type), nsei);
+ goto out;
+ }
+ }
+
switch (nsh->pdu_type) {
case NS_PDUT_RESET:
osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_RESET, tp);