Add option to set RADIO LINK TIMEOUT value via VTY
diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h
index 8df7b73..3df5fc4 100644
--- a/openbsc/include/openbsc/gsm_04_08.h
+++ b/openbsc/include/openbsc/gsm_04_08.h
@@ -23,6 +23,20 @@
 				   "GSM 04.08");
 }
 
+static inline int get_radio_link_timeout(struct gsm48_cell_options *cell_options)
+{
+	return (cell_options->radio_link_timeout + 1) << 2;
+}
+
+static inline void set_radio_link_timeout(struct gsm48_cell_options *cell_options, int value)
+{
+	if (value < 4)
+		value = 4;
+	if (value > 64)
+		value = 64;
+	cell_options->radio_link_timeout = (value >> 2) - 1;
+}
+
 /* config options controlling the behaviour of the lower leves */
 void gsm0408_allow_everyone(int allow);
 void gsm0408_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause);
diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index 46d95cc..9c19ec9 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -454,9 +454,6 @@
 		return -EINVAL;
 	}
 
-	/* some defaults for our system information */
-	bts->si_common.cell_options.radio_link_timeout = 7; /* 12 */
-
 	/* allow/disallow DTXu */
 	if (bts->network->dtx_enabled)
 		bts->si_common.cell_options.dtx = 0;
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index af30f39..e3eb7cc 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -543,6 +543,9 @@
 		vty_out(vty, "  periodic location update %u%s",
 			bts->si_common.chan_desc.t3212 * 6, VTY_NEWLINE);
 
+	vty_out(vty, "  radio-link-timeout %d%s",
+		get_radio_link_timeout(&bts->si_common.cell_options),
+		VTY_NEWLINE);
 	vty_out(vty, "  channel allocator %s%s",
 		bts->chan_alloc_reverse ? "descending" : "ascending",
 		VTY_NEWLINE);
@@ -2272,6 +2275,19 @@
 	struct gsm_bts *bts = vty->index;
 
 	bts->si_common.chan_desc.t3212 = 0;
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_radio_link_timeout, cfg_bts_radio_link_timeout_cmd,
+	"radio-link-timeout <4-64>",
+	"Radio link timeout criterion (BTS side)\n"
+	"Radio link timeout value (lost SACCH block)\n")
+{
+	struct gsm_bts *bts = vty->index;
+
+	set_radio_link_timeout(&bts->si_common.cell_options, atoi(argv[0]));
+
 	return CMD_SUCCESS;
 }
 
@@ -3466,6 +3482,7 @@
 	install_element(BTS_NODE, &cfg_bts_temp_ofs_inf_cmd);
 	install_element(BTS_NODE, &cfg_bts_penalty_time_cmd);
 	install_element(BTS_NODE, &cfg_bts_penalty_time_rsvd_cmd);
+	install_element(BTS_NODE, &cfg_bts_radio_link_timeout_cmd);
 	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);
diff --git a/openbsc/src/libcommon/gsm_data.c b/openbsc/src/libcommon/gsm_data.c
index 5fd3ad3..4ce4eca 100644
--- a/openbsc/src/libcommon/gsm_data.c
+++ b/openbsc/src/libcommon/gsm_data.c
@@ -333,6 +333,8 @@
 	bts->si_common.chan_desc.bs_pa_mfrms = RSL_BS_PA_MFRMS_5; /* paging frames */
 	bts->si_common.chan_desc.bs_ag_blks_res = 1; /* reserved AGCH blocks */
 	bts->si_common.chan_desc.t3212 = 5; /* Use 30 min periodic update interval as sane default */
+	set_radio_link_timeout(&bts->si_common.cell_options, 32);
+				/* Use RADIO LINK TIMEOUT of 32 seconds */
 
 	llist_add_tail(&bts->list, &net->bts_list);