aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2020-05-22 00:29:16 +0200
committerneels <nhofmeyr@sysmocom.de>2020-05-29 20:16:40 +0000
commitbf4134edaf4e27ce34cbb37f84145141cf0b2135 (patch)
tree9bab3a6e83c1afa7c383f7d638e09194db1eee07
parent962cb637fcb28f684dbd42dbd26eafcf18b9b722 (diff)
drop CC 'local-prefix' feature
It is not entirely clear to me what this used to do once, but I've stumbled upon this before. By now I am certain that this is a non-standard legacy feature. The BSC does *not* redirect connections during CC transactions. Along with this, a bunch of legacy utility functions can be dropped. All of this is unused code. (Preparing for MSC pooling.) Change-Id: Id54afe8ccf0e11b9121a733224054c9565eafb58
-rw-r--r--include/osmocom/bsc/bsc_msc_data.h6
-rw-r--r--include/osmocom/bsc/gsm_data.h7
-rw-r--r--src/osmo-bsc/gsm_08_08.c122
-rw-r--r--src/osmo-bsc/gsm_data.c25
-rw-r--r--src/osmo-bsc/osmo_bsc_vty.c20
5 files changed, 0 insertions, 180 deletions
diff --git a/include/osmocom/bsc/bsc_msc_data.h b/include/osmocom/bsc/bsc_msc_data.h
index c77c562c4..27eb75d51 100644
--- a/include/osmocom/bsc/bsc_msc_data.h
+++ b/include/osmocom/bsc/bsc_msc_data.h
@@ -45,7 +45,6 @@
#include <osmocom/core/fsm.h>
#include <osmocom/gsm/gsm23003.h>
-#include <regex.h>
#include <errno.h>
struct osmo_bsc_rf;
@@ -121,11 +120,6 @@ struct bsc_msc_data {
int allow_emerg;
int type;
- /* local call routing */
- char *local_pref;
- regex_t local_pref_reg;
-
-
/* Connection data */
struct osmo_plmn_id core_plmn;
int core_lac;
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 07a0c9d8a..47849357f 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -2,7 +2,6 @@
#define _GSM_DATA_H
#include <stdint.h>
-#include <regex.h>
#include <sys/types.h>
#include <stdbool.h>
#include <stdint.h>
@@ -1362,12 +1361,6 @@ void gsm48_lchan2chan_desc_as_configured(struct gsm48_chan_desc *cd, const struc
/* return the gsm_lchan for the CBCH (if it exists at all) */
struct gsm_lchan *gsm_bts_get_cbch(struct gsm_bts *bts);
-/*
- * help with parsing regexps
- */
-int gsm_parse_reg(void *ctx, regex_t *reg, char **str,
- int argc, const char **argv) __attribute__ ((warn_unused_result));
-
static inline uint8_t gsm_ts_tsc(const struct gsm_bts_trx_ts *ts)
{
if (ts->tsc != -1)
diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index 030808b06..e9918ac47 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -475,96 +475,6 @@ early_fail:
return false;
}
-static int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause);
-
-/*
- * Plastic surgery... we want to give up the current connection
- */
-static int move_to_msc(struct gsm_subscriber_connection *_conn,
- struct msgb *msg, struct bsc_msc_data *msc)
-{
- /*
- * 1. Give up the old connection.
- * This happens by sending a clear request to the MSC,
- * it should end with the MSC releasing the connection.
- */
- bsc_clear_request(_conn, 0);
-
- /*
- * 2. Attempt to create a new connection to the local
- * MSC. If it fails the caller will need to handle this
- * properly.
- */
- if (!complete_layer3(_conn, msg, msc)) {
- /* FIXME: I have not the slightest idea what move_to_msc() intends to do; during lchan
- * FSM introduction, I changed this and hope it is the appropriate action. I actually
- * assume this is unused legacy code for osmo-bsc_nat?? */
- gscon_release_lchans(_conn, false);
- return 1;
- }
-
- return 2;
-}
-
-static int handle_cc_setup(struct gsm_subscriber_connection *conn,
- struct msgb *msg)
-{
- struct gsm48_hdr *gh = msgb_l3(msg);
- uint8_t pdisc = gsm48_hdr_pdisc(gh);
- uint8_t mtype = gsm48_hdr_msg_type(gh);
-
- struct bsc_msc_data *msc;
- struct gsm_mncc_number called;
- struct tlv_parsed tp;
- unsigned payload_len;
-
- char _dest_nr[35];
-
- /*
- * Do we have a setup message here? if not return fast.
- */
- if (pdisc != GSM48_PDISC_CC || mtype != GSM48_MT_CC_SETUP)
- return 0;
-
- payload_len = msgb_l3len(msg) - sizeof(*gh);
-
- tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0);
- if (!TLVP_PRESENT(&tp, GSM48_IE_CALLED_BCD)) {
- LOGP(DMSC, LOGL_ERROR, "Called BCD not present in setup.\n");
- return -1;
- }
-
- memset(&called, 0, sizeof(called));
- gsm48_decode_called(&called,
- TLVP_VAL(&tp, GSM48_IE_CALLED_BCD) - 1);
-
- if (called.plan != 1 && called.plan != 0)
- return 0;
-
- if (called.plan == 1 && called.type == 1) {
- _dest_nr[0] = _dest_nr[1] = '0';
- memcpy(_dest_nr + 2, called.number, sizeof(called.number));
- } else
- memcpy(_dest_nr, called.number, sizeof(called.number));
-
- /*
- * Check if the connection should be moved...
- */
- llist_for_each_entry(msc, &conn_get_bts(conn)->network->bsc_data->mscs, entry) {
- if (msc->type != MSC_CON_TYPE_LOCAL)
- continue;
- if (!msc->local_pref)
- continue;
- if (regexec(&msc->local_pref_reg, _dest_nr, 0, NULL, 0) != 0)
- continue;
-
- return move_to_msc(conn, msg, msc);
- }
-
- return 0;
-}
-
-
/*! MS->BSC/MSC: Um L3 message. */
void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg)
{
@@ -575,13 +485,6 @@ void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct ms
LOGP(DMSC, LOGL_INFO, "Tx MSC DTAP LINK_ID=0x%02x\n", link_id);
- /*
- * We might want to move this connection to a new MSC. Ask someone
- * to handle it. If it was handled we will return.
- */
- if (handle_cc_setup(conn, msg) >= 1)
- goto done;
-
bsc_scan_bts_msg(conn, msg);
/* Store link_id in msg->cb */
@@ -592,31 +495,6 @@ done:
return;
}
-/*! BSSMAP Clear Request for legacy code paths, instead see gscon_bssmap_clear(). */
-static int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause)
-{
- int rc;
- struct msgb *resp;
-
- if (!msc_connected(conn))
- return 1;
-
- LOGP(DMSC, LOGL_INFO, "Tx MSC CLEAR REQUEST\n");
-
- resp = gsm0808_create_clear_rqst(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE);
- if (!resp) {
- LOGP(DMSC, LOGL_ERROR, "Failed to allocate response.\n");
- return 1;
- }
-
- rate_ctr_inc(&conn->sccp.msc->msc_ctrs->ctr[MSC_CTR_BSSMAP_TX_DT1_CLEAR_RQST]);
- rc = osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_TX_SCCP, resp);
- if (rc != 0)
- msgb_free(resp);
-
- return 1;
-}
-
/*! BSC->MSC: Classmark Update. */
void bsc_cm_update(struct gsm_subscriber_connection *conn,
const uint8_t *cm2, uint8_t cm2_len,
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index c34f06cb1..46e26acff 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -248,31 +248,6 @@ void gsm48_ra_id_by_bts(struct gsm48_ra_id *buf, struct gsm_bts *bts)
gsm48_encode_ra(buf, &raid);
}
-int gsm_parse_reg(void *ctx, regex_t *reg, char **str, int argc, const char **argv)
-{
- int ret;
-
- ret = 0;
- if (*str) {
- talloc_free(*str);
- *str = NULL;
- }
- regfree(reg);
-
- if (argc > 0) {
- *str = talloc_strdup(ctx, argv[0]);
- ret = regcomp(reg, argv[0], REG_NOSUB);
-
- /* handle compilation failures */
- if (ret != 0) {
- talloc_free(*str);
- *str = NULL;
- }
- }
-
- return ret;
-}
-
/* Assume there are only 256 possible bts */
osmo_static_assert(sizeof(((struct gsm_bts *) 0)->nr) == 1, _bts_nr_is_256);
static void depends_calc_index_bit(int bts_nr, int *idx, int *bit)
diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c
index cf995cc2d..779121220 100644
--- a/src/osmo-bsc/osmo_bsc_vty.c
+++ b/src/osmo-bsc/osmo_bsc_vty.c
@@ -157,9 +157,6 @@ static void write_msc(struct vty *vty, struct bsc_msc_data *msc)
vty_out(vty, " allow-emergency %s%s", msc->allow_emerg ?
"allow" : "deny", VTY_NEWLINE);
- if (msc->local_pref)
- vty_out(vty, " local-prefix %s%s", msc->local_pref, VTY_NEWLINE);
-
/* write amr options */
write_msc_amr_options(vty, msc);
@@ -482,22 +479,6 @@ DEFUN(cfg_net_msc_emerg,
return CMD_SUCCESS;
}
-DEFUN(cfg_net_msc_local_prefix,
- cfg_net_msc_local_prefix_cmd,
- "local-prefix REGEXP",
- "Prefix for local numbers\n" "REGEXP used\n")
-{
- struct bsc_msc_data *msc = bsc_msc_data(vty);
-
- if (gsm_parse_reg(msc, &msc->local_pref_reg, &msc->local_pref, argc, argv) != 0) {
- vty_out(vty, "%%Failed to parse the regexp: '%s'%s",
- argv[0], VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- return CMD_SUCCESS;
-}
-
#define AMR_CONF_STR "AMR Multirate Configuration\n"
#define AMR_COMMAND(name) \
DEFUN(cfg_net_msc_amr_##name, \
@@ -961,7 +942,6 @@ int bsc_vty_init_extra(void)
install_element(MSC_NODE, &cfg_net_msc_no_grace_ussd_cmd);
install_element(MSC_NODE, &cfg_net_msc_type_cmd);
install_element(MSC_NODE, &cfg_net_msc_emerg_cmd);
- install_element(MSC_NODE, &cfg_net_msc_local_prefix_cmd);
install_element(MSC_NODE, &cfg_net_msc_amr_12_2_cmd);
install_element(MSC_NODE, &cfg_net_msc_amr_10_2_cmd);
install_element(MSC_NODE, &cfg_net_msc_amr_7_95_cmd);