diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-01-09 15:44:16 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-07-31 16:46:33 +0200 |
commit | 745b76ee4dc387457568f345a3516ee8b9add806 (patch) | |
tree | 19f93db9c1d6891bca9cb505b76152463ce7f124 | |
parent | 14d1177735bb751aa9e2796c58c1d746a5b0de9c (diff) |
HACK: Allow each BTS to have a different MCC/MNC for testing purposes
-rw-r--r-- | openbsc/configure.ac | 2 | ||||
-rw-r--r-- | openbsc/include/openbsc/gsm_data.h | 7 | ||||
-rw-r--r-- | openbsc/include/openbsc/gsm_data_shared.h | 6 | ||||
-rw-r--r-- | openbsc/include/openbsc/gsm_subscriber.h | 2 | ||||
-rw-r--r-- | openbsc/src/ipaccess/ipaccess-config.c | 2 | ||||
-rw-r--r-- | openbsc/src/libbsc/bsc_init.c | 8 | ||||
-rw-r--r-- | openbsc/src/libbsc/bsc_vty.c | 63 | ||||
-rw-r--r-- | openbsc/src/libbsc/paging.c | 8 | ||||
-rw-r--r-- | openbsc/src/libbsc/system_information.c | 12 | ||||
-rw-r--r-- | openbsc/src/libcommon/gsm_data.c | 9 | ||||
-rw-r--r-- | openbsc/src/libcommon/gsm_data_shared.c | 6 | ||||
-rw-r--r-- | openbsc/src/libmsc/db.c | 12 | ||||
-rw-r--r-- | openbsc/src/libmsc/gsm_04_08.c | 21 | ||||
-rw-r--r-- | openbsc/src/libmsc/gsm_subscriber.c | 2 | ||||
-rw-r--r-- | openbsc/src/utils/bs11_config.c | 2 | ||||
-rw-r--r-- | openbsc/tests/channel/channel_test.c | 2 |
16 files changed, 92 insertions, 72 deletions
diff --git a/openbsc/configure.ac b/openbsc/configure.ac index ce2a32853..87be2b784 100644 --- a/openbsc/configure.ac +++ b/openbsc/configure.ac @@ -40,7 +40,7 @@ AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo B if test "$osmo_ac_build_bsc" = "yes" ; then PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.6) fi -AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes") +AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "NOT_DISABLED") # Enable/disable smpp support in the nitb? AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])], diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 874150535..8419d1f3a 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -203,10 +203,6 @@ enum gsm_auth_policy { struct gsm_network { /* global parameters */ - uint16_t country_code; - uint16_t network_code; - char *name_long; - char *name_short; enum gsm_auth_policy auth_policy; enum gsm48_reject_value reject_cause; int a5_encryption; @@ -327,8 +323,7 @@ struct gsm_sms { char text[SMS_TEXT_SIZE]; }; -struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_code, - int (*mncc_recv)(struct gsm_network *, struct msgb *)); +struct gsm_network *gsm_network_init(int (*mncc_recv)(struct gsm_network *, struct msgb *)); int gsm_set_bts_type(struct gsm_bts *bts, enum gsm_bts_type type); struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num); diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h index 3ef145765..64f50f4e0 100644 --- a/openbsc/include/openbsc/gsm_data_shared.h +++ b/openbsc/include/openbsc/gsm_data_shared.h @@ -705,6 +705,12 @@ struct gsm_bts { int excl_from_rf_lock; #endif /* ROLE_BSC */ void *role; + + /* hacks for some network tweaks... */ + uint16_t country_code; + uint16_t network_code; + char *name_long; + char *name_short; }; diff --git a/openbsc/include/openbsc/gsm_subscriber.h b/openbsc/include/openbsc/gsm_subscriber.h index 6b577b0bf..3e6338524 100644 --- a/openbsc/include/openbsc/gsm_subscriber.h +++ b/openbsc/include/openbsc/gsm_subscriber.h @@ -36,6 +36,8 @@ struct gsm_subscriber { long long unsigned int id; char imsi[GSM_IMSI_LENGTH]; uint32_t tmsi; + uint16_t mnc; + uint16_t mcc; uint16_t lac; char name[GSM_NAME_LENGTH]; char extension[GSM_EXTENSION_LENGTH]; diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c index e66771a1a..b99a1e2a5 100644 --- a/openbsc/src/ipaccess/ipaccess-config.c +++ b/openbsc/src/ipaccess/ipaccess-config.c @@ -983,7 +983,7 @@ int main(int argc, char **argv) } libosmo_abis_init(tall_ctx_config); - bsc_gsmnet = gsm_network_init(1, 1, NULL); + bsc_gsmnet = gsm_network_init(NULL); if (!bsc_gsmnet) exit(1); diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 8fd72cf46..2a185dbc5 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -260,8 +260,8 @@ static void bootstrap_rsl(struct gsm_bts_trx *trx) LOGP(DRSL, LOGL_NOTICE, "bootstrapping RSL for BTS/TRX (%u/%u) " "on ARFCN %u using MCC=%u MNC=%u LAC=%u CID=%u BSIC=%u TSC=%u\n", - trx->bts->nr, trx->nr, trx->arfcn, bsc_gsmnet->country_code, - bsc_gsmnet->network_code, trx->bts->location_area_code, + trx->bts->nr, trx->nr, trx->arfcn, trx->bts->country_code, + trx->bts->network_code, trx->bts->location_area_code, trx->bts->cell_identity, trx->bts->bsic, trx->bts->tsc); if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) { @@ -463,12 +463,10 @@ int bsc_bootstrap_network(int (*mncc_recv)(struct gsm_network *, struct msgb *), int rc; /* initialize our data structures */ - bsc_gsmnet = gsm_network_init(1, 1, mncc_recv); + bsc_gsmnet = gsm_network_init(mncc_recv); if (!bsc_gsmnet) return -ENOMEM; - bsc_gsmnet->name_long = talloc_strdup(bsc_gsmnet, "OpenBSC"); - bsc_gsmnet->name_short = talloc_strdup(bsc_gsmnet, "OpenBSC"); /* our vty command code expects vty->priv to point to a telnet_connection */ dummy_conn.priv = bsc_gsmnet; diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 45df90f5f..7c1bb0abe 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -178,13 +178,8 @@ static void net_dump_vty(struct vty *vty, struct gsm_network *net) { struct pchan_load pl; - vty_out(vty, "BSC is on Country Code %u, Network Code %u " - "and has %u BTS%s", net->country_code, net->network_code, + vty_out(vty, "BSC has %u BTS%s", net->num_bts, VTY_NEWLINE); - vty_out(vty, " Long network name: '%s'%s", - net->name_long, VTY_NEWLINE); - vty_out(vty, " Short network name: '%s'%s", - net->name_short, VTY_NEWLINE); vty_out(vty, " Authentication policy: %s%s", gsm_auth_policy_name(net->auth_policy), VTY_NEWLINE); vty_out(vty, " Location updating reject cause: %u%s", @@ -243,12 +238,16 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts) { struct pchan_load pl; - vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, " + vty_out(vty, "BTS %u is of %s type in band %s, has CI %u MCC %u MNC %u LAC %u, " "BSIC %u, TSC %u and %u TRX%s", bts->nr, btstype2str(bts->type), gsm_band_name(bts->band), - bts->cell_identity, + bts->cell_identity, bts->country_code, bts->network_code, bts->location_area_code, bts->bsic, bts->tsc, bts->num_trx, VTY_NEWLINE); + vty_out(vty, "Long network name: '%s'%s", + bts->name_long, VTY_NEWLINE); + vty_out(vty, "Short network name: '%s'%s", + bts->name_short, VTY_NEWLINE); vty_out(vty, "Description: %s%s", bts->description ? bts->description : "(null)", VTY_NEWLINE); vty_out(vty, "MS Max power: %u dBm%s", bts->ms_max_power, VTY_NEWLINE); @@ -465,6 +464,10 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) vty_out(vty, " type %s%s", btstype2str(bts->type), VTY_NEWLINE); if (bts->description) vty_out(vty, " description %s%s", bts->description, VTY_NEWLINE); + vty_out(vty, " network country code %u%s", bts->country_code, VTY_NEWLINE); + vty_out(vty, " mobile network code %u%s", bts->network_code, VTY_NEWLINE); + vty_out(vty, " short name %s%s", bts->name_short, VTY_NEWLINE); + vty_out(vty, " long name %s%s", bts->name_long, VTY_NEWLINE); vty_out(vty, " band %s%s", gsm_band_name(bts->band), VTY_NEWLINE); vty_out(vty, " cell_identity %u%s", bts->cell_identity, VTY_NEWLINE); vty_out(vty, " location_area_code %u%s", bts->location_area_code, @@ -621,10 +624,6 @@ static int config_write_net(struct vty *vty) struct gsm_network *gsmnet = gsmnet_from_vty(vty); vty_out(vty, "network%s", VTY_NEWLINE); - vty_out(vty, " network country code %u%s", gsmnet->country_code, VTY_NEWLINE); - vty_out(vty, " mobile network code %u%s", gsmnet->network_code, VTY_NEWLINE); - vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE); - vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE); vty_out(vty, " auth policy %s%s", gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE); vty_out(vty, " location updating reject cause %u%s", gsmnet->reject_cause, VTY_NEWLINE); @@ -1132,55 +1131,55 @@ DEFUN(cfg_net, return CMD_SUCCESS; } -DEFUN(cfg_net_ncc, - cfg_net_ncc_cmd, +DEFUN(cfg_bts_ncc, + cfg_bts_ncc_cmd, "network country code <1-999>", "Set the GSM network country code\n" "Country commands\n" CODE_CMD_STR "Network Country Code to use\n") { - struct gsm_network *gsmnet = gsmnet_from_vty(vty); + struct gsm_bts *bts = vty->index; - gsmnet->country_code = atoi(argv[0]); + bts->country_code = atoi(argv[0]); return CMD_SUCCESS; } -DEFUN(cfg_net_mnc, - cfg_net_mnc_cmd, +DEFUN(cfg_bts_mnc, + cfg_bts_mnc_cmd, "mobile network code <0-999>", "Set the GSM mobile network code\n" "Network Commands\n" CODE_CMD_STR "Mobile Network Code to use\n") { - struct gsm_network *gsmnet = gsmnet_from_vty(vty); + struct gsm_bts *bts = vty->index; - gsmnet->network_code = atoi(argv[0]); + bts->network_code = atoi(argv[0]); return CMD_SUCCESS; } -DEFUN(cfg_net_name_short, - cfg_net_name_short_cmd, +DEFUN(cfg_bts_name_short, + cfg_bts_name_short_cmd, "short name NAME", "Set the short GSM network name\n" NAME_CMD_STR NAME_STR) { - struct gsm_network *gsmnet = gsmnet_from_vty(vty); + struct gsm_bts *bts = vty->index; - bsc_replace_string(gsmnet, &gsmnet->name_short, argv[0]); + bsc_replace_string(bts, &bts->name_short, argv[0]); return CMD_SUCCESS; } -DEFUN(cfg_net_name_long, - cfg_net_name_long_cmd, +DEFUN(cfg_bts_name_long, + cfg_bts_name_long_cmd, "long name NAME", "Set the long GSM network name\n" NAME_CMD_STR NAME_STR) { - struct gsm_network *gsmnet = gsmnet_from_vty(vty); + struct gsm_bts *bts = vty->index; - bsc_replace_string(gsmnet, &gsmnet->name_long, argv[0]); + bsc_replace_string(bts, &bts->name_long, argv[0]); return CMD_SUCCESS; } @@ -3005,10 +3004,6 @@ int bsc_vty_init(const struct log_info *cat) install_default(GSMNET_NODE); install_element(GSMNET_NODE, &ournode_exit_cmd); install_element(GSMNET_NODE, &ournode_end_cmd); - install_element(GSMNET_NODE, &cfg_net_ncc_cmd); - install_element(GSMNET_NODE, &cfg_net_mnc_cmd); - install_element(GSMNET_NODE, &cfg_net_name_short_cmd); - install_element(GSMNET_NODE, &cfg_net_name_long_cmd); install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd); install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd); install_element(GSMNET_NODE, &cfg_net_encryption_cmd); @@ -3043,6 +3038,10 @@ int bsc_vty_init(const struct log_info *cat) install_default(BTS_NODE); install_element(BTS_NODE, &ournode_exit_cmd); install_element(BTS_NODE, &ournode_end_cmd); + install_element(BTS_NODE, &cfg_bts_ncc_cmd); + install_element(BTS_NODE, &cfg_bts_mnc_cmd); + install_element(BTS_NODE, &cfg_bts_name_short_cmd); + install_element(BTS_NODE, &cfg_bts_name_long_cmd); install_element(BTS_NODE, &cfg_bts_type_cmd); install_element(BTS_NODE, &cfg_description_cmd); install_element(BTS_NODE, &cfg_no_description_cmd); diff --git a/openbsc/src/libbsc/paging.c b/openbsc/src/libbsc/paging.c index 286c57ba9..2eb2ef636 100644 --- a/openbsc/src/libbsc/paging.c +++ b/openbsc/src/libbsc/paging.c @@ -303,6 +303,10 @@ int paging_request_bts(struct gsm_bts *bts, struct gsm_subscriber *subscr, { int rc; + /* not the right network */ + if (bts->network_code != subscr->mnc || bts->country_code != subscr->mcc) + return 0;; + /* skip all currently inactive TRX */ if (!trx_is_usable(bts->c0)) return 0; @@ -393,6 +397,10 @@ void paging_request_stop(struct gsm_bts *_bts, struct gsm_subscriber *subscr, if (!bts) break; + /* not the right network */ + if (bts->network_code != subscr->mnc || bts->country_code != subscr->mcc) + continue; + /* Stop paging */ if (bts != _bts) _paging_request_stop(bts, subscr, NULL, NULL); diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c index c901a4ae6..06ff6ccf3 100644 --- a/openbsc/src/libbsc/system_information.c +++ b/openbsc/src/libbsc/system_information.c @@ -528,8 +528,8 @@ static int generate_si3(uint8_t *output, struct gsm_bts *bts) si3->header.system_information = GSM48_MT_RR_SYSINFO_3; si3->cell_identity = htons(bts->cell_identity); - gsm48_generate_lai(&si3->lai, bts->network->country_code, - bts->network->network_code, + gsm48_generate_lai(&si3->lai, bts->country_code, + bts->network_code, bts->location_area_code); si3->control_channel_desc = bts->si_common.chan_desc; si3->cell_options = bts->si_common.cell_options; @@ -567,8 +567,8 @@ static int generate_si4(uint8_t *output, struct gsm_bts *bts) si4->header.skip_indicator = 0; si4->header.system_information = GSM48_MT_RR_SYSINFO_4; - gsm48_generate_lai(&si4->lai, bts->network->country_code, - bts->network->network_code, + gsm48_generate_lai(&si4->lai, bts->country_code, + bts->network_code, bts->location_area_code); si4->cell_sel_par = bts->si_common.cell_sel_par; si4->rach_control = bts->si_common.rach_control; @@ -725,8 +725,8 @@ static int generate_si6(uint8_t *output, struct gsm_bts *bts) si6->skip_indicator = 0; si6->system_information = GSM48_MT_RR_SYSINFO_6; si6->cell_identity = htons(bts->cell_identity); - gsm48_generate_lai(&si6->lai, bts->network->country_code, - bts->network->network_code, + gsm48_generate_lai(&si6->lai, bts->country_code, + bts->network_code, bts->location_area_code); si6->cell_options = bts->si_common.cell_options; si6->ncc_permitted = bts->si_common.ncc_permitted; diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c index 5f7e32e73..787ac04c6 100644 --- a/openbsc/src/libcommon/gsm_data.c +++ b/openbsc/src/libcommon/gsm_data.c @@ -70,8 +70,7 @@ int gsm_bts_model_register(struct gsm_bts_model *model) return 0; } -struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_code, - int (*mncc_recv)(struct gsm_network *, struct msgb *)) +struct gsm_network *gsm_network_init(int (*mncc_recv)(struct gsm_network *, struct msgb *)) { struct gsm_network *net; @@ -90,8 +89,6 @@ struct gsm_network *gsm_network_init(uint16_t country_code, uint16_t network_cod net->bsc_data->network = net; INIT_LLIST_HEAD(&net->bsc_data->mscs); - net->country_code = country_code; - net->network_code = network_code; net->num_bts = 0; net->reject_cause = GSM48_REJECT_ROAMING_NOT_ALLOWED; net->T3101 = GSM_T3101_DEFAULT; @@ -419,8 +416,8 @@ struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, enum gsm_bts_typ void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts) { - raid->mcc = bts->network->country_code; - raid->mnc = bts->network->network_code; + raid->mcc = bts->country_code; + raid->mnc = bts->network_code; raid->lac = bts->location_area_code; raid->rac = bts->gprs.rac; } diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c index 1b0814c49..42b61d5a0 100644 --- a/openbsc/src/libcommon/gsm_data_shared.c +++ b/openbsc/src/libcommon/gsm_data_shared.c @@ -261,6 +261,12 @@ struct gsm_bts *gsm_bts_alloc(void *ctx) bts->rach_ldavg_slots = -1; bts->paging.free_chans_need = -1; + /* hacks */ + bts->network_code = 1; + bts->country_code = 1; + bts->name_long = talloc_strdup(bts, "OpenBSC"); + bts->name_short = talloc_strdup(bts, "OpenBSC"); + return bts; } diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 21abce9de..eec76cb88 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -63,6 +63,8 @@ static char *create_stmts[] = { "extension TEXT UNIQUE, " "authorized INTEGER NOT NULL DEFAULT 0, " "tmsi TEXT UNIQUE, " + "mnc INTEGER NOT NULL DEFAULT 0, " + "mcc INTEGER NOT NULL DEFAULT 0, " "lac INTEGER NOT NULL DEFAULT 0, " "expire_lu TIMESTAMP DEFAULT NULL" ")", @@ -635,6 +637,8 @@ static void db_set_from_query(struct gsm_subscriber *subscr, dbi_conn result) strncpy(subscr->extension, string, GSM_EXTENSION_LENGTH); subscr->lac = dbi_result_get_uint(result, "lac"); + subscr->mcc = dbi_result_get_uint(result, "mcc"); + subscr->mnc = dbi_result_get_uint(result, "mnc"); if (!dbi_result_field_is_null(result, "expire_lu")) subscr->expire_lu = dbi_result_get_datetime(result, "expire_lu"); @@ -708,9 +712,9 @@ struct gsm_subscriber *db_get_subscriber(struct gsm_network *net, subscr->id = dbi_result_get_ulonglong(result, "id"); db_set_from_query(subscr, result); - DEBUGP(DDB, "Found Subscriber: ID %llu, IMSI %s, NAME '%s', TMSI %u, EXTEN '%s', LAC %hu, AUTH %u\n", + DEBUGP(DDB, "Found Subscriber: ID %llu, IMSI %s, NAME '%s', TMSI %u, EXTEN '%s', LAC %hu, MNC %u, MCC %u, AUTH %u\n", subscr->id, subscr->imsi, subscr->name, subscr->tmsi, subscr->extension, - subscr->lac, subscr->authorized); + subscr->lac, subscr->mnc, subscr->mcc, subscr->authorized); dbi_result_free(result); get_equipment_by_subscr(subscr); @@ -792,6 +796,8 @@ int db_sync_subscriber(struct gsm_subscriber *subscriber) "authorized = %i, " "tmsi = %s, " "lac = %i, " + "mnc = %u, " + "mcc = %u, " "expire_lu = datetime(%i, 'unixepoch') " "WHERE imsi = %s ", q_name, @@ -799,6 +805,8 @@ int db_sync_subscriber(struct gsm_subscriber *subscriber) subscriber->authorized, q_tmsi, subscriber->lac, + subscriber->mnc, + subscriber->mcc, (int) subscriber->expire_lu, subscriber->imsi); } diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index eea073614..339ca0c33 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -417,8 +417,8 @@ int gsm0408_loc_upd_acc(struct gsm_subscriber_connection *conn, uint32_t tmsi) gh->msg_type = GSM48_MT_MM_LOC_UPD_ACCEPT; lai = (struct gsm48_loc_area_id *) msgb_put(msg, sizeof(*lai)); - gsm48_generate_lai(lai, bts->network->country_code, - bts->network->network_code, bts->location_area_code); + gsm48_generate_lai(lai, bts->country_code, + bts->network_code, bts->location_area_code); mid = msgb_put(msg, GSM48_MID_TMSI_LEN); gsm48_generate_mid_from_tmsi(mid, tmsi); @@ -642,7 +642,6 @@ int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn) { struct msgb *msg = gsm48_msgb_alloc(); struct gsm48_hdr *gh; - struct gsm_network *net = conn->bts->network; struct gsm_bts *bts = conn->bts; uint8_t *ptr8; int name_len, name_pad; @@ -658,7 +657,7 @@ int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn) gh->proto_discr = GSM48_PDISC_MM; gh->msg_type = GSM48_MT_MM_INFO; - if (net->name_long) { + if (bts->name_long) { #if 0 name_len = strlen(net->name_long); /* 10.5.3.5a */ @@ -674,8 +673,8 @@ int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn) /* FIXME: Use Cell Broadcast, not UCS-2, since * UCS-2 is only supported by later revisions of the spec */ #endif - name_len = (strlen(net->name_long)*7)/8; - name_pad = (8 - strlen(net->name_long)*7)%8; + name_len = (strlen(bts->name_long)*7)/8; + name_pad = (8 - strlen(bts->name_long)*7)%8; if (name_pad > 0) name_len++; /* 10.5.3.5a */ @@ -685,11 +684,11 @@ int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn) ptr8[2] = 0x80 | name_pad; /* Cell Broadcast DCS, no CI */ ptr8 = msgb_put(msg, name_len); - gsm_7bit_encode(ptr8, net->name_long); + gsm_7bit_encode(ptr8, bts->name_long); } - if (net->name_short) { + if (bts->name_short) { #if 0 name_len = strlen(net->name_short); /* 10.5.3.5a */ @@ -702,8 +701,8 @@ int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn) for (i = 0; i < name_len; i++) ptr16[i] = htons(net->name_short[i]); #endif - name_len = (strlen(net->name_short)*7)/8; - name_pad = (8 - strlen(net->name_short)*7)%8; + name_len = (strlen(bts->name_short)*7)/8; + name_pad = (8 - strlen(bts->name_short)*7)%8; if (name_pad > 0) name_len++; /* 10.5.3.5a */ @@ -713,7 +712,7 @@ int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn) ptr8[2] = 0x80 | name_pad; /* Cell Broadcast DCS, no CI */ ptr8 = msgb_put(msg, name_len); - gsm_7bit_encode(ptr8, net->name_short); + gsm_7bit_encode(ptr8, bts->name_short); } diff --git a/openbsc/src/libmsc/gsm_subscriber.c b/openbsc/src/libmsc/gsm_subscriber.c index 5ace8f666..36fd50aee 100644 --- a/openbsc/src/libmsc/gsm_subscriber.c +++ b/openbsc/src/libmsc/gsm_subscriber.c @@ -356,6 +356,8 @@ int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts, int reason) s->net = bts->network; /* Indicate "attached to LAC" */ s->lac = bts->location_area_code; + s->mnc = bts->network_code; + s->mcc = bts->country_code; LOGP(DMM, LOGL_INFO, "Subscriber %s ATTACHED LAC=%u\n", subscr_name(s), s->lac); diff --git a/openbsc/src/utils/bs11_config.c b/openbsc/src/utils/bs11_config.c index e8acb461a..65811e9dc 100644 --- a/openbsc/src/utils/bs11_config.c +++ b/openbsc/src/utils/bs11_config.c @@ -893,7 +893,7 @@ int main(int argc, char **argv) handle_options(argc, argv); bts_model_bs11_init(); - gsmnet = gsm_network_init(1, 1, NULL); + gsmnet = gsm_network_init(NULL); if (!gsmnet) { fprintf(stderr, "Unable to allocate gsm network\n"); exit(1); diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c index ab0d9eb0b..556f5893a 100644 --- a/openbsc/tests/channel/channel_test.c +++ b/openbsc/tests/channel/channel_test.c @@ -62,7 +62,7 @@ int main(int argc, char **argv) printf("Testing the gsm_subscriber chan logic\n"); /* Create a dummy network */ - network = gsm_network_init(1, 1, NULL); + network = gsm_network_init(NULL); if (!network) exit(1); bts = gsm_bts_alloc(network); |