aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libfilter
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-10 12:19:13 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-03-15 13:14:17 +0100
commit51bf76ef478085a030382e91212e108f71537ccc (patch)
tree7d0f52f6a71c4fa8cb2726849f51fd432e16d104 /openbsc/src/libfilter
parentaa6058203665aa2fb9edd033e852dcb1bf2c003f (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/libfilter')
-rw-r--r--openbsc/src/libfilter/bsc_msg_filter.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/openbsc/src/libfilter/bsc_msg_filter.c b/openbsc/src/libfilter/bsc_msg_filter.c
index eafeff4db..115d376cb 100644
--- a/openbsc/src/libfilter/bsc_msg_filter.c
+++ b/openbsc/src/libfilter/bsc_msg_filter.c
@@ -339,15 +339,15 @@ int bsc_msg_filter_initial(struct gsm48_hdr *hdr48, size_t hdr48_len,
cause->lu_reject_cause = GSM48_REJECT_PLMN_NOT_ALLOWED;
*imsi = NULL;
- proto = hdr48->proto_discr & 0x0f;
- msg_type = hdr48->msg_type & 0xbf;
+ proto = gsm48_hdr_pdisc(hdr48);
+ msg_type = gsm48_hdr_msg_type(hdr48);
if (proto == GSM48_PDISC_MM &&
msg_type == GSM48_MT_MM_LOC_UPD_REQUEST) {
*con_type = FLT_CON_TYPE_LU;
ret = _cr_check_loc_upd(req->ctx, &hdr48->data[0],
hdr48_len - sizeof(*hdr48), imsi);
} else if (proto == GSM48_PDISC_MM &&
- msg_type == GSM48_MT_MM_CM_SERV_REQ) {
+ msg_type == GSM48_MT_MM_CM_SERV_REQ) {
*con_type = FLT_CON_TYPE_CM_SERV_REQ;
ret = _cr_check_cm_serv_req(req->ctx, &hdr48->data[0],
hdr48_len - sizeof(*hdr48),
@@ -388,8 +388,8 @@ int bsc_msg_filter_data(struct gsm48_hdr *hdr48, size_t len,
if (state->imsi_checked)
return 0;
- proto = hdr48->proto_discr & 0x0f;
- msg_type = hdr48->msg_type & 0xbf;
+ proto = gsm48_hdr_pdisc(hdr48);
+ msg_type = gsm48_hdr_msg_type(hdr48);
if (proto != GSM48_PDISC_MM || msg_type != GSM48_MT_MM_ID_RESP)
return 0;