drop IMSI filter and libfilter completely

Filtering by IMSI in osmo-bsc is a legacy use case with questionable
usefulness. Remove.

Do not keep deprecated VTY commands: those could be dangerous, since
(presumably non-existing) users might assume that the filtering would still be
in place. Rather fail to start osmo-bsc for config with an IMSI ACL.

The IMSI filtering did, if present, provide the logging with an IMSI to print
for the bsc_subscriber. TMSIs should have ended up in logging likewise, which
has never been implemented. The proper way to learn the IMSI would be by the
Common Id message from the MSC. Furthermore, the upcoming MSC pooling feature
will extract the mobile identity again, and will hence make sure that both IMSI
and TMSI identities, as available, end up in the bsc_subscriber and will be
logged again.

So long, IMSI ACL, and thanks for all the fish.

Change-Id: I89727af5387e8360362e995fdee959883c37d89a
diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 396604e..509df9a 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -6,7 +6,6 @@
 	acc_ramp.h \
 	arfcn_range_encode.h \
 	assignment_fsm.h \
-	bsc_msg_filter.h \
 	bsc_rll.h \
 	bsc_subscriber.h \
 	bsc_subscr_conn_fsm.h \
diff --git a/include/osmocom/bsc/bsc_msc_data.h b/include/osmocom/bsc/bsc_msc_data.h
index a97616f..c77c562 100644
--- a/include/osmocom/bsc/bsc_msc_data.h
+++ b/include/osmocom/bsc/bsc_msc_data.h
@@ -150,8 +150,6 @@
 	/* ussd text when MSC has entered the grace period */
 	char *ussd_grace_txt;
 
-	char *acc_lst_name;
-
 	/* structures for keeping rate counters and gauge stats */
 	struct rate_ctr_group *msc_ctrs;
 	struct osmo_stat_item_group *msc_statg;
@@ -224,8 +222,6 @@
 	/* ussd text when there is no MSC available */
 	char *ussd_no_msc_txt;
 
-	char *acc_lst_name;
-
 	struct bsc_cbc_link *cbc;
 };
 
diff --git a/include/osmocom/bsc/bsc_msg_filter.h b/include/osmocom/bsc/bsc_msg_filter.h
deleted file mode 100644
index fe87485..0000000
--- a/include/osmocom/bsc/bsc_msg_filter.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#pragma once
-
-#include <osmocom/core/msgb.h>
-#include <osmocom/core/msgfile.h>
-#include <osmocom/core/linuxrbtree.h>
-#include <osmocom/core/linuxlist.h>
-
-#include <regex.h>
-
-struct vty;
-struct gsm48_hdr;
-
-struct bsc_filter_reject_cause {
-	int lu_reject_cause;
-	int cm_reject_cause;
-};
-
-struct bsc_filter_barr_entry {
-	struct rb_node node;
-
-	char *imsi;
-	int cm_reject_cause;
-	int lu_reject_cause;
-};
-
-enum bsc_filter_acc_ctr {
-	ACC_LIST_LOCAL_FILTER,
-	ACC_LIST_GLOBAL_FILTER,
-};
-
-struct bsc_msg_acc_lst {
-	struct llist_head list;
-
-	/* counter */
-	struct rate_ctr_group *stats;
-
-	/* the name of the list */
-	const char *name;
-	struct llist_head fltr_list;
-};
-
-struct bsc_msg_acc_lst_entry {
-	struct llist_head list;
-
-	/* the filter */
-	char *imsi_allow;
-	regex_t imsi_allow_re;
-	char *imsi_deny;
-	regex_t imsi_deny_re;
-
-	/* reject reasons for the access lists */
-	int cm_reject_cause;
-	int lu_reject_cause;
-};
-
-enum {
-	FLT_CON_TYPE_NONE,
-	FLT_CON_TYPE_LU,
-	FLT_CON_TYPE_CM_SERV_REQ,
-	FLT_CON_TYPE_PAG_RESP,
-	FLT_CON_TYPE_SSA,
-	FLT_CON_TYPE_LOCAL_REJECT,
-	FLT_CON_TYPE_OTHER,
-};
-
-
-struct bsc_filter_state {
-	char *imsi;
-	int imsi_checked;
-	int con_type;
-};
-
-struct bsc_filter_request {
-	void *ctx;
-	struct rb_root *black_list;
-	struct llist_head *access_lists;
-	const char *local_lst_name;
-	const char *global_lst_name;
-	int bsc_nr;
-};
-
-/**
- * Content filtering.
- */
-int bsc_msg_filter_initial(struct gsm48_hdr *hdr, size_t size,
-			struct bsc_filter_request *req,
-			int *con_type, char **imsi,
-			struct bsc_filter_reject_cause *cause);
-int bsc_msg_filter_data(struct gsm48_hdr *hdr, size_t size,
-			struct bsc_filter_request *req,
-			struct bsc_filter_state *state,
-			struct bsc_filter_reject_cause *cause);
-
-/* IMSI allow/deny handling */
-struct bsc_msg_acc_lst *bsc_msg_acc_lst_find(struct llist_head *lst, const char *name);
-struct bsc_msg_acc_lst *bsc_msg_acc_lst_get(void *ctx, struct llist_head *lst, const char *name);
-void bsc_msg_acc_lst_delete(struct bsc_msg_acc_lst *lst);
-
-struct bsc_msg_acc_lst_entry *bsc_msg_acc_lst_entry_create(struct bsc_msg_acc_lst *);
-int bsc_msg_acc_lst_check_allow(struct bsc_msg_acc_lst *lst, const char *imsi);
-
-void bsc_msg_acc_lst_vty_init(void *ctx, struct llist_head *lst, int node);
-void bsc_msg_acc_lst_write(struct vty *vty);
diff --git a/include/osmocom/bsc/gsm_04_08_rr.h b/include/osmocom/bsc/gsm_04_08_rr.h
index f0c0f42..06cefa9 100644
--- a/include/osmocom/bsc/gsm_04_08_rr.h
+++ b/include/osmocom/bsc/gsm_04_08_rr.h
@@ -1,6 +1,7 @@
 #pragma once
 
 #include <stdint.h>
+#include <osmocom/core/msgb.h>
 
 struct amr_mode;
 struct amr_multirate_conf;
@@ -11,7 +12,6 @@
 struct gsm_meas_rep;
 struct gsm_network;
 struct gsm_subscriber_connection;
-struct msgb;
 
 void gsm_net_update_ctype(struct gsm_network *network);
 enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *network, uint8_t ra);
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index a2e103d..e6a7708 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -31,7 +31,6 @@
 #include <osmocom/gsm/protocol/gsm_12_21.h>
 #include <osmocom/abis/e1_input.h>
 #include <osmocom/bsc/meas_rep.h>
-#include <osmocom/bsc/bsc_msg_filter.h>
 #include <osmocom/bsc/acc_ramp.h>
 #include <osmocom/bsc/neighbor_ident.h>
 #include <osmocom/bsc/osmux.h>
@@ -265,9 +264,6 @@
 	/* state related to welcome USSD */
 	uint8_t new_subscriber;
 
-	/* state related to osmo_bsc_filter.c */
-	struct bsc_filter_state filter_state;
-
 	/* SCCP connection associatd with this subscriber_connection */
 	struct {
 		/* for advanced ping/pong */
diff --git a/include/osmocom/bsc/osmo_bsc.h b/include/osmocom/bsc/osmo_bsc.h
index 163e494..8999a2e 100644
--- a/include/osmocom/bsc/osmo_bsc.h
+++ b/include/osmocom/bsc/osmo_bsc.h
@@ -2,8 +2,6 @@
 
 #include <osmocom/gsm/protocol/gsm_04_08.h>
 
-#include <osmocom/bsc/bsc_msg_filter.h>
-
 #define BSS_SEND_USSD 1
 
 enum bsc_con {
@@ -13,6 +11,7 @@
 	BSC_CON_NO_MEM,
 };
 
+struct msgb;
 struct bsc_msc_data;
 struct gsm0808_channel_type;
 struct gsm0808_speech_codec_list;