mirror of https://gerrit.osmocom.org/libosmocore
gprs_ns2_vc_fsm: check NSVCI match the NSE
The NSVCI must match the PDUs. The only exception is a RESET with dialect ipaccess. However those will be handled later. Change-Id: I8518bdb03e9e33b04b77a2a346d04c5d29544a6c
This commit is contained in:
parent
842599ca62
commit
9c1e04e580
|
@ -750,11 +750,10 @@ int gprs_ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed
|
||||||
struct osmo_fsm_inst *fi = nsvc->fi;
|
struct osmo_fsm_inst *fi = nsvc->fi;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
uint8_t cause;
|
uint8_t cause;
|
||||||
uint16_t nsei;
|
uint16_t nsei, nsvci;
|
||||||
|
|
||||||
/* TODO: 7.2: on UNBLOCK/BLOCK: check if NS-VCI is correct,
|
/* TODO: 7.2: on UNBLOCK/BLOCK: check if NS-VCI is correct,
|
||||||
* if not answer STATUS with "NS-VC unknown" */
|
* if not answer STATUS with "NS-VC unknown" */
|
||||||
/* TODO: handle RESET with different VCI */
|
|
||||||
/* TODO: handle BLOCK/UNBLOCK/ALIVE with different VCI */
|
/* TODO: handle BLOCK/UNBLOCK/ALIVE with different VCI */
|
||||||
|
|
||||||
if (gprs_ns2_validate(nsvc, nsh->pdu_type, msg, tp, &cause)) {
|
if (gprs_ns2_validate(nsvc, nsh->pdu_type, msg, tp, &cause)) {
|
||||||
|
@ -777,6 +776,19 @@ int gprs_ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nsvc->nsvci_is_valid && TLVP_PRESENT(tp, NS_IE_VCI)) {
|
||||||
|
nsvci = tlvp_val16be(tp, NS_IE_VCI);
|
||||||
|
if (nsvci != nsvc->nsvci) {
|
||||||
|
/* 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 NSVCI=%05u. Ignoring PDU.\n",
|
||||||
|
get_value_string(gprs_ns_pdu_strings, nsh->pdu_type), nsvci);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (nsh->pdu_type) {
|
switch (nsh->pdu_type) {
|
||||||
case NS_PDUT_RESET:
|
case NS_PDUT_RESET:
|
||||||
osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_RESET, tp);
|
osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_RESET, tp);
|
||||||
|
|
Loading…
Reference in New Issue