[statistics] Keep track of OML/RSL failures of the BTS.
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 2db98de..a2f0e40 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -539,6 +539,10 @@
 		struct counter *rf_fail;
 		struct counter *rll_err;
 	} chan;
+	struct {
+		struct counter *oml_fail;
+		struct counter *rsl_fail;
+	} bts;
 };
 
 enum gsm_auth_policy {
diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c
index fccdb0c..94576b7 100644
--- a/openbsc/src/bsc_init.c
+++ b/openbsc/src/bsc_init.c
@@ -918,6 +918,11 @@
 	case EVT_E1_TEI_DN:
 		LOGP(DMI, LOGL_ERROR, "Lost some E1 TEI link: %d %p\n", type, trx);
 
+		if (type == E1INP_SIGN_OML)
+			counter_inc(trx->bts->network->stats.bts.oml_fail);
+		else if (type == E1INP_SIGN_RSL)
+			counter_inc(trx->bts->network->stats.bts.rsl_fail);
+
 		/*
 		 * free all allocated channels. change the nm_state so the
 		 * trx and trx_ts becomes unusable and chan_alloc.c can not
diff --git a/openbsc/src/gsm_data.c b/openbsc/src/gsm_data.c
index f837c27..4af46e4 100644
--- a/openbsc/src/gsm_data.c
+++ b/openbsc/src/gsm_data.c
@@ -282,6 +282,8 @@
 	net->stats.call.connected = counter_alloc("net.call.connected");
 	net->stats.chan.rf_fail = counter_alloc("net.chan.rf_fail");
 	net->stats.chan.rll_err = counter_alloc("net.chan.rll_err");
+	net->stats.bts.oml_fail = counter_alloc("net.bts.oml_fail");
+	net->stats.bts.rsl_fail = counter_alloc("net.bts.rsl_fail");
 
 	net->mncc_recv = mncc_recv;
 
diff --git a/openbsc/src/vty_interface_cmds.c b/openbsc/src/vty_interface_cmds.c
index 8ade518..671351e 100644
--- a/openbsc/src/vty_interface_cmds.c
+++ b/openbsc/src/vty_interface_cmds.c
@@ -240,6 +240,9 @@
 		counter_get(net->stats.paging.attempted),
 		counter_get(net->stats.paging.completed),
 		counter_get(net->stats.paging.expired), VTY_NEWLINE);
+	vty_out(vty, "BTS failures            : %lu OML, %lu RSL%s",
+		counter_get(net->stats.bts.oml_fail),
+		counter_get(net->stats.bts.rsl_fail), VTY_NEWLINE);
 }
 
 void openbsc_vty_add_cmds()