aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2014-08-21 18:25:11 +0200
committerHarald Welte <laforge@gnumonks.org>2014-08-21 18:26:36 +0200
commite263187a3641c7f7ead5a390490c0e89e430ed39 (patch)
treebcf09541fbc870fdc51a2712aa1175652a744020
parent0ad23821316644efb8a72754ed620c15ef313733 (diff)
Fix bsc_ctrl_node_lookup after libctrl changes
As bsc_ctrl_node_lookup() is called for each iteration, the variables 'bts' and 'trx' are no longer static accross multiple calls, which means we need a different way to determine if we are in the right node while matching for a trx or a ts.
-rw-r--r--openbsc/src/libbsc/bsc_ctrl_lookup.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/openbsc/src/libbsc/bsc_ctrl_lookup.c b/openbsc/src/libbsc/bsc_ctrl_lookup.c
index 6d3c57ca0..b504cccd5 100644
--- a/openbsc/src/libbsc/bsc_ctrl_lookup.c
+++ b/openbsc/src/libbsc/bsc_ctrl_lookup.c
@@ -51,7 +51,7 @@ static int bsc_ctrl_node_lookup(void *data, vector vline, int *node_type,
* and/or use strtol to check if number conversion was successful
* Right now something like net.bts_stats will not work */
if (!strcmp(token, "bts")) {
- if (!net)
+ if (*node_type != CTRL_NODE_ROOT || !net)
goto err_missing;
(*i)++;
if (!ctrl_parse_get_num(vline, *i, &num))
@@ -63,8 +63,9 @@ static int bsc_ctrl_node_lookup(void *data, vector vline, int *node_type,
*node_data = bts;
*node_type = CTRL_NODE_BTS;
} else if (!strcmp(token, "trx")) {
- if (!bts)
+ if (*node_type != CTRL_NODE_BTS || !*node_data)
goto err_missing;
+ bts = *node_data;
(*i)++;
if (!ctrl_parse_get_num(vline, *i, &num))
goto err_index;
@@ -75,8 +76,9 @@ static int bsc_ctrl_node_lookup(void *data, vector vline, int *node_type,
*node_data = trx;
*node_type = CTRL_NODE_TRX;
} else if (!strcmp(token, "ts")) {
- if (!trx)
+ if (*node_type != CTRL_NODE_TRX || !*node_data)
goto err_missing;
+ trx = *node_data;
(*i)++;
if (!ctrl_parse_get_num(vline, *i, &num))
goto err_index;