[handover] add VTY parameter to enable/disable handover
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 67465e4..f4e4d21 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -452,6 +452,9 @@
 	int a5_encryption;
 	int neci;
 	int send_mm_info;
+	struct {
+		int active;
+	} handover;
 
 	/* layer 4 */
 	int (*mncc_recv) (struct gsm_network *net, int msg_type, void *arg);
diff --git a/openbsc/src/handover_decision.c b/openbsc/src/handover_decision.c
index 3605a8e..4c08c66 100644
--- a/openbsc/src/handover_decision.c
+++ b/openbsc/src/handover_decision.c
@@ -88,15 +88,19 @@
 		}
 	}
 
-	if (mr_cell) {
-		LOGP(DHO, LOGL_INFO, "Cell on ARFCN %u is better, starting "
-		     "handover\n", mr_cell->arfcn);
-		return handover_to_arfcn_bsic(mr->lchan, mr_cell->arfcn,
-						mr_cell->bsic);
+	if (!mr_cell) {
+		DEBUGPC(DHO, "No better cell\n");
+		return 0;
 	}
 
-	DEBUGPC(DHO, "No better cell\n");
-	return 0;
+	LOGP(DHO, LOGL_INFO, "Cell on ARFCN %u is better: ", mr_cell->arfcn);
+	if (!mr->lchan->ts->trx->bts->network->handover.active) {
+		LOGPC(DHO, LOGL_INFO, "Skipping, Handover disabled\n");
+		return 0;
+	}
+
+	LOGPC(DHO, LOGL_INFO, "Starting handover\n");
+	return handover_to_arfcn_bsic(mr->lchan, mr_cell->arfcn, mr_cell->bsic);
 }
 
 static int ho_dec_sig_cb(unsigned int subsys, unsigned int signal,
diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c
index d5344ed..20df909 100644
--- a/openbsc/src/vty_interface.c
+++ b/openbsc/src/vty_interface.c
@@ -95,6 +95,8 @@
 		VTY_NEWLINE);
 	vty_out(vty, "  MM Info: %s%s", net->send_mm_info ? "On" : "Off",
 		VTY_NEWLINE);
+	vty_out(vty, "  Handover: %s%s", net->handover.active ? "On" : "Off",
+		VTY_NEWLINE);
 }
 
 DEFUN(show_net, show_net_cmd, "show network",
@@ -296,6 +298,7 @@
 	vty_out(vty, " rrlp mode %s%s", rrlp_mode_name(gsmnet->rrlp.mode),
 		VTY_NEWLINE);
 	vty_out(vty, " mm info %u%s", gsmnet->send_mm_info, VTY_NEWLINE);
+	vty_out(vty, " handover %u%s", gsmnet->handover.active, VTY_NEWLINE);
 	vty_out(vty, " timer t3101 %u%s", gsmnet->T3101, VTY_NEWLINE);
 	vty_out(vty, " timer t3103 %u%s", gsmnet->T3103, VTY_NEWLINE);
 	vty_out(vty, " timer t3105 %u%s", gsmnet->T3105, VTY_NEWLINE);
@@ -863,6 +866,16 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_net_handover, cfg_net_handover_cmd,
+      "handover (0|1)",
+	"Whether or not to use in-call handover")
+{
+	gsmnet->handover.active = atoi(argv[0]);
+
+	return CMD_SUCCESS;
+}
+
+
 #define DECLARE_TIMER(number) \
     DEFUN(cfg_net_T##number,					\
       cfg_net_T##number##_cmd,					\
@@ -1371,6 +1384,7 @@
 	install_element(GSMNET_NODE, &cfg_net_neci_cmd);
 	install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
 	install_element(GSMNET_NODE, &cfg_net_mm_info_cmd);
+	install_element(GSMNET_NODE, &cfg_net_handover_cmd);
 	install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
 	install_element(GSMNET_NODE, &cfg_net_T3103_cmd);
 	install_element(GSMNET_NODE, &cfg_net_T3105_cmd);