summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2017-03-21 12:25:14 +0100
committerMax <msuraev@sysmocom.de>2017-09-19 18:27:24 +0200
commit0d8472fd67ef148fea03f7aa6502bead2a5dc36e (patch)
tree100a1e6564736087e8bf92e9481023cf3b2e6a28
parent4b3dd241120d75fca6fc8748a7c1dbb7193013c4 (diff)
libfilter: Also handle detach indications
Change-Id: Iad4e2861f42d5275e2b3057ab2bc43ef43b61cfe Ticket: SYS#3208 Sponsored-by: On-Waves ehf.
-rw-r--r--openbsc/src/libfilter/bsc_msg_filter.c29
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c3
2 files changed, 31 insertions, 1 deletions
diff --git a/openbsc/src/libfilter/bsc_msg_filter.c b/openbsc/src/libfilter/bsc_msg_filter.c
index 115d376cb..ce346a4f1 100644
--- a/openbsc/src/libfilter/bsc_msg_filter.c
+++ b/openbsc/src/libfilter/bsc_msg_filter.c
@@ -295,6 +295,30 @@ static int _cr_check_pag_resp(void *ctx,
return 1;
}
+static int _cr_check_detach_ind(void *ctx,
+ uint8_t *data, unsigned int length, char **imsi)
+{
+ struct gsm48_imsi_detach_ind *ind;
+ char mi_string[GSM48_MI_SIZE];
+ uint8_t mi_type;
+
+ if (length < sizeof(*ind)) {
+ LOGP(DFILTER, LOGL_ERROR, "IMSI DETACH IND does not fit. Length was %d.\n", length);
+ return -1;
+ }
+
+ ind = (struct gsm48_imsi_detach_ind *) data;
+ mi_type = ind->mi[0] & GSM_MI_TYPE_MASK;
+
+ /* we need to let it pass for now */
+ if (mi_type != GSM_MI_TYPE_IMSI)
+ return 0;
+
+ gsm48_mi_to_string(mi_string, sizeof(mi_string), ind->mi, ind->mi_len);
+ *imsi = talloc_strdup(ctx, mi_string);
+ return 1;
+}
+
static int _dt_check_id_resp(struct bsc_filter_request *req,
uint8_t *data, unsigned int length,
struct bsc_filter_state *state,
@@ -357,6 +381,11 @@ int bsc_msg_filter_initial(struct gsm48_hdr *hdr48, size_t hdr48_len,
*con_type = FLT_CON_TYPE_PAG_RESP;
ret = _cr_check_pag_resp(req->ctx, &hdr48->data[0],
hdr48_len - sizeof(*hdr48), imsi);
+ } else if (proto == GSM48_PDISC_MM &&
+ msg_type == GSM48_MT_MM_IMSI_DETACH_IND) {
+ *con_type = FLT_CON_TYPE_OTHER;
+ ret = _cr_check_detach_ind(req->ctx, &hdr48->data[0],
+ hdr48_len - sizeof(*hdr48), imsi);
} else {
/* We only want to filter the above, let other things pass */
*con_type = FLT_CON_TYPE_OTHER;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index 2db238d12..f1dbc8011 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -371,7 +371,8 @@ static void send_mgcp_reset(struct bsc_connection *bsc)
void bsc_nat_send_mgcp_to_msc(struct bsc_nat *nat, struct msgb *msg)
{
ipa_prepend_header(msg, IPAC_PROTO_MGCP_OLD);
- queue_for_msc(nat->msc_con, msg);
+#warning Disabled for now
+// queue_for_msc(nat->msc_con, msg);
}
/*