summaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_nat
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-23 15:10:33 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-25 12:18:04 +0100
commit73828152d9472d5977a18491f2d9ca9b24077f43 (patch)
tree72d54bdd16bd2efa3f750825bff79771b7310fe7 /openbsc/src/osmo-bsc_nat
parentfc7add20e1b54e1b0d10c7457629507fb62d7d31 (diff)
enable ctrl bind config for various programs
Add ctrl_vty_init() calls and feed the ctrl_vty_get_bind_addr() return value to ctrl_interface_setup() in the following programs: osmo-bsc osmo-bsc_nat osmo-nitb osmo-sgsn For osmo-sgsn, move the control interface setup invocation below the config parsing, so that the ctrl_vty_get_bind_addr() can return the configured address.
Diffstat (limited to 'openbsc/src/osmo-bsc_nat')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c9
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c5
2 files changed, 11 insertions, 3 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index 04c12e3..cdab406 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -52,6 +52,7 @@
#include <osmocom/ctrl/control_cmd.h>
#include <osmocom/ctrl/control_if.h>
#include <osmocom/ctrl/ports.h>
+#include <osmocom/ctrl/control_vty.h>
#include <osmocom/crypt/auth.h>
@@ -1618,6 +1619,7 @@ int main(int argc, char **argv)
logging_vty_add_cmds(&log_info);
osmo_stats_vty_add_cmds(&log_info);
bsc_nat_vty_init(nat);
+ ctrl_vty_init(tall_bsc_ctx);
/* parse options */
@@ -1664,7 +1666,12 @@ int main(int argc, char **argv)
exit(1);
}
- nat->ctrl = bsc_nat_controlif_setup(nat, OSMO_CTRL_PORT_BSC_NAT);
+ /* start control interface after reading config for
+ * ctrl_vty_get_bind_addr() */
+ LOGP(DNAT, LOGL_NOTICE, "CTRL at %s %d\n",
+ ctrl_vty_get_bind_addr(), OSMO_CTRL_PORT_BSC_NAT);
+ nat->ctrl = bsc_nat_controlif_setup(nat, ctrl_vty_get_bind_addr(),
+ OSMO_CTRL_PORT_BSC_NAT);
if (!nat->ctrl) {
fprintf(stderr, "Creating the control interface failed.\n");
exit(1);
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
index f3ca924..ec4243e 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
@@ -470,13 +470,14 @@ static int get_net_save_cmd(struct ctrl_cmd *cmd, void *data)
return CTRL_CMD_ERROR;
}
-struct ctrl_handle *bsc_nat_controlif_setup(struct bsc_nat *nat, int port)
+struct ctrl_handle *bsc_nat_controlif_setup(struct bsc_nat *nat,
+ const char *bind_addr, int port)
{
struct ctrl_handle *ctrl;
int rc;
- ctrl = bsc_controlif_setup(NULL, OSMO_CTRL_PORT_BSC_NAT);
+ ctrl = bsc_controlif_setup(NULL, bind_addr, OSMO_CTRL_PORT_BSC_NAT);
if (!ctrl) {
fprintf(stderr, "Failed to initialize the control interface. Exiting.\n");
return NULL;