Change in osmo-bsc[master]: drop CC 'local-prefix' feature

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Tue May 26 23:57:06 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/18496 )


Change subject: drop CC 'local-prefix' feature
......................................................................

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
---
M include/osmocom/bsc/bsc_msc_data.h
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/gsm_08_08.c
M src/osmo-bsc/gsm_data.c
M src/osmo-bsc/osmo_bsc_vty.c
5 files changed, 0 insertions(+), 180 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/96/18496/1

diff --git a/include/osmocom/bsc/bsc_msc_data.h b/include/osmocom/bsc/bsc_msc_data.h
index c77c562..27eb75d 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 @@
 	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 e6a7708..73c0eb3 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 @@
 /* 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 030808b..e9918ac 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -475,96 +475,6 @@
 	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 @@
 
 	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 @@
 	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 c34f06c..46e26ac 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -248,31 +248,6 @@
 	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 cf995cc..7791212 100644
--- a/src/osmo-bsc/osmo_bsc_vty.c
+++ b/src/osmo-bsc/osmo_bsc_vty.c
@@ -157,9 +157,6 @@
 	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 @@
 	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 @@
 	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);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18496
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Id54afe8ccf0e11b9121a733224054c9565eafb58
Gerrit-Change-Number: 18496
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200526/b795cdaf/attachment.htm>


More information about the gerrit-log mailing list