aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_nat/bsc_nat.c
diff options
context:
space:
mode:
authorDaniel Willmann <daniel@totalueberwachung.de>2011-08-25 16:58:27 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-09-11 16:20:46 +0200
commit6dc6910b79160caf1d21cb5b3ae4d2383c557aee (patch)
tree69f6f9afa1670dde4d8a4f4440bb207665a0ba5f /openbsc/src/osmo-bsc_nat/bsc_nat.c
parent6088f149b57fd21fd45f61f7976ed0fd61a2611e (diff)
nat: Change the ctrl command path
The commands net.<netid>.bsc.<bscid>.* are now forwarded to the appropriate osmo-bsc. <netid> for now is just 0. <bscid> is not the LAC anymore (since that could be ambiguous), but instead the number as configured in bsc-nat.cfg
Diffstat (limited to 'openbsc/src/osmo-bsc_nat/bsc_nat.c')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index d99a8dd46..fb66449d0 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -1210,11 +1210,8 @@ static int handle_ctrlif_msg(struct bsc_connection *bsc, struct msgb *msg)
if (bsc->cfg && !llist_empty(&bsc->cfg->lac_list)) {
if (cmd->variable) {
- struct bsc_lac_entry *bsc_lac;
- bsc_lac = llist_entry(bsc->cfg->lac_list.next,
- struct bsc_lac_entry, entry);
- var = talloc_asprintf(cmd, "bsc.%i.%s", bsc_lac->lac,
- cmd->variable);
+ var = talloc_asprintf(cmd, "net.0.bsc.%i.%s", bsc->cfg->nr,
+ cmd->variable);
if (!var) {
cmd->type = CTRL_TYPE_ERROR;
cmd->reply = "OOM";
@@ -1608,17 +1605,19 @@ static int forward_to_bsc(struct ctrl_cmd *cmd)
struct ctrl_cmd *bsc_cmd = NULL;
struct bsc_connection *bsc;
struct bsc_cmd_list *pending;
- unsigned int lac;
- char *lac_str, *tmp, *saveptr;
+ unsigned int nr;
+ char *nr_str, *tmp, *saveptr;
/* Skip over the beginning (bsc.) */
tmp = strtok_r(cmd->variable, ".", &saveptr);
- lac_str = strtok_r(NULL, ".", &saveptr);
- if (!lac_str) {
+ tmp = strtok_r(NULL, ".", &saveptr);
+ tmp = strtok_r(NULL, ".", &saveptr);
+ nr_str = strtok_r(NULL, ".", &saveptr);
+ if (!nr_str) {
cmd->reply = "command incomplete";
goto err;
}
- lac = atoi(lac_str);
+ nr = atoi(nr_str);
tmp = strtok_r(NULL, "\0", &saveptr);
if (!tmp) {
@@ -1631,7 +1630,7 @@ static int forward_to_bsc(struct ctrl_cmd *cmd)
continue;
if (!bsc->authenticated)
continue;
- if (bsc_config_handles_lac(bsc->cfg, lac)) {
+ if (bsc->cfg->nr == nr) {
/* Add pending command to list */
pending = talloc_zero(bsc, struct bsc_cmd_list);
if (!pending) {
@@ -1684,7 +1683,7 @@ static int forward_to_bsc(struct ctrl_cmd *cmd)
}
}
/* We end up here if there's no bsc to handle our LAC */
- cmd->reply = "no BSC with this LAC";
+ cmd->reply = "no BSC with this nr";
err:
ret = CTRL_CMD_ERROR;
done:
@@ -1694,7 +1693,7 @@ done:
}
-CTRL_CMD_DEFINE(fwd_cmd, "bsc *");
+CTRL_CMD_DEFINE(fwd_cmd, "net 0 bsc *");
static int get_fwd_cmd(struct ctrl_cmd *cmd, void *data)
{
return forward_to_bsc(cmd);