Disallow changing the type of an existing BTS from the vty

Changing the BTS type is not supported, so don't allow it.

For example, Changing from type sysmobts to type rbs2000
may hit an OSMO_ASSERT in om2k_bts_fsm_alloc()

The default BTS type if osmo-bsc is started with an empty
configuration and the operator issues config terminal->network->bts 0
will be "unknown". This type and only this type can be
changed from the vty config node.

Change-Id: I0df97ef128a1bbd84c787654d1d842dce4dad819
This commit is contained in:
Keith Whyte 2021-02-18 01:32:10 +01:00
parent cdbd7e3bf2
commit e4b52dff39
2 changed files with 6 additions and 0 deletions

View File

@ -2333,6 +2333,9 @@ DEFUN_USRATTR(cfg_bts_type,
int rc;
rc = gsm_set_bts_type(bts, str2btstype(argv[0]));
if (rc == -EBUSY)
vty_out(vty, "%% Changing the type of an existing BTS is not supported.%s",
VTY_NEWLINE);
if (rc < 0)
return CMD_WARNING;

View File

@ -492,6 +492,9 @@ int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type)
{
struct gsm_bts_model *model;
if (bts->type != GSM_BTS_TYPE_UNKNOWN && type != bts->type)
return -EBUSY;
model = bts_model_find(type);
if (!model)
return -EINVAL;