Add VTY option to set GPRS network-control-order to enable MS measurements

In order to enable GPRS downlink measurements at mobile, the
network-control-order must be set to nc1.
diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h
index 83758b1..f5ab473 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -658,6 +658,7 @@
 		} cell;
 		struct gsm_bts_gprs_nsvc nsvc[2];
 		uint8_t rac;
+		uint8_t net_ctrl_ord;
 	} gprs;
 
 	/* RACH NM values */
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 8027a63..0875e1a 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -418,6 +418,8 @@
 
 	vty_out(vty, "  gprs routing area %u%s", bts->gprs.rac,
 		VTY_NEWLINE);
+	vty_out(vty, "  gprs network-control-order nc%u%s",
+		bts->gprs.net_ctrl_ord, VTY_NEWLINE);
 	vty_out(vty, "  gprs cell bvci %u%s", bts->gprs.cell.bvci,
 		VTY_NEWLINE);
 	for (i = 0; i < ARRAY_SIZE(bts->gprs.cell.timer); i++)
@@ -2288,6 +2290,26 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_bts_gprs_net_ctrl_ord, cfg_bts_gprs_net_ctrl_ord_cmd,
+	"gprs network-control-order (nc0|nc1|nc2)",
+	GPRS_TEXT
+	"GPRS Network Control Order\n"
+	"MS controlled cell re-selection, no measurement reporting\n"
+	"MS controlled cell re-selection, MS sends measurement reports\n"
+	"Network controlled cell re-selection, MS sends measurement reports\n")
+{
+	struct gsm_bts *bts = vty->index;
+
+	if (bts->gprs.mode == BTS_GPRS_NONE) {
+		vty_out(vty, "%% GPRS not enabled on this BTS%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	bts->gprs.net_ctrl_ord = atoi(argv[0] + 2);
+
+	return CMD_SUCCESS;
+}
+
 DEFUN(cfg_bts_gprs_mode, cfg_bts_gprs_mode_cmd,
 	"gprs mode (none|gprs|egprs)",
 	GPRS_TEXT
@@ -3082,6 +3104,7 @@
 	install_element(BTS_NODE, &cfg_bts_gprs_mode_cmd);
 	install_element(BTS_NODE, &cfg_bts_gprs_ns_timer_cmd);
 	install_element(BTS_NODE, &cfg_bts_gprs_rac_cmd);
+	install_element(BTS_NODE, &cfg_bts_gprs_net_ctrl_ord_cmd);
 	install_element(BTS_NODE, &cfg_bts_gprs_bvci_cmd);
 	install_element(BTS_NODE, &cfg_bts_gprs_cell_timer_cmd);
 	install_element(BTS_NODE, &cfg_bts_gprs_nsei_cmd);
diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c
index acf7134..88b81dc 100644
--- a/openbsc/src/libbsc/system_information.c
+++ b/openbsc/src/libbsc/system_information.c
@@ -791,6 +791,7 @@
 	si13->header.system_information = GSM48_MT_RR_SYSINFO_13;
 
 	si13_default.no_pbcch.rac = bts->gprs.rac;
+	si13_default.no_pbcch.net_ctrl_ord = bts->gprs.net_ctrl_ord;
 
 	ret = rest_octets_si13(si13->rest_octets, &si13_default);
 	if (ret < 0)