aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2017-07-11 01:42:41 +0630
committerHarald Welte <laforge@gnumonks.org>2017-08-13 22:38:04 +0000
commit84fe989151e00089c674658532ecfa5a7cacc173 (patch)
tree780e30bd0f3e5ec07838853727a82122d87cce40 /openbsc/src
parentcf123c0c4e43c3cad124d535afaf97c9578dcd81 (diff)
libcommon: Fix log output for bts>0.
Fixes regression probably introduced in c696cc28. For bts>0 logging doesn't show bts number correctly when printing lchan identification string - it will always show it as "bts=0". The reason for this is that the identification string is cached before bts->nr value is set to a proper value. This patch sets bts->nr as part of the first step of the bts structure initialization, before caching happens thus making sure the cached identification string is cached with the correct values. Change-Id: I61c18a7f021fcb1ec00d34a745f4e3ab03416c2d
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/libcommon/gsm_data.c5
-rw-r--r--openbsc/src/libcommon/gsm_data_shared.c3
2 files changed, 5 insertions, 3 deletions
diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c
index db7de082d..f1049e92b 100644
--- a/openbsc/src/libcommon/gsm_data.c
+++ b/openbsc/src/libcommon/gsm_data.c
@@ -286,12 +286,13 @@ struct gsm_bts *gsm_bts_alloc_register(struct gsm_network *net, enum gsm_bts_typ
if (!model && type != GSM_BTS_TYPE_UNKNOWN)
return NULL;
- bts = gsm_bts_alloc(net);
+ bts = gsm_bts_alloc(net, net->num_bts);
if (!bts)
return NULL;
+ net->num_bts++;
+
bts->network = net;
- bts->nr = net->num_bts++;
bts->type = type;
bts->model = model;
bts->bsic = bsic;
diff --git a/openbsc/src/libcommon/gsm_data_shared.c b/openbsc/src/libcommon/gsm_data_shared.c
index 89926364c..d792f3bc4 100644
--- a/openbsc/src/libcommon/gsm_data_shared.c
+++ b/openbsc/src/libcommon/gsm_data_shared.c
@@ -312,7 +312,7 @@ static const struct gprs_rlc_cfg rlc_cfg_default = {
.initial_mcs = 6,
};
-struct gsm_bts *gsm_bts_alloc(void *ctx)
+struct gsm_bts *gsm_bts_alloc(void *ctx, uint8_t bts_num)
{
struct gsm_bts *bts = talloc_zero(ctx, struct gsm_bts);
int i;
@@ -320,6 +320,7 @@ struct gsm_bts *gsm_bts_alloc(void *ctx)
if (!bts)
return NULL;
+ bts->nr = bts_num;
bts->num_trx = 0;
INIT_LLIST_HEAD(&bts->trx_list);
bts->ms_max_power = 15; /* dBm */