Add control interface

* add libosmoctrl dependency
* bind control interface

Change-Id: I4637e88da00bac1ab0237c29ac73806d024863ba
diff --git a/src/hnbgw.c b/src/hnbgw.c
index 5f5c311..a66f14a 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -41,7 +41,10 @@
 #include <osmocom/core/socket.h>
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/write_queue.h>
-
+#include <osmocom/ctrl/control_if.h>
+#include <osmocom/ctrl/control_cmd.h>
+#include <osmocom/ctrl/control_vty.h>
+#include <osmocom/ctrl/ports.h>
 #include <osmocom/vty/telnet_interface.h>
 #include <osmocom/vty/logging.h>
 #include <osmocom/vty/command.h>
@@ -477,6 +480,13 @@
 		exit(1);
 	}
 
+	g_hnb_gw->ctrl = ctrl_interface_setup_dynip(NULL, ctrl_vty_get_bind_addr(), OSMO_CTRL_PORT_HNBGW, NULL);
+	if (!g_hnb_gw->ctrl) {
+		LOGP(DMAIN, LOGL_ERROR, "Failed to create CTRL interface on %s:%u\n",
+		     ctrl_vty_get_bind_addr(), OSMO_CTRL_PORT_HNBGW);
+		exit(1);
+	}
+
 	ranap_set_log_area(DRANAP);
 
 	rc = hnbgw_cnlink_init(g_hnb_gw, "127.0.0.1", M3UA_PORT, NULL);