[MERGED] osmo-bts[master]: CTRL: make the CTRL-Interface IP address configurable

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Tue Jan 10 15:46:29 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: CTRL: make the CTRL-Interface IP address configurable
......................................................................


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
---
M include/osmo-bts/control_if.h
M src/common/bts_ctrl_lookup.c
M src/common/main.c
3 files changed, 12 insertions(+), 4 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmo-bts/control_if.h b/include/osmo-bts/control_if.h
index 750f6bd..490c87a 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 3ee9b4a..f0157e9 100644
--- a/src/common/bts_ctrl_lookup.c
+++ b/src/common/bts_ctrl_lookup.c
@@ -87,12 +87,14 @@
 	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 f99f196..00c8b23 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 @@
 
 	bts_log_init(NULL);
 	vty_init(&bts_vty_info);
+	ctrl_vty_init(tall_bts_ctx);
 
 	handle_options(argc, argv);
 
@@ -308,7 +313,7 @@
 
 	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);

-- 
To view, visit https://gerrit.osmocom.org/1558
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If51e0c645c0789a4f4a8c51737fb81fb12f80829
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list