aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs
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/gprs
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/gprs')
-rw-r--r--openbsc/src/gprs/sgsn_ctrl.c5
-rw-r--r--openbsc/src/gprs/sgsn_main.c31
2 files changed, 23 insertions, 13 deletions
diff --git a/openbsc/src/gprs/sgsn_ctrl.c b/openbsc/src/gprs/sgsn_ctrl.c
index eff94e074..ccf507672 100644
--- a/openbsc/src/gprs/sgsn_ctrl.c
+++ b/openbsc/src/gprs/sgsn_ctrl.c
@@ -73,7 +73,8 @@ int sgsn_ctrl_cmds_install(void)
return rc;
}
-struct ctrl_handle *sgsn_controlif_setup(struct gsm_network *net, uint16_t port)
+struct ctrl_handle *sgsn_controlif_setup(struct gsm_network *net,
+ const char *bind_addr, uint16_t port)
{
- return ctrl_interface_setup(net, port, NULL);
+ return ctrl_interface_setup_dynip(net, bind_addr, port, NULL);
}
diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c
index b10b0b37f..cb762b792 100644
--- a/openbsc/src/gprs/sgsn_main.c
+++ b/openbsc/src/gprs/sgsn_main.c
@@ -47,6 +47,8 @@
#include <osmocom/vty/stats.h>
#include <osmocom/vty/ports.h>
+#include <osmocom/ctrl/control_vty.h>
+
#include <openbsc/signal.h>
#include <openbsc/debug.h>
#include <openbsc/vty.h>
@@ -311,22 +313,12 @@ int main(int argc, char **argv)
logging_vty_add_cmds(&gprs_log_info);
osmo_stats_vty_add_cmds(&gprs_log_info);
sgsn_vty_init();
+ ctrl_vty_init(tall_bsc_ctx);
handle_options(argc, argv);
rate_ctr_init(tall_bsc_ctx);
- ctrl = sgsn_controlif_setup(NULL, OSMO_CTRL_PORT_SGSN);
- if (!ctrl) {
- LOGP(DGPRS, LOGL_ERROR, "Failed to create CTRL interface.\n");
- exit(1);
- }
-
- if (sgsn_ctrl_cmds_install() != 0) {
- LOGP(DGPRS, LOGL_ERROR, "Failed to install CTRL commands.\n");
- exit(1);
- }
-
gprs_ns_set_log_ss(DNS);
bssgp_set_log_ss(DBSSGP);
@@ -362,6 +354,23 @@ int main(int argc, char **argv)
if (rc < 0)
exit(1);
+ /* start control interface after reading config for
+ * ctrl_vty_get_bind_addr() */
+ LOGP(DGPRS, LOGL_NOTICE, "CTRL at %s %d\n",
+ ctrl_vty_get_bind_addr(), OSMO_CTRL_PORT_SGSN);
+ ctrl = sgsn_controlif_setup(NULL, ctrl_vty_get_bind_addr(),
+ OSMO_CTRL_PORT_SGSN);
+ if (!ctrl) {
+ LOGP(DGPRS, LOGL_ERROR, "Failed to create CTRL interface.\n");
+ exit(1);
+ }
+
+ if (sgsn_ctrl_cmds_install() != 0) {
+ LOGP(DGPRS, LOGL_ERROR, "Failed to install CTRL commands.\n");
+ exit(1);
+ }
+
+
rc = sgsn_gtp_init(&sgsn_inst);
if (rc) {
LOGP(DGPRS, LOGL_FATAL, "Cannot bind/listen on GTP socket\n");