Make RSL connection attempts time out.

If a BTS/TRX does not respond to the "IPA RSL Connect" command,
pretend that the BTS has sent a NACK for the connection.

To ensure that osmo_timer_del(&trx->rsl_connection_timeout) is not called
before this timer is initialized with osmo_timer_setup(), the E1 layer now
drops incoming RSL messages from a BTS/TRX in LOCKED administrative state.

We cancel the timeout if we receive an RSL Connect ACK or NACK from the BTS,
and if the underlying E1 link does down.

While here, add a missing message buffer free() in bts_isdn_sign_link().
The callers do not free it.

Change-Id: Ia72b65a0f15f47dcb8a6f944f6c3695a4a64b923
Related: OS#2716
diff --git a/src/libbsc/e1_config.c b/src/libbsc/e1_config.c
index 90e29d3..e7398ed 100644
--- a/src/libbsc/e1_config.c
+++ b/src/libbsc/e1_config.c
@@ -131,10 +131,17 @@
 		ret = bts->model->oml_rcvmsg(msg);
 		break;
 	case E1INP_SIGN_RSL:
+		if (link->trx->mo.nm_state.administrative == NM_STATE_LOCKED) {
+			LOGP(DLMI, LOGL_ERROR, "(bts=%d/trx=%d) discarding RSL message received "
+			     "in locked administrative state\n", link->trx->bts->nr, link->trx->nr);
+			msgb_free(msg);
+			break;
+		}
 		ret = abis_rsl_rcvmsg(msg);
 		break;
 	default:
 		LOGP(DLMI, LOGL_ERROR, "unknown link type %u\n", link->type);
+		msgb_free(msg);
 		break;
 	}
 	return ret;