summaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_bssgp_util.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-09-23 13:28:21 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-09-23 16:27:44 +0200
commita7165778c6696a8853bc7696ffed29dd757b4b0f (patch)
tree93b0f2ef26f20084b1f4cb65c5971697105c450d /src/gb/gprs_bssgp_util.c
parentde883e7f6cfb71f46921d6ef7564b24aeecd6f2c (diff)
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
Diffstat (limited to 'src/gb/gprs_bssgp_util.c')
-rw-r--r--src/gb/gprs_bssgp_util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gb/gprs_bssgp_util.c b/src/gb/gprs_bssgp_util.c
index ae4647ef..261e0b0f 100644
--- a/src/gb/gprs_bssgp_util.c
+++ b/src/gb/gprs_bssgp_util.c
@@ -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 *) 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",
bvci ? *bvci : 0, bssgp_cause_str(cause));
msgb_nsei(msg) = msgb_nsei(orig_msg);