Fix various compiler warnings all over the code
diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c
index f2e68aa..1a2e095 100644
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -2013,7 +2013,6 @@
 {
 	struct gsm_bts *bts = ts->trx->bts;
 	struct abis_om_hdr *oh;
-	u_int16_t arfcn = htons(ts->trx->arfcn);
 	u_int8_t zero = 0x00;
 	struct msgb *msg = nm_msgb_alloc();
 	u_int8_t len = 2 + 2;
@@ -2179,7 +2178,7 @@
 {
 	struct abis_om_hdr *oh;
 
-	DEBUGP(DNM, "PEFORM TEST\n");
+	DEBUGP(DNM, "PEFORM TEST %s\n", get_value_string(test_names, test_nr));
 
 	if (!msg)
 		msg = nm_msgb_alloc();
diff --git a/openbsc/src/bsc_api.c b/openbsc/src/bsc_api.c
index 87ab981..0f09aec 100644
--- a/openbsc/src/bsc_api.c
+++ b/openbsc/src/bsc_api.c
@@ -352,7 +352,7 @@
 
 	gh = msgb_l3(msg);
 	if (msgb_l3len(msg) - sizeof(*gh) != 1) {
-		LOGP(DMSC, LOGL_ERROR, "Assignment Compl invalid: %d\n",
+		LOGP(DMSC, LOGL_ERROR, "Assignment Compl invalid: %lu\n",
 		     msgb_l3len(msg) - sizeof(*gh));
 		return;
 	}
@@ -393,7 +393,7 @@
 
 	gh = msgb_l3(msg);
 	if (msgb_l3len(msg) - sizeof(*gh) != 1) {
-		LOGP(DMSC, LOGL_ERROR, "assignemnt failure unhandled: %d\n",
+		LOGP(DMSC, LOGL_ERROR, "assignemnt failure unhandled: %lu\n",
 		     msgb_l3len(msg) - sizeof(*gh));
 		rr_failure = NULL;
 	} else {
diff --git a/openbsc/src/bsc_hack.c b/openbsc/src/bsc_hack.c
index 14e5d86..8c6d30b 100644
--- a/openbsc/src/bsc_hack.c
+++ b/openbsc/src/bsc_hack.c
@@ -37,6 +37,7 @@
 #include <osmocore/talloc.h>
 #include <openbsc/signal.h>
 #include <openbsc/osmo_msc.h>
+#include <openbsc/sms_queue.h>
 #include <openbsc/vty.h>
 
 #include "../bscconfig.h"
@@ -209,6 +210,8 @@
 extern int bts_model_unknown_init(void);
 extern int bts_model_bs11_init(void);
 extern int bts_model_nanobts_init(void);
+extern int bts_model_rbs2k_init(void);
+void talloc_ctx_init(void);
 
 extern enum node_type bsc_vty_go_parent(struct vty *vty);
 
diff --git a/openbsc/src/bsc_vty.c b/openbsc/src/bsc_vty.c
index 6e07a6b..e5e424c 100644
--- a/openbsc/src/bsc_vty.c
+++ b/openbsc/src/bsc_vty.c
@@ -33,6 +33,7 @@
 #include <openbsc/gsm_data.h>
 #include <openbsc/e1_input.h>
 #include <openbsc/abis_nm.h>
+#include <openbsc/abis_om2000.h>
 #include <osmocore/utils.h>
 #include <osmocore/gsm_utils.h>
 #include <openbsc/chan_alloc.h>
diff --git a/openbsc/src/e1_config.c b/openbsc/src/e1_config.c
index 9e191ba..958839d 100644
--- a/openbsc/src/e1_config.c
+++ b/openbsc/src/e1_config.c
@@ -106,7 +106,7 @@
 		oml_link = e1inp_sign_link_create(sign_ts, E1INP_SIGN_OML, trx,
 						  trx->rsl_tei, SAPI_OML);
 		if (!oml_link) {
-			LOGP(DINP, LOGL_ERROR, "TRX (%u/$u) OML link creation "
+			LOGP(DINP, LOGL_ERROR, "TRX (%u/%u) OML link creation "
 				"failed\n", trx->bts->nr, trx->nr);
 			return -ENOMEM;
 		}
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index 668b8e0..b08b375 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -1610,8 +1610,8 @@
 			if (rc < 0)
 				return rc;
 			rc = rsl_ipacc_mdcx_to_rtpsock(remote_lchan);
-#warning do we need a check of rc here?
-
+			if (rc < 0)
+				return rc;
 			/* connect them with each other */
 			rtp_socket_proxy(lchan->abis_ip.rtp_socket,
 					 remote_lchan->abis_ip.rtp_socket);
diff --git a/openbsc/src/gsm_04_08_utils.c b/openbsc/src/gsm_04_08_utils.c
index ca1b472..6d12cc0 100644
--- a/openbsc/src/gsm_04_08_utils.c
+++ b/openbsc/src/gsm_04_08_utils.c
@@ -547,7 +547,6 @@
 int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg)
 {
 	struct gsm48_hdr *gh = msgb_l3(msg);
-	unsigned int payload_len = msgb_l3len(msg) - sizeof(*gh);
 	u_int8_t *data = gh->data;
 	struct gsm_bts *bts = msg->lchan->ts->trx->bts;
 	struct bitvec *nbv = &bts->si_common.neigh_list;
diff --git a/openbsc/src/mgcp/mgcp_main.c b/openbsc/src/mgcp/mgcp_main.c
index 20b9836..091d7bd 100644
--- a/openbsc/src/mgcp/mgcp_main.c
+++ b/openbsc/src/mgcp/mgcp_main.c
@@ -39,7 +39,8 @@
 #include <osmocore/select.h>
 #include <openbsc/mgcp.h>
 #include <openbsc/mgcp_internal.h>
-#include <osmocom/vty//telnet_interface.h>
+#include <osmocom/vty/telnet_interface.h>
+#include <osmocom/vty/logging.h>
 #include <openbsc/vty.h>
 
 #include <osmocom/vty/command.h>
@@ -151,7 +152,7 @@
 		perror("Gateway failed to read");
 		return -1;
 	} else if (slen > sizeof(addr)) {
-		fprintf(stderr, "Gateway received message from outerspace: %d %d\n",
+		fprintf(stderr, "Gateway received message from outerspace: %lu %d\n",
 			slen, sizeof(addr));
 		return -1;
 	}
diff --git a/openbsc/src/vty_interface_layer3.c b/openbsc/src/vty_interface_layer3.c
index 526ae9e..a575274 100644
--- a/openbsc/src/vty_interface_layer3.c
+++ b/openbsc/src/vty_interface_layer3.c
@@ -340,7 +340,6 @@
 	struct gsm_subscriber_connection *conn;
 	struct gsm_network *gsmnet = gsmnet_from_vty(vty);
 	struct gsm_subscriber *subscr = get_subscr_by_argv(gsmnet, argv[0], argv[1]);
-	int rc;
 	int level;
 
 	if (!subscr) {