From 61c07842f2a12dfbde27b2c60b3a3c87934601ba Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 18 May 2010 11:57:08 +0200 Subject: [GPRS] BSSGP: Use correct values for SIGNALLING and PTM BVCI --- openbsc/include/openbsc/gprs_bssgp.h | 4 ++++ openbsc/src/gprs/gprs_bssgp.c | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/openbsc/include/openbsc/gprs_bssgp.h b/openbsc/include/openbsc/gprs_bssgp.h index 4afe811c..90b945ab 100644 --- a/openbsc/include/openbsc/gprs_bssgp.h +++ b/openbsc/include/openbsc/gprs_bssgp.h @@ -3,6 +3,10 @@ #include +/* Section 5.4.1 */ +#define BVCI_SIGNALLING 0x0000 +#define BVCI_PTM 0x0001 + /* Section 11.3.26 / Table 11.27 */ enum bssgp_pdu_type { /* PDUs between RL and BSSGP SAPs */ diff --git a/openbsc/src/gprs/gprs_bssgp.c b/openbsc/src/gprs/gprs_bssgp.c index 0bc243ba..d5ff44d8 100644 --- a/openbsc/src/gprs/gprs_bssgp.c +++ b/openbsc/src/gprs/gprs_bssgp.c @@ -186,7 +186,7 @@ static int bssgp_rx_bvc_block(struct msgb *msg, struct tlv_parsed *tp) struct bssgp_bvc_ctx *ptp_ctx; bvci = ntohs(*(uint16_t *)TLVP_VAL(tp, BSSGP_IE_BVCI)); - if (bvci == 0) { + if (bvci == BVCI_SIGNALLING) { /* 8.3.2: Signalling BVC shall never be blocked */ LOGP(DBSSGP, LOGL_ERROR, "NSEI=%u/BVCI=%u " "received block for signalling BVC!?!\n", @@ -216,7 +216,7 @@ static int bssgp_rx_bvc_unblock(struct msgb *msg, struct tlv_parsed *tp) struct bssgp_bvc_ctx *ptp_ctx; bvci = ntohs(*(uint16_t *)TLVP_VAL(tp, BSSGP_IE_BVCI)); - if (bvci == 0) { + if (bvci == BVCI_SIGNALLING) { /* 8.3.2: Signalling BVC shall never be blocked */ LOGP(DBSSGP, LOGL_ERROR, "NSEI=%u/BVCI=%u " "received unblock for signalling BVC!?!\n", @@ -517,9 +517,9 @@ int gprs_bssgp_rcvmsg(struct msgb *msg) msgb_bssgp_len(msg)); } - if (ns_bvci == 1) + if (ns_bvci == BVCI_SIGNALLING) rc = gprs_bssgp_rx_sign(msg, &tp, bctx); - else if (ns_bvci == 2) + else if (ns_bvci == BVCI_PTM) rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg); else rc = gprs_bssgp_rx_ptp(msg, &tp, bctx); @@ -542,7 +542,7 @@ int gprs_bssgp_tx_dl_ud(struct msgb *msg) uint16_t nsei = msgb_nsei(msg); /* Identifiers from UP: TLLI, BVCI, NSEI (all in msgb->cb) */ - if (bvci < 2) { + if (bvci <= BVCI_PTM ) { LOGP(DBSSGP, LOGL_ERROR, "Cannot send DL-UD to BVCI %u\n", bvci); return -EINVAL; -- cgit v1.2.3