summaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-05-10 13:29:33 +0200
committerHarald Welte <laforge@gnumonks.org>2016-12-02 12:09:17 +0000
commit7398395cc01977aa9b41c2d433b487154b60ce2a (patch)
tree42f69c72e3d0968a5027c3bd62bdc384b0447be2 /openbsc/src/osmo-bsc
parent1a60644eb21a5c50eddc5790444022fd5aa11df8 (diff)
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
Diffstat (limited to 'openbsc/src/osmo-bsc')
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_ctrl.c39
-rw-r--r--openbsc/src/osmo-bsc/osmo_bsc_filter.c15
2 files changed, 24 insertions, 30 deletions
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 @@ err:
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 @@ static int get_bts_timezone(struct ctrl_cmd *cmd, void *data)
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 @@ static int set_bts_timezone(struct ctrl_cmd *cmd, void *data)
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 @@ int bsc_ctrl_cmds_install(struct gsm_network *net)
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);
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_filter.c b/openbsc/src/osmo-bsc/osmo_bsc_filter.c
index 66c6406..d5ca2fd 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_filter.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_filter.c
@@ -270,23 +270,24 @@ static int bsc_patch_mm_info(struct gsm_subscriber_connection *conn,
return 0;
/* Is TZ patching enabled? */
- if (!bts->tz.override)
+ struct gsm_tz *tz = &bts->network->tz;
+ if (!tz->override)
return 0;
/* Convert tz.hr and tz.mn to units */
- if (bts->tz.hr < 0) {
- tzunits = -bts->tz.hr*4;
+ if (tz->hr < 0) {
+ tzunits = -tz->hr*4;
tzbsd |= 0x08;
} else
- tzunits = bts->tz.hr*4;
+ tzunits = tz->hr*4;
- tzunits = tzunits + (bts->tz.mn/15);
+ tzunits = tzunits + (tz->mn/15);
tzbsd |= (tzunits % 10)*0x10 + (tzunits / 10);
/* Convert DST value */
- if (bts->tz.dst >= 0 && bts->tz.dst <= 2)
- dst = bts->tz.dst;
+ if (tz->dst >= 0 && tz->dst <= 2)
+ dst = tz->dst;
if (TLVP_PRESENT(&tp, GSM48_IE_UTC)) {
LOGP(DMSC, LOGL_DEBUG,