aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp <pmaier@sysmocom.de>2017-01-10 14:49:49 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-01-10 15:45:59 +0000
commit4723a195081f0f9ff561e360620ee0ade50a2b39 (patch)
treecce3b4adfdc2b1499397ee2b4953ae86d569d65d
parent962b33ea9d9640bcd0ed0f18c278cc55207d0f46 (diff)
CTRL: make the CTRL-Interface IP address configurable
Currently the IP address where the control interface is bound to is hardcoded to 127.0.0.1. This leads to problems with multiple instances on one and the same machine. This commit integrates the ctrl interface bind option into the VTY, so that we can bind the ctrl interface to any IP address, just like we do it with the VTY already. Change-Id: If51e0c645c0789a4f4a8c51737fb81fb12f80829
-rw-r--r--include/osmo-bts/control_if.h3
-rw-r--r--src/common/bts_ctrl_lookup.c6
-rw-r--r--src/common/main.c7
3 files changed, 12 insertions, 4 deletions
diff --git a/include/osmo-bts/control_if.h b/include/osmo-bts/control_if.h
index 750f6bd7..490c87af 100644
--- a/include/osmo-bts/control_if.h
+++ b/include/osmo-bts/control_if.h
@@ -1,4 +1,5 @@
#pragma once
int bts_ctrl_cmds_install(struct gsm_bts *bts);
-struct ctrl_handle *bts_controlif_setup(struct gsm_bts *bts);
+struct ctrl_handle *bts_controlif_setup(struct gsm_bts *bts,
+ const char *bind_addr, uint16_t port);
diff --git a/src/common/bts_ctrl_lookup.c b/src/common/bts_ctrl_lookup.c
index 3ee9b4a3..f0157e9a 100644
--- a/src/common/bts_ctrl_lookup.c
+++ b/src/common/bts_ctrl_lookup.c
@@ -87,12 +87,14 @@ err_index:
return -ERANGE;
}
-struct ctrl_handle *bts_controlif_setup(struct gsm_bts *bts)
+struct ctrl_handle *bts_controlif_setup(struct gsm_bts *bts,
+ const char *bind_addr, uint16_t port)
{
struct ctrl_handle *hdl;
int rc = 0;
- hdl = ctrl_interface_setup(bts, OSMO_CTRL_PORT_BTS, bts_ctrl_node_lookup);
+ hdl = ctrl_interface_setup_dynip(bts, bind_addr, port,
+ bts_ctrl_node_lookup);
if (!hdl)
return NULL;
diff --git a/src/common/main.c b/src/common/main.c
index f99f196a..00c8b23d 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -50,6 +50,10 @@
#include <osmo-bts/bts_model.h>
#include <osmo-bts/pcu_if.h>
#include <osmo-bts/control_if.h>
+#include <osmocom/ctrl/control_if.h>
+#include <osmocom/ctrl/ports.h>
+#include <osmocom/ctrl/control_vty.h>
+#include <openbsc/ctrl.h>
#include <osmo-bts/oml.h>
int quit = 0;
@@ -237,6 +241,7 @@ int bts_main(int argc, char **argv)
bts_log_init(NULL);
vty_init(&bts_vty_info);
+ ctrl_vty_init(tall_bts_ctx);
handle_options(argc, argv);
@@ -308,7 +313,7 @@ int bts_main(int argc, char **argv)
write_pid_file("osmo-bts");
- bts_controlif_setup(bts);
+ bts_controlif_setup(bts, ctrl_vty_get_bind_addr(), OSMO_CTRL_PORT_BTS);
rc = telnet_init_dynif(tall_bts_ctx, NULL, vty_get_bind_addr(),
g_vty_port_num);