aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libbsc/bsc_api.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-14 16:13:24 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-03-15 14:15:00 +0100
commit531734a547f16de08ce94ec64d58cf94c2230893 (patch)
tree5705702d024525fe3f631e15037b5ab310d4d91e /openbsc/src/libbsc/bsc_api.c
parent51273157fa18034349d6ac1395c6d43e80cc07c0 (diff)
04.08: apply new bitmask functions, fix bitmask use
Replace hardcoded protocol discriminator and message type bitmasks with function calls recently introduced in libosmocore. Note that the release 98 bitmasks slightly differ from the release 99 bitmasks. This patch uses the "default" gsm48_hdr_msg_type invocation, thus it depends on libosmocore whether 98 or 99 bitmasks are used. In some places, use of the bitmask was erratic. Fix these implicitly by employing the bitmask functions: * silent_call.c: silent_call_reroute(): add missing bitmask for MM. * bsc_msg_filter.c: bsc_msg_filter_initial(): RR vs. MM messages. * osmo_bsc_filter.c: bsc_find_msc() and bsc_scan_bts_msg(): RR vs. MM messages. * bsc_nat_rewrite.c: bsc_nat_rewrite_msg(): SMS vs. CC messages. * bsc_ussd.c: no bitmask is applicable for the message types used here. * gb_proxy.c: gbproxy_imsi_acquisition(): missing bit mask for pdisc. In gprs_gb_parse.c: gprs_gb_parse_dtap(), add a log notice for unexpected message types.
Diffstat (limited to 'openbsc/src/libbsc/bsc_api.c')
-rw-r--r--openbsc/src/libbsc/bsc_api.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c
index 504f044fb..e6d820d7e 100644
--- a/openbsc/src/libbsc/bsc_api.c
+++ b/openbsc/src/libbsc/bsc_api.c
@@ -563,6 +563,7 @@ static void dispatch_dtap(struct gsm_subscriber_connection *conn,
struct bsc_api *api = msg->lchan->ts->trx->bts->network->bsc_api;
struct gsm48_hdr *gh;
uint8_t pdisc;
+ uint8_t msg_type;
int rc;
if (msgb_l3len(msg) < sizeof(*gh)) {
@@ -571,7 +572,8 @@ static void dispatch_dtap(struct gsm_subscriber_connection *conn,
}
gh = msgb_l3(msg);
- pdisc = gh->proto_discr & 0x0f;
+ pdisc = gsm48_hdr_pdisc(gh);
+ msg_type = gsm48_hdr_msg_type(gh);
/* the idea is to handle all RR messages here, and only hand
* MM/CC/SMS-CP/LCS up to the MSC. Some messages like PAGING
@@ -581,7 +583,7 @@ static void dispatch_dtap(struct gsm_subscriber_connection *conn,
* will call api->compl_l3() for it */
switch (pdisc) {
case GSM48_PDISC_RR:
- switch (gh->msg_type) {
+ switch (msg_type) {
case GSM48_MT_RR_GPRS_SUSP_REQ:
DEBUGP(DRR, "GRPS SUSPEND REQUEST\n");
break;
@@ -640,7 +642,7 @@ static void dispatch_dtap(struct gsm_subscriber_connection *conn,
* messages, but we'd rather forward what we
* don't know than drop it... */
LOGP(DRR, LOGL_NOTICE, "BSC: Passing unknown 04.08 "
- "RR message type 0x%02x to MSC\n", gh->msg_type);
+ "RR message type 0x%02x to MSC\n", msg_type);
if (api->dtap)
api->dtap(conn, link_id, msg);
}