diff options
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/include/openbsc/gsm_data.h | 14 | ||||
-rw-r--r-- | openbsc/src/osmo-bsc/osmo_bsc_ctrl.c | 25 | ||||
-rw-r--r-- | openbsc/src/osmo-bsc/osmo_bsc_filter.c | 15 | ||||
-rw-r--r-- | openbsc/src/osmo-bsc/osmo_bsc_main.c | 8 | ||||
-rw-r--r-- | openbsc/tests/bsc/bsc_test.c | 10 |
5 files changed, 46 insertions, 26 deletions
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index a1085f6c7..74f91b164 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -235,6 +235,13 @@ enum gsm_auth_policy { #define GSM_T3113_DEFAULT 60 #define GSM_T3122_DEFAULT 10 +struct gsm_tz { + int override; /* if 0, use system's time zone instead. */ + int hr; /* hour */ + int mn; /* minute */ + int dst; /* daylight savings */ +}; + struct gsm_network { /* global parameters */ uint16_t country_code; @@ -327,12 +334,7 @@ struct gsm_network { /* TODO: in OsmoNITB, tz-override used to be BTS-specific. To enable * BTS|RNC specific timezone overrides for multi-tz networks in * OsmoCSCN, this should be tied to the location area code (LAC). */ - struct { - int override; /* if 0, use system's time zone instead. */ - int hr; /* hour */ - int mn; /* minute */ - int dst; /* daylight savings */ - } tz; + struct gsm_tz tz; /* Periodic location update default value */ uint8_t t3212; diff --git a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c index 3010b5591..4221e5917 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_ctrl.c @@ -371,9 +371,10 @@ static int get_bts_timezone(struct ctrl_cmd *cmd, void *data) return CTRL_CMD_ERROR; } - if (bts->tz.override) + struct gsm_tz *tz = &bts->network->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,8 +386,19 @@ static int get_bts_timezone(struct ctrl_cmd *cmd, void *data) return CTRL_CMD_REPLY; } +/* Note: it may appear that set_bts_timezone() is never used, but is in in fact + * used by CTRL_CMD_DEFINE(bts_timezone, "timezone"); above. */ static int set_bts_timezone(struct ctrl_cmd *cmd, void *data) { + /* FIXME: in the course of MSCSPLIT, the osmo CN no longer has access + * to the BTS structs, and hence the timezone override was moved to the + * network level. It does of course still make sense to allow adjusting + * the timezone per BTS in osmo-bsc. This function currently modifies + * the global timezone data on network level, thus having an effect on + * all other BTSs at the same time. I'm doing it this way because I'm + * focusing on IuCS and the MSCSPLIT and hope to do this properly + * at a later time. Sorry about that... ~Neels */ + char *saveptr, *hourstr, *minstr, *dststr, *tmp = 0; int override; struct gsm_bts *bts = (struct gsm_bts *) cmd->node; @@ -409,12 +421,13 @@ 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 = &bts->network->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); diff --git a/openbsc/src/osmo-bsc/osmo_bsc_filter.c b/openbsc/src/osmo-bsc/osmo_bsc_filter.c index 389a124fd..b68fccd18 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, diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c index 2ee5fb44e..c23af1436 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_main.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c @@ -219,8 +219,12 @@ int main(int argc, char **argv) /* initialize SCCP */ sccp_set_log_area(DSCCP); - - rc = bsc_bootstrap_network(NULL, config_file); + rc = bsc_network_init(NULL); + if (rc) { + fprintf(stderr, "Allocation failed. exiting.\n"); + exit(1); + } + rc = bsc_network_configure(config_file); if (rc < 0) { fprintf(stderr, "Bootstrapping the network failed. exiting.\n"); exit(1); diff --git a/openbsc/tests/bsc/bsc_test.c b/openbsc/tests/bsc/bsc_test.c index d032f61b4..0a14a06e3 100644 --- a/openbsc/tests/bsc/bsc_test.c +++ b/openbsc/tests/bsc/bsc_test.c @@ -139,7 +139,7 @@ static void test_scan(void) conn->bts = bts; conn->sccp_con = sccp_con; - /* start testinh with proper messages */ + /* start testing with proper messages */ printf("Testing BTS<->MSC message scan.\n"); for (i = 0; i < ARRAY_SIZE(test_scan_defs); ++i) { const struct test_definition *test_def = &test_scan_defs[i]; @@ -147,10 +147,10 @@ static void test_scan(void) struct msgb *msg = msgb_alloc(4096, "test-message"); int is_set = 0; - bts->tz.hr = get_int(test_def->params, test_def->n_params, "tz_hr", 0, &is_set); - bts->tz.mn = get_int(test_def->params, test_def->n_params, "tz_mn", 0, &is_set); - bts->tz.dst = get_int(test_def->params, test_def->n_params, "tz_dst", 0, &is_set); - bts->tz.override = 1; + net->tz.hr = get_int(test_def->params, test_def->n_params, "tz_hr", 0, &is_set); + net->tz.mn = get_int(test_def->params, test_def->n_params, "tz_mn", 0, &is_set); + net->tz.dst = get_int(test_def->params, test_def->n_params, "tz_dst", 0, &is_set); + net->tz.override = 1; printf("Going to test item: %d\n", i); msg->l3h = msgb_put(msg, test_def->length); |