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.
diff --git a/openbsc/src/libbsc/bsc_ctrl_lookup.c b/openbsc/src/libbsc/bsc_ctrl_lookup.c
index 6d3c57c..b504ccc 100644
--- a/openbsc/src/libbsc/bsc_ctrl_lookup.c
+++ b/openbsc/src/libbsc/bsc_ctrl_lookup.c
@@ -51,7 +51,7 @@
 	 * 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 @@
 		*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 @@
 		*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;