Move timezone settings up to network level
Time zone used to be configurable per-BTS. In the upcoming MSC-split, no BTS
structures will be available on the MSC level. To simplify, drop the ability to
manage several time zones in a core network and place the time zone config on
the network VTY level, i.e. in gsm_network. If we are going to re-add fine
grained time zone settings, it should probably be tied to the LAC.
Adjust time zone VTY config code (to be moved to libcommon-cs in subsequent commit).
Adjust time zone Ctrl Interface code.
Change-Id: I69848887d92990f3d6f969be80f6ef91f6bdbbe8
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
index 40e1960..f10a74a 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c
@@ -362,18 +362,15 @@
return 1;
}
-CTRL_CMD_DEFINE(bts_timezone, "timezone");
-static int get_bts_timezone(struct ctrl_cmd *cmd, void *data)
+CTRL_CMD_DEFINE(net_timezone, "timezone");
+static int get_net_timezone(struct ctrl_cmd *cmd, void *data)
{
- struct gsm_bts *bts = (struct gsm_bts *) cmd->node;
- if (!bts) {
- cmd->reply = "bts not found.";
- return CTRL_CMD_ERROR;
- }
+ struct gsm_network *net = (struct gsm_network*)cmd->node;
- if (bts->tz.override)
+ struct gsm_tz *tz = &net->tz;
+ if (tz->override)
cmd->reply = talloc_asprintf(cmd, "%d,%d,%d",
- bts->tz.hr, bts->tz.mn, bts->tz.dst);
+ tz->hr, tz->mn, tz->dst);
else
cmd->reply = talloc_asprintf(cmd, "off");
@@ -385,16 +382,11 @@
return CTRL_CMD_REPLY;
}
-static int set_bts_timezone(struct ctrl_cmd *cmd, void *data)
+static int set_net_timezone(struct ctrl_cmd *cmd, void *data)
{
char *saveptr, *hourstr, *minstr, *dststr, *tmp = 0;
int override;
- struct gsm_bts *bts = (struct gsm_bts *) cmd->node;
-
- if (!bts) {
- cmd->reply = "bts not found.";
- return CTRL_CMD_ERROR;
- }
+ struct gsm_network *net = (struct gsm_network*)cmd->node;
tmp = talloc_strdup(cmd, cmd->value);
if (!tmp)
@@ -409,25 +401,26 @@
if (hourstr != NULL)
override = strcasecmp(hourstr, "off") != 0;
- bts->tz.override = override;
+ struct gsm_tz *tz = &net->tz;
+ tz->override = override;
if (override) {
- bts->tz.hr = hourstr ? atol(hourstr) : 0;
- bts->tz.mn = minstr ? atol(minstr) : 0;
- bts->tz.dst = dststr ? atol(dststr) : 0;
+ tz->hr = hourstr ? atol(hourstr) : 0;
+ tz->mn = minstr ? atol(minstr) : 0;
+ tz->dst = dststr ? atol(dststr) : 0;
}
talloc_free(tmp);
tmp = NULL;
- return get_bts_timezone(cmd, data);
+ return get_net_timezone(cmd, data);
oom:
cmd->reply = "OOM";
return CTRL_CMD_ERROR;
}
-static int verify_bts_timezone(struct ctrl_cmd *cmd, const char *value, void *data)
+static int verify_net_timezone(struct ctrl_cmd *cmd, const char *value, void *data)
{
char *saveptr, *hourstr, *minstr, *dststr, *tmp;
int override, tz_hours, tz_mins, tz_dst;
@@ -655,7 +648,7 @@
rc = ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_loc);
if (rc)
goto end;
- rc = ctrl_cmd_install(CTRL_NODE_BTS, &cmd_bts_timezone);
+ rc = ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_net_timezone);
if (rc)
goto end;
rc = ctrl_cmd_install(CTRL_NODE_ROOT, &cmd_msc_connection_status);