mirror of https://gerrit.osmocom.org/libosmocore
gprs: Fix and check BVCI in BSSGP STATUS messages
Currently the BVCI is not set in all invocations to bssgp_tx_status() when the cause is UNKNOWN_BVCI. This patch adds the argument where it is missing. It also adds a check for compliance (GSM 08.18, 10.4.14.1) to bssgp_tx_status() to emit errors when the following requirement is not fulfilled: The BVCI must be included if (and only if) the cause is either "BVCI blocked" or "BVCI unknown". Sponsored-by: On-Waves ehf
This commit is contained in:
parent
de883e7f6c
commit
a7165778c6
|
@ -998,7 +998,7 @@ int bssgp_rcvmsg(struct msgb *msg)
|
||||||
LOGP(DBSSGP, LOGL_NOTICE, "NSEI=%u/BVCI=%u Rejecting PDU "
|
LOGP(DBSSGP, LOGL_NOTICE, "NSEI=%u/BVCI=%u Rejecting PDU "
|
||||||
"type %u for unknown BVCI\n", msgb_nsei(msg), ns_bvci,
|
"type %u for unknown BVCI\n", msgb_nsei(msg), ns_bvci,
|
||||||
pdu_type);
|
pdu_type);
|
||||||
return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI, NULL, msg);
|
return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI, &ns_bvci, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bctx) {
|
if (bctx) {
|
||||||
|
|
|
@ -99,6 +99,20 @@ int bssgp_tx_status(uint8_t cause, uint16_t *bvci, struct msgb *orig_msg)
|
||||||
struct bssgp_normal_hdr *bgph =
|
struct bssgp_normal_hdr *bgph =
|
||||||
(struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph));
|
(struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph));
|
||||||
|
|
||||||
|
/* GSM 08.18, 10.4.14.1: The BVCI must be included if (and only if) the
|
||||||
|
cause is either "BVCI blocked" or "BVCI unknown" */
|
||||||
|
if (cause == BSSGP_CAUSE_UNKNOWN_BVCI || cause == BSSGP_CAUSE_BVCI_BLOCKED) {
|
||||||
|
if (bvci == NULL)
|
||||||
|
LOGP(DBSSGP, LOGL_ERROR, "BSSGP Tx STATUS, cause=%s: "
|
||||||
|
"missing conditional BVCI\n",
|
||||||
|
bssgp_cause_str(cause));
|
||||||
|
} else {
|
||||||
|
if (bvci != NULL)
|
||||||
|
LOGP(DBSSGP, LOGL_ERROR, "BSSGP Tx STATUS, cause=%s: "
|
||||||
|
"unexpected conditional BVCI\n",
|
||||||
|
bssgp_cause_str(cause));
|
||||||
|
}
|
||||||
|
|
||||||
LOGP(DBSSGP, LOGL_NOTICE, "BSSGP BVCI=%u Tx STATUS, cause=%s\n",
|
LOGP(DBSSGP, LOGL_NOTICE, "BSSGP BVCI=%u Tx STATUS, cause=%s\n",
|
||||||
bvci ? *bvci : 0, bssgp_cause_str(cause));
|
bvci ? *bvci : 0, bssgp_cause_str(cause));
|
||||||
msgb_nsei(msg) = msgb_nsei(orig_msg);
|
msgb_nsei(msg) = msgb_nsei(orig_msg);
|
||||||
|
|
Loading…
Reference in New Issue