src: use new msg->dst pointer instead of deprecated msg->trx

This patch modifies openBSC code to use msg->dst which stores the
pointer to the signalling link structure instead of the pointer to
the transceiver structure.

This patch prepares the introduction of libosmo-abis.
diff --git a/openbsc/include/openbsc/e1_input.h b/openbsc/include/openbsc/e1_input.h
index f201c4f..4a375ed 100644
--- a/openbsc/include/openbsc/e1_input.h
+++ b/openbsc/include/openbsc/e1_input.h
@@ -195,4 +195,6 @@
 
 int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml);
 
+int abis_sendmsg(struct msgb *msg);
+
 #endif /* _E1_INPUT_H */
diff --git a/openbsc/src/ipaccess/network_listen.c b/openbsc/src/ipaccess/network_listen.c
index a719903..71b49ea 100644
--- a/openbsc/src/ipaccess/network_listen.c
+++ b/openbsc/src/ipaccess/network_listen.c
@@ -37,6 +37,7 @@
 #include <openbsc/abis_nm.h>
 #include <openbsc/signal.h>
 #include <openbsc/debug.h>
+#include <openbsc/e1_input.h>
 
 #define WHITELIST_MAX_SIZE ((NUM_ARFCNS*2)+2+1)
 
@@ -129,6 +130,7 @@
 	uint16_t test_rep_len, ferr_list_len;
 	struct ipacc_ferr_elem *ife;
 	struct ipac_bcch_info binfo;
+	struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst;
 	int i, rc;
 
 	DEBUGP(DNM, "TEST REPORT: ");
@@ -168,7 +170,7 @@
 			uint16_t arfcn = cu & 0x3ff;
 			uint8_t rxlev = cu >> 10;
 			DEBUGP(DNM, "==> ARFCN %4u, RxLev %2u\n", arfcn, rxlev);
-			rxlev_stat_input(&msg->trx->ipaccess.rxlev_stat,
+			rxlev_stat_input(&sign_link->trx->ipaccess.rxlev_stat,
 					 arfcn, rxlev);
 		}
 		break;
@@ -219,13 +221,14 @@
 	case NM_IPACC_TESTRES_STOPPED:
 	case NM_IPACC_TESTRES_TIMEOUT:
 	case NM_IPACC_TESTRES_NO_CHANS:
-		msg->trx->ipaccess.test_state = IPAC_TEST_S_IDLE;
+		sign_link->trx->ipaccess.test_state = IPAC_TEST_S_IDLE;
 		/* Send signal to notify higher layers of test completion */
 		DEBUGP(DNM, "dispatching S_IPAC_NWL_COMPLETE signal\n");
-		osmo_signal_dispatch(SS_IPAC_NWL, S_IPAC_NWL_COMPLETE, msg->trx);
+		osmo_signal_dispatch(SS_IPAC_NWL, S_IPAC_NWL_COMPLETE,
+					sign_link->trx);
 		break;
 	case NM_IPACC_TESTRES_PARTIAL:
-		msg->trx->ipaccess.test_state = IPAC_TEST_S_PARTIAL;
+		sign_link->trx->ipaccess.test_state = IPAC_TEST_S_PARTIAL;
 		break;
 	}
 
diff --git a/openbsc/src/libabis/e1_input.c b/openbsc/src/libabis/e1_input.c
index a6661b7..eab418a 100644
--- a/openbsc/src/libabis/e1_input.c
+++ b/openbsc/src/libabis/e1_input.c
@@ -246,27 +246,49 @@
 	return trau_mux_input(&src_ss, data, len);
 }
 
-int abis_rsl_sendmsg(struct msgb *msg)
+int abis_sendmsg(struct msgb *msg)
 {
-	struct e1inp_sign_link *sign_link;
+	struct e1inp_sign_link *sign_link = msg->dst;
 	struct e1inp_driver *e1inp_driver;
 	struct e1inp_ts *e1i_ts;
 
 	msg->l2h = msg->data;
 
-	if (!msg->trx) {
-		LOGP(DRSL, LOGL_ERROR, "rsl_sendmsg: msg->trx == NULL: %s\n",
+	/* don't know how to route this message. */
+	if (sign_link == NULL) {
+		LOGP(DLINP, LOGL_ERROR, "abis_sendmsg: msg->dst == NULL: %s\n",
 			osmo_hexdump(msg->data, msg->len));
 		talloc_free(msg);
 		return -EINVAL;
-	} else if (!msg->trx->rsl_link) {
-		LOGP(DRSL, LOGL_ERROR, "rsl_sendmsg: msg->trx->rsl_link == NULL: %s\n",
+	}
+	e1i_ts = sign_link->ts;
+	if (!osmo_timer_pending(&e1i_ts->sign.tx_timer)) {
+		/* notify the driver we have something to write */
+		e1inp_driver = sign_link->ts->line->driver;
+		e1inp_driver->want_write(e1i_ts);
+	}
+	msgb_enqueue(&sign_link->tx_list, msg);
+
+	/* dump it */
+	write_pcap_packet(PCAP_OUTPUT, sign_link->sapi, sign_link->tei, msg);
+
+	return 0;
+}
+
+int abis_rsl_sendmsg(struct msgb *msg)
+{
+	struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst;
+	struct e1inp_driver *e1inp_driver;
+	struct e1inp_ts *e1i_ts;
+
+	msg->l2h = msg->data;
+
+	if (!sign_link) {
+		LOGP(DRSL, LOGL_ERROR, "rsl_sendmsg: msg->dst == NULL: %s\n",
 			osmo_hexdump(msg->data, msg->len));
 		talloc_free(msg);
-		return -EIO;
+		return -EINVAL;
 	}
-
-	sign_link = msg->trx->rsl_link;
 	e1i_ts = sign_link->ts;
 	if (!osmo_timer_pending(&e1i_ts->sign.tx_timer)) {
 		/* notify the driver we have something to write */
@@ -283,37 +305,22 @@
 
 int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml)
 {
-	struct e1inp_sign_link *sign_link;
-	struct e1inp_driver *e1inp_driver;
-	struct e1inp_ts *e1i_ts;
+	struct e1inp_sign_link *sign_link = msg->dst;
 
 	msg->l2h = msg->data;
 
-	if (!msg->trx || !msg->trx->bts || !msg->trx->bts->oml_link) {
-		LOGP(DNM, LOGL_ERROR, "nm_sendmsg: msg->trx == NULL\n");
+	if (!msg->dst) {
+		LOGP(DNM, LOGL_ERROR, "_abis_nm_sendmsg: msg->dst == NULL\n");
 		return -EINVAL;
 	}
 
 	/* Check for TRX-specific OML link first */
 	if (to_trx_oml) {
-		if (!msg->trx->oml_link)
+		if (!sign_link->trx->oml_link)
 			return -ENODEV;
-		sign_link = msg->trx->oml_link;
-	} else
-		sign_link = msg->trx->bts->oml_link;
-
-	e1i_ts = sign_link->ts;
-	if (!osmo_timer_pending(&e1i_ts->sign.tx_timer)) {
-		/* notify the driver we have something to write */
-		e1inp_driver = sign_link->ts->line->driver;
-		e1inp_driver->want_write(e1i_ts);
+		msg->dst = sign_link->trx->oml_link;
 	}
-	msgb_enqueue(&sign_link->tx_list, msg);
-
-	/* dump it */
-	write_pcap_packet(PCAP_OUTPUT, sign_link->sapi, sign_link->tei, msg);
-
-	return 0;
+	return abis_sendmsg(msg);
 }
 
 /* Timeslot */
@@ -527,12 +534,12 @@
 		log_set_context(BSC_CTX_BTS, link->trx->bts);
 		switch (link->type) {
 		case E1INP_SIGN_OML:
-			msg->trx = link->trx;
-			bts = msg->trx->bts;
+			msg->dst = link;
+			bts = link->trx->bts;
 			ret = bts->model->oml_rcvmsg(msg);
 			break;
 		case E1INP_SIGN_RSL:
-			msg->trx = link->trx;
+			msg->dst = link;
 			ret = abis_rsl_rcvmsg(msg);
 			break;
 		default:
diff --git a/openbsc/src/libabis/input/hsl.c b/openbsc/src/libabis/input/hsl.c
index c98a22c..7f2e75d 100644
--- a/openbsc/src/libabis/input/hsl.c
+++ b/openbsc/src/libabis/input/hsl.c
@@ -250,20 +250,20 @@
 		msgb_free(msg);
 		return -EIO;
 	}
-	msg->trx = link->trx;
+	msg->dst = link;
 
 	switch (link->type) {
 	case E1INP_SIGN_RSL:
-		if (!(msg->trx->bts->ip_access.flags & (RSL_UP << msg->trx->nr))) {
+		if (!(link->trx->bts->ip_access.flags & (RSL_UP << link->trx->nr))) {
 			e1inp_event(e1i_ts, S_INP_TEI_UP, link->tei, link->sapi);
-			msg->trx->bts->ip_access.flags |= (RSL_UP << msg->trx->nr);
+			link->trx->bts->ip_access.flags |= (RSL_UP << link->trx->nr);
 		}
 		ret = abis_rsl_rcvmsg(msg);
 		break;
 	case E1INP_SIGN_OML:
-		if (!(msg->trx->bts->ip_access.flags & OML_UP)) {
+		if (!(link->trx->bts->ip_access.flags & OML_UP)) {
 			e1inp_event(e1i_ts, S_INP_TEI_UP, link->tei, link->sapi);
-			msg->trx->bts->ip_access.flags |= OML_UP;
+			link->trx->bts->ip_access.flags |= OML_UP;
 		}
 		ret = abis_nm_rcvmsg(msg);
 		break;
diff --git a/openbsc/src/libabis/input/ipaccess.c b/openbsc/src/libabis/input/ipaccess.c
index cc2a7a0..2d6764e 100644
--- a/openbsc/src/libabis/input/ipaccess.c
+++ b/openbsc/src/libabis/input/ipaccess.c
@@ -532,20 +532,20 @@
 		msgb_free(msg);
 		return -EIO;
 	}
-	msg->trx = link->trx;
+	msg->dst = link;
 
 	switch (link->type) {
 	case E1INP_SIGN_RSL:
-		if (!(msg->trx->bts->ip_access.flags & (RSL_UP << msg->trx->nr))) {
+		if (!(link->trx->bts->ip_access.flags & (RSL_UP << link->trx->nr))) {
 			e1inp_event(e1i_ts, S_INP_TEI_UP, link->tei, link->sapi);
-			msg->trx->bts->ip_access.flags |= (RSL_UP << msg->trx->nr);
+			link->trx->bts->ip_access.flags |= (RSL_UP << link->trx->nr);
 		}
 		ret = abis_rsl_rcvmsg(msg);
 		break;
 	case E1INP_SIGN_OML:
-		if (!(msg->trx->bts->ip_access.flags & OML_UP)) {
+		if (!(link->trx->bts->ip_access.flags & OML_UP)) {
 			e1inp_event(e1i_ts, S_INP_TEI_UP, link->tei, link->sapi);
-			msg->trx->bts->ip_access.flags |= OML_UP;
+			link->trx->bts->ip_access.flags |= OML_UP;
 		}
 		ret = abis_nm_rcvmsg(msg);
 		break;
diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index 49e86ba..a41414a 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -43,6 +43,7 @@
 #include <openbsc/abis_nm.h>
 #include <openbsc/misdn.h>
 #include <openbsc/signal.h>
+#include <openbsc/e1_input.h>
 
 #define OM_ALLOC_SIZE		1024
 #define OM_HEADROOM_SIZE	128
@@ -116,7 +117,7 @@
 /* Send a OML NM Message from BSC to BTS */
 static int abis_nm_queue_msg(struct gsm_bts *bts, struct msgb *msg)
 {
-	msg->trx = bts->c0;
+	msg->dst = bts->oml_link;
 
 	/* queue OML messages */
 	if (llist_empty(&bts->abis_queue) && !bts->abis_nm_pend) {
@@ -186,7 +187,8 @@
 {
 	struct abis_om_hdr *oh = msgb_l2(mb);
 	struct abis_om_fom_hdr *foh = msgb_l3(mb);
-	struct gsm_bts *bts = mb->trx->bts;
+	struct e1inp_sign_link *sign_link = mb->dst;
+	struct gsm_bts *bts = sign_link->trx->bts;
 	struct tlv_parsed tp;
 	struct gsm_nm_state *nm_state, new_state;
 
@@ -260,13 +262,14 @@
 {
 	struct abis_om_hdr *oh = msgb_l2(mb);
 	struct abis_om_fom_hdr *foh = msgb_l3(mb);
+	struct e1inp_sign_link *sign_link = mb->dst;
 	struct tlv_parsed tp;
 	const uint8_t *p_val;
 	char *p_text;
 
 	LOGPC(DNM, LOGL_ERROR, "Failure Event Report ");
 	
-	abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
+	abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
 
 	if (TLVP_PRESENT(&tp, NM_ATT_EVENT_TYPE))
 		LOGPC(DNM, LOGL_ERROR, "Type=%s ",
@@ -391,6 +394,7 @@
 {
 	struct abis_om_hdr *oh = msgb_l2(mb);
 	struct abis_om_fom_hdr *foh = msgb_l3(mb);
+	struct e1inp_sign_link *sign_link = mb->dst;
 	struct tlv_parsed tp;
 	const uint8_t *sw_config;
 	int ret, sw_config_len, sw_descr_len;
@@ -401,13 +405,13 @@
 
 	DEBUGP(DNM, "Software Activate Request, ACKing and Activating\n");
 
-	ret = abis_nm_sw_act_req_ack(mb->trx->bts, foh->obj_class,
+	ret = abis_nm_sw_act_req_ack(sign_link->trx->bts, foh->obj_class,
 				      foh->obj_inst.bts_nr,
 				      foh->obj_inst.trx_nr,
 				      foh->obj_inst.ts_nr, 0,
 				      foh->data, oh->length-sizeof(*foh));
 
-	abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
+	abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
 	sw_config = TLVP_VAL(&tp, NM_ATT_SW_CONFIG);
 	sw_config_len = TLVP_LEN(&tp, NM_ATT_SW_CONFIG);
 	if (!TLVP_PRESENT(&tp, NM_ATT_SW_CONFIG)) {
@@ -422,7 +426,7 @@
 	if (sw_descr_len < 0)
 		return -EINVAL;
 
-	return ipacc_sw_activate(mb->trx->bts, foh->obj_class,
+	return ipacc_sw_activate(sign_link->trx->bts, foh->obj_class,
 				 foh->obj_inst.bts_nr,
 				 foh->obj_inst.trx_nr,
 				 foh->obj_inst.ts_nr,
@@ -434,26 +438,28 @@
 {
 	struct abis_om_hdr *oh = msgb_l2(mb);
 	struct abis_om_fom_hdr *foh = msgb_l3(mb);
+	struct e1inp_sign_link *sign_link = mb->dst;
 	struct tlv_parsed tp;
 	uint8_t adm_state;
 
-	abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
+	abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
 	if (!TLVP_PRESENT(&tp, NM_ATT_ADM_STATE))
 		return -EINVAL;
 
 	adm_state = *TLVP_VAL(&tp, NM_ATT_ADM_STATE);
 
-	return update_admstate(mb->trx->bts, foh->obj_class, &foh->obj_inst, adm_state);
+	return update_admstate(sign_link->trx->bts, foh->obj_class, &foh->obj_inst, adm_state);
 }
 
 static int abis_nm_rx_lmt_event(struct msgb *mb)
 {
 	struct abis_om_hdr *oh = msgb_l2(mb);
 	struct abis_om_fom_hdr *foh = msgb_l3(mb);
+	struct e1inp_sign_link *sign_link = mb->dst;
 	struct tlv_parsed tp;
 
 	DEBUGP(DNM, "LMT Event ");
-	abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
+	abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
 	if (TLVP_PRESENT(&tp, NM_ATT_BS11_LMT_LOGON_SESSION) &&
 	    TLVP_LEN(&tp, NM_ATT_BS11_LMT_LOGON_SESSION) >= 1) {
 		uint8_t onoff = *TLVP_VAL(&tp, NM_ATT_BS11_LMT_LOGON_SESSION);
@@ -496,6 +502,7 @@
 {
 	struct abis_om_hdr *oh = msgb_l2(mb);
 	struct abis_om_fom_hdr *foh = msgb_l3(mb);
+	struct e1inp_sign_link *sign_link = mb->dst;
 	uint8_t mt = foh->msg_type;
 	int ret = 0;
 
@@ -514,7 +521,7 @@
 
 		DEBUGPC(DNM, "%s NACK ", abis_nm_nack_name(mt));
 
-		abis_nm_tlv_parse(&tp, mb->trx->bts, foh->data, oh->length-sizeof(*foh));
+		abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
 		if (TLVP_PRESENT(&tp, NM_ATT_NACK_CAUSES))
 			DEBUGPC(DNM, "CAUSE=%s\n",
 				abis_nm_nack_cause_name(*TLVP_VAL(&tp, NM_ATT_NACK_CAUSES)));
@@ -524,7 +531,7 @@
 		nack_data.msg = mb;
 		nack_data.mt = mt;
 		osmo_signal_dispatch(SS_NM, S_NM_NACK, &nack_data);
-		abis_nm_queue_send_next(mb->trx->bts);
+		abis_nm_queue_send_next(sign_link->trx->bts);
 		return 0;
 	}
 #if 0
@@ -565,13 +572,13 @@
 		break;
 	case NM_MT_SET_BTS_ATTR_ACK:
 		/* The HSL wants an OPSTART _after_ the SI has been set */
-		if (mb->trx->bts->type == GSM_BTS_TYPE_HSL_FEMTO) {
-			abis_nm_opstart(mb->trx->bts, NM_OC_BTS, 255, 255, 255);
+		if (sign_link->trx->bts->type == GSM_BTS_TYPE_HSL_FEMTO) {
+			abis_nm_opstart(sign_link->trx->bts, NM_OC_BTS, 255, 255, 255);
 		}
 		break;
 	}
 
-	abis_nm_queue_send_next(mb->trx->bts);
+	abis_nm_queue_send_next(sign_link->trx->bts);
 	return ret;
 }
 
@@ -580,12 +587,13 @@
 static int abis_nm_rcvmsg_manuf(struct msgb *mb)
 {
 	int rc;
-	int bts_type = mb->trx->bts->type;
+	struct e1inp_sign_link *sign_link = mb->dst;
+	int bts_type = sign_link->trx->bts->type;
 
 	switch (bts_type) {
 	case GSM_BTS_TYPE_NANOBTS:
 		rc = abis_nm_rx_ipacc(mb);
-		abis_nm_queue_send_next(mb->trx->bts);
+		abis_nm_queue_send_next(sign_link->trx->bts);
 		break;
 	default:
 		LOGP(DNM, LOGL_ERROR, "don't know how to parse OML for this "
@@ -1006,6 +1014,7 @@
 static int abis_nm_rcvmsg_sw(struct msgb *mb)
 {
 	struct abis_om_fom_hdr *foh = msgb_l3(mb);
+	struct e1inp_sign_link *sign_link = mb->dst;
 	int rc = -1;
 	struct abis_nm_sw *sw = &g_sw;
 	enum sw_state old_state = sw->state;
@@ -1023,7 +1032,7 @@
 					 sw->cb_data, NULL);
 			rc = sw_fill_window(sw);
 			sw->state = SW_STATE_WAIT_SEGACK;
-			abis_nm_queue_send_next(mb->trx->bts);
+			abis_nm_queue_send_next(sign_link->trx->bts);
 			break;
 		case NM_MT_LOAD_INIT_NACK:
 			if (sw->forced) {
@@ -1044,7 +1053,7 @@
 						 sw->cb_data, NULL);
 				sw->state = SW_STATE_ERROR;
 			}
-			abis_nm_queue_send_next(mb->trx->bts);
+			abis_nm_queue_send_next(sign_link->trx->bts);
 			break;
 		}
 		break;
@@ -1065,7 +1074,7 @@
 				sw->state = SW_STATE_WAIT_ENDACK;
 				rc = sw_load_end(sw);
 			}
-			abis_nm_queue_send_next(mb->trx->bts);
+			abis_nm_queue_send_next(sign_link->trx->bts);
 			break;
 		case NM_MT_LOAD_ABORT:
 			if (sw->cbfn)
@@ -1087,7 +1096,7 @@
 					 NM_MT_LOAD_END_ACK, mb,
 					 sw->cb_data, NULL);
 			rc = 0;
-			abis_nm_queue_send_next(mb->trx->bts);
+			abis_nm_queue_send_next(sign_link->trx->bts);
 			break;
 		case NM_MT_LOAD_END_NACK:
 			if (sw->forced) {
@@ -1107,7 +1116,7 @@
 						 NM_MT_LOAD_END_NACK, mb,
 						 sw->cb_data, NULL);
 			}
-			abis_nm_queue_send_next(mb->trx->bts);
+			abis_nm_queue_send_next(sign_link->trx->bts);
 			break;
 		}
 	case SW_STATE_WAIT_ACTACK:
@@ -1121,7 +1130,7 @@
 				sw->cbfn(GSM_HOOK_NM_SWLOAD,
 					 NM_MT_ACTIVATE_SW_ACK, mb,
 					 sw->cb_data, NULL);
-			abis_nm_queue_send_next(mb->trx->bts);
+			abis_nm_queue_send_next(sign_link->trx->bts);
 			break;
 		case NM_MT_ACTIVATE_SW_NACK:
 			DEBUGP(DNM, "Activate Software NACK\n");
@@ -1131,7 +1140,7 @@
 				sw->cbfn(GSM_HOOK_NM_SWLOAD,
 					 NM_MT_ACTIVATE_SW_NACK, mb,
 					 sw->cb_data, NULL);
-			abis_nm_queue_send_next(mb->trx->bts);
+			abis_nm_queue_send_next(sign_link->trx->bts);
 			break;
 		}
 	case SW_STATE_NONE:
@@ -2281,6 +2290,7 @@
 	uint8_t idstrlen = oh->data[0];
 	struct tlv_parsed tp;
 	struct ipacc_ack_signal_data signal;
+	struct e1inp_sign_link *sign_link = msg->dst;
 
 	if (strncmp((char *)&oh->data[1], ipaccess_magic, idstrlen)) {
 		LOGP(DNM, LOGL_ERROR, "id string is not com.ipaccess !?!\n");
@@ -2288,7 +2298,7 @@
 	}
 
 	foh = (struct abis_om_fom_hdr *) (oh->data + 1 + idstrlen);
-	abis_nm_tlv_parse(&tp, msg->trx->bts, foh->data, oh->length-sizeof(*foh));
+	abis_nm_tlv_parse(&tp, sign_link->trx->bts, foh->data, oh->length-sizeof(*foh));
 
 	abis_nm_debugp_foh(DNM, foh);
 
@@ -2365,12 +2375,12 @@
 	case NM_MT_IPACC_RSL_CONNECT_NACK:
 	case NM_MT_IPACC_SET_NVATTR_NACK:
 	case NM_MT_IPACC_GET_NVATTR_NACK:
-		signal.trx = gsm_bts_trx_by_nr(msg->trx->bts, foh->obj_inst.trx_nr);
+		signal.trx = gsm_bts_trx_by_nr(sign_link->trx->bts, foh->obj_inst.trx_nr);
 		signal.msg_type = foh->msg_type;
 		osmo_signal_dispatch(SS_NM, S_NM_IPACC_NACK, &signal);
 		break;
 	case NM_MT_IPACC_SET_NVATTR_ACK:
-		signal.trx = gsm_bts_trx_by_nr(msg->trx->bts, foh->obj_inst.trx_nr);
+		signal.trx = gsm_bts_trx_by_nr(sign_link->trx->bts, foh->obj_inst.trx_nr);
 		signal.msg_type = foh->msg_type;
 		osmo_signal_dispatch(SS_NM, S_NM_IPACC_ACK, &signal);
 		break;
diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c
index b636e73..a4a3f23 100644
--- a/openbsc/src/libbsc/abis_om2000.c
+++ b/openbsc/src/libbsc/abis_om2000.c
@@ -799,6 +799,7 @@
 
 static int abis_om2k_sendmsg(struct gsm_bts *bts, struct msgb *msg)
 {
+	struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg;
 	struct abis_om2k_hdr *o2h;
 	int to_trx_oml;
 
@@ -814,8 +815,8 @@
 	case OM2K_MO_CLS_RX:
 		/* Route through per-TRX OML Link to the appropriate TRX */
 		to_trx_oml = 1;
-		msg->trx = gsm_bts_trx_by_nr(bts, o2h->mo.inst);
-		if (!msg->trx) {
+		sign_link->trx = gsm_bts_trx_by_nr(bts, o2h->mo.inst);
+		if (!sign_link->trx) {
 			LOGP(DNM, LOGL_ERROR, "MO=%s Tx Dropping msg to "
 				"non-existing TRX\n", om2k_mo_name(&o2h->mo));
 			return -ENODEV;
@@ -824,8 +825,8 @@
 	case OM2K_MO_CLS_TS:
 		/* Route through per-TRX OML Link to the appropriate TRX */
 		to_trx_oml = 1;
-		msg->trx = gsm_bts_trx_by_nr(bts, o2h->mo.assoc_so);
-		if (!msg->trx) {
+		sign_link->trx = gsm_bts_trx_by_nr(bts, o2h->mo.assoc_so);
+		if (!sign_link->trx) {
 			LOGP(DNM, LOGL_ERROR, "MO=%s Tx Dropping msg to "
 				"non-existing TRX\n", om2k_mo_name(&o2h->mo));
 			return -ENODEV;
@@ -833,7 +834,7 @@
 		break;
 	default:
 		/* Route through the IXU/DXU OML Link */
-		msg->trx = bts->c0;
+		sign_link->trx = bts->c0;
 		to_trx_oml = 0;
 		break;
 	}
@@ -1263,6 +1264,7 @@
 
 static int om2k_rx_negot_req(struct msgb *msg)
 {
+	struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst;
 	struct abis_om2k_hdr *o2h = msgb_l2(msg);
 	struct iwd_type iwd_types[16];
 	uint8_t num_iwd_types = o2h->data[2];
@@ -1316,29 +1318,31 @@
 
 	out_buf[0] = out_num_types;
 
-	return abis_om2k_tx_negot_req_ack(msg->trx->bts, &o2h->mo, out_buf, out_cur - out_buf);
+	return abis_om2k_tx_negot_req_ack(sign_link->trx->bts, &o2h->mo, out_buf, out_cur - out_buf);
 }
 
 static int om2k_rx_start_res(struct msgb *msg)
 {
+	struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst;
 	struct abis_om2k_hdr *o2h = msgb_l2(msg);
 	int rc;
 
-	rc = abis_om2k_tx_simple(msg->trx->bts, &o2h->mo, OM2K_MSGT_START_RES_ACK);
-	rc = abis_om2k_tx_op_info(msg->trx->bts, &o2h->mo, 1);
+	rc = abis_om2k_tx_simple(sign_link->trx->bts, &o2h->mo, OM2K_MSGT_START_RES_ACK);
+	rc = abis_om2k_tx_op_info(sign_link->trx->bts, &o2h->mo, 1);
 
 	return rc;
 }
 
 static int om2k_rx_op_info_ack(struct msgb *msg)
 {
+	struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst;
 	struct abis_om2k_hdr *o2h = msgb_l2(msg);
 
 	/* This Acknowledgement does not contain the actual operational state,
 	 * so we signal whatever state we saved when we sent the Op Info
 	 * request */
 
-	signal_op_state(msg->trx->bts, &o2h->mo);
+	signal_op_state(sign_link->trx->bts, &o2h->mo);
 
 	return 0;
 }
@@ -1463,7 +1467,8 @@
 
 int abis_om2k_rcvmsg(struct msgb *msg)
 {
-	struct gsm_bts *bts = msg->trx->bts;
+	struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)msg->dst;
+	struct gsm_bts *bts = sign_link->trx->bts;
 	struct abis_om2k_hdr *o2h = msgb_l2(msg);
 	struct abis_om_hdr *oh = &o2h->om;
 	uint16_t msg_type = ntohs(o2h->msg_type);
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index cb2c9bc..8645268 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -38,8 +38,8 @@
 #include <openbsc/signal.h>
 #include <openbsc/meas_rep.h>
 #include <openbsc/rtp_proxy.h>
+#include <openbsc/e1_input.h>
 #include <osmocom/gsm/rsl.h>
-
 #include <osmocom/core/talloc.h>
 
 #define RSL_ALLOC_SIZE		1024
@@ -215,7 +215,7 @@
 	msgb_tv_put(msg, RSL_IE_SYSINFO_TYPE, type);
 	msgb_tlv_put(msg, RSL_IE_FULL_BCCH_INFO, len, data);
 
-	msg->trx = trx;
+	msg->dst = trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -233,7 +233,7 @@
 	msgb_tv_put(msg, RSL_IE_SYSINFO_TYPE, type);
 	msgb_tl16v_put(msg, RSL_IE_L3_INFO, len, data);
 
-	msg->trx = trx;
+	msg->dst = trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -252,7 +252,7 @@
 	msgb_tv_put(msg, RSL_IE_SYSINFO_TYPE, type);
 	msgb_tl16v_put(msg, RSL_IE_L3_INFO, len, data);
 
-	msg->trx = lchan->ts->trx;
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -279,7 +279,7 @@
 
 	msgb_tv_put(msg, RSL_IE_BS_POWER, lchan->bs_power);
 
-	msg->trx = lchan->ts->trx;
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -308,7 +308,7 @@
 
 	msgb_tv_put(msg, RSL_IE_MS_POWER, lchan->ms_power);
 
-	msg->trx = lchan->ts->trx;
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -407,7 +407,7 @@
 	msgb_tv_put(msg, RSL_IE_MS_POWER, ms_power);
 	msgb_tv_put(msg, RSL_IE_TIMING_ADVANCE, ta);
 
-	msg->trx = trx;
+	msg->dst = trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -486,7 +486,7 @@
 		msgb_tlv_put(msg, RSL_IE_MR_CONFIG, sizeof(lchan->mr_conf),
 			     (uint8_t *) &lchan->mr_conf);
 
-	msg->trx = lchan->ts->trx;
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -525,7 +525,7 @@
 			     (uint8_t *) &lchan->mr_conf);
 	}
 
-	msg->trx = lchan->ts->trx;
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -557,7 +557,7 @@
 	init_dchan_hdr(dh, RSL_MT_ENCR_CMD);
 	dh->chan_nr = chan_nr;
 
-	msg->trx = lchan->ts->trx;
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -573,7 +573,7 @@
 	dh->chan_nr = gsm_lchan2chan_nr(lchan);
 
 	msg->lchan = lchan;
-	msg->trx = lchan->ts->trx;
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	DEBUGP(DRSL, "%s DEACTivate SACCH CMD\n", gsm_lchan_name(lchan));
 
@@ -615,7 +615,7 @@
 	dh->chan_nr = gsm_lchan2chan_nr(lchan);
 
 	msg->lchan = lchan;
-	msg->trx = lchan->ts->trx;
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	DEBUGP(DRSL, "%s RF Channel Release CMD due error %d\n", gsm_lchan_name(lchan), error);
 
@@ -625,11 +625,13 @@
 		 * be a problem when we have reassigned the channel to someone else and then can
 		 * not figure out who used this channel.
 		 */
+		struct e1inp_sign_link *sign_link = msg->dst;
+
 		rsl_lchan_set_state(lchan, LCHAN_S_REL_ERR);
 		lchan->error_timer.data = lchan;
 		lchan->error_timer.cb = error_timeout_cb;
 		osmo_timer_schedule(&lchan->error_timer,
-				   msg->trx->bts->network->T3111 + 2, 0);
+				   sign_link->trx->bts->network->T3111 + 2, 0);
 	}
 
 	/* Start another timer or assume the BTS sends a ACK/NACK? */
@@ -683,7 +685,7 @@
 	msgb_tlv_put(msg, RSL_IE_MS_IDENTITY, len-2, ms_ident+2);
 	msgb_tv_put(msg, RSL_IE_CHAN_NEEDED, chan_needed);
 
-	msg->trx = bts->c0;
+	msg->dst = bts->c0->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -727,7 +729,7 @@
 		break;
 	}
 
-	msg->trx = bts->c0;
+	msg->dst = bts->c0->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -747,7 +749,7 @@
 	DEBUGP(DRSL, "%s TX Siemens MRPCI 0x%02x\n",
 		gsm_lchan_name(lchan), *(uint8_t *)mrpci);
 
-	msg->trx = lchan->ts->trx;
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -765,7 +767,7 @@
 	rsl_rll_push_l3(msg, RSL_MT_DATA_REQ, gsm_lchan2chan_nr(msg->lchan),
 			link_id, 1);
 
-	msg->trx = msg->lchan->ts->trx;
+	msg->dst = msg->lchan->ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -778,7 +780,7 @@
 
 	msg = rsl_rll_simple(RSL_MT_EST_REQ, gsm_lchan2chan_nr(lchan),
 			     link_id, 0);
-	msg->trx = lchan->ts->trx;
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -800,7 +802,7 @@
 
 	/* FIXME: start some timer in case we don't receive a REL ACK ? */
 
-	msg->trx = lchan->ts->trx;
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -998,9 +1000,11 @@
 			*TLVP_VAL(&tp, RSL_IE_MS_TIMING_OFFSET);
 
 	if (TLVP_PRESENT(&tp, RSL_IE_L1_INFO)) {
+		struct e1inp_sign_link *sign_link = msg->dst;
+
 		val = TLVP_VAL(&tp, RSL_IE_L1_INFO);
 		mr->flags |= MEAS_REP_F_MS_L1;
-		mr->ms_l1.pwr = ms_pwr_dbm(msg->trx->bts->band, val[0] >> 3);
+		mr->ms_l1.pwr = ms_pwr_dbm(sign_link->trx->bts->band, val[0] >> 3);
 		if (val[0] & 0x04)
 			mr->flags |= MEAS_REP_F_FPC;
 		mr->ms_l1.ta = val[1];
@@ -1045,8 +1049,9 @@
 	struct abis_rsl_dchan_hdr *rslh = msgb_l2(msg);
 	int rc = 0;
 	char *ts_name;
+	struct e1inp_sign_link *sign_link = msg->dst;
 
-	msg->lchan = lchan_lookup(msg->trx, rslh->chan_nr);
+	msg->lchan = lchan_lookup(sign_link->trx, rslh->chan_nr);
 	ts_name = gsm_lchan_name(msg->lchan);
 
 	switch (rslh->c.msg_type) {
@@ -1113,8 +1118,9 @@
 {
 	struct abis_rsl_common_hdr *rslh = msgb_l2(msg);
 	struct tlv_parsed tp;
+	struct e1inp_sign_link *sign_link = msg->dst;
 
-	LOGP(DRSL, LOGL_ERROR, "%s ERROR REPORT ", gsm_trx_name(msg->trx));
+	LOGP(DRSL, LOGL_ERROR, "%s ERROR REPORT ", gsm_trx_name(sign_link->trx));
 
 	rsl_tlv_parse(&tp, rslh->data, msgb_l2len(msg)-sizeof(*rslh));
 
@@ -1130,6 +1136,7 @@
 static int abis_rsl_rx_trx(struct msgb *msg)
 {
 	struct abis_rsl_common_hdr *rslh = msgb_l2(msg);
+	struct e1inp_sign_link *sign_link = msg->dst;
 	int rc = 0;
 
 	switch (rslh->msg_type) {
@@ -1138,12 +1145,12 @@
 		break;
 	case RSL_MT_RF_RES_IND:
 		/* interference on idle channels of TRX */
-		//DEBUGP(DRSL, "%s RF Resource Indication\n", gsm_trx_name(msg->trx));
+		//DEBUGP(DRSL, "%s RF Resource Indication\n", gsm_trx_name(sign_link->trx));
 		break;
 	case RSL_MT_OVERLOAD:
 		/* indicate CCCH / ACCH / processor overload */
 		LOGP(DRSL, LOGL_ERROR, "%s CCCH/ACCH/CPU Overload\n",
-		     gsm_trx_name(msg->trx));
+		     gsm_trx_name(sign_link->trx));
 		break;
 	case 0x42: /* Nokia specific: SI End ACK */
 		LOGP(DRSL, LOGL_INFO, "Nokia SI End ACK\n");
@@ -1153,7 +1160,7 @@
 		break;
 	default:
 		LOGP(DRSL, LOGL_NOTICE, "%s Unknown Abis RSL TRX message "
-			"type 0x%02x\n", gsm_trx_name(msg->trx), rslh->msg_type);
+			"type 0x%02x\n", gsm_trx_name(sign_link->trx), rslh->msg_type);
 		return -EINVAL;
 	}
 	return rc;
@@ -1219,7 +1226,8 @@
 /* MS has requested a channel on the RACH */
 static int rsl_rx_chan_rqd(struct msgb *msg)
 {
-	struct gsm_bts *bts = msg->trx->bts;
+	struct e1inp_sign_link *sign_link = msg->dst;
+	struct gsm_bts *bts = sign_link->trx->bts;
 	struct abis_rsl_dchan_hdr *rqd_hdr = msgb_l2(msg);
 	struct gsm48_req_ref *rqd_ref;
 	enum gsm_chan_t lctype;
@@ -1346,6 +1354,7 @@
 /* MS has requested a channel on the RACH */
 static int rsl_rx_ccch_load(struct msgb *msg)
 {
+	struct e1inp_sign_link *sign_link = msg->dst;
 	struct abis_rsl_dchan_hdr *rslh = msgb_l2(msg);
 	uint16_t pg_buf_space;
 	uint16_t rach_slot_count = -1;
@@ -1355,11 +1364,11 @@
 	switch (rslh->data[0]) {
 	case RSL_IE_PAGING_LOAD:
 		pg_buf_space = rslh->data[1] << 8 | rslh->data[2];
-		if (is_ipaccess_bts(msg->trx->bts) && pg_buf_space == 0xffff) {
+		if (is_ipaccess_bts(sign_link->trx->bts) && pg_buf_space == 0xffff) {
 			/* paging load below configured threshold, use 50 as default */
 			pg_buf_space = 50;
 		}
-		paging_update_buffer_space(msg->trx->bts, pg_buf_space);
+		paging_update_buffer_space(sign_link->trx->bts, pg_buf_space);
 		break;
 	case RSL_IE_RACH_LOAD:
 		if (msg->data_len >= 7) {
@@ -1377,10 +1386,11 @@
 
 static int abis_rsl_rx_cchan(struct msgb *msg)
 {
+	struct e1inp_sign_link *sign_link = msg->dst;
 	struct abis_rsl_dchan_hdr *rslh = msgb_l2(msg);
 	int rc = 0;
 
-	msg->lchan = lchan_lookup(msg->trx, rslh->chan_nr);
+	msg->lchan = lchan_lookup(sign_link->trx, rslh->chan_nr);
 
 	switch (rslh->c.msg_type) {
 	case RSL_MT_CHAN_RQD:
@@ -1460,12 +1470,13 @@
 
 static int abis_rsl_rx_rll(struct msgb *msg)
 {
+	struct e1inp_sign_link *sign_link = msg->dst;
 	struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
 	int rc = 0;
 	char *ts_name;
 	uint8_t sapi = rllh->link_id & 7;
 
-	msg->lchan = lchan_lookup(msg->trx, rllh->chan_nr);
+	msg->lchan = lchan_lookup(sign_link->trx, rllh->chan_nr);
 	ts_name = gsm_lchan_name(msg->lchan);
 	DEBUGP(DRLL, "%s SAPI=%u ", ts_name, sapi);
 	
@@ -1683,7 +1694,7 @@
 		gsm_lchan_name(lchan), lchan->abis_ip.speech_mode,
 		lchan->abis_ip.rtp_payload);
 
-	msg->trx = lchan->ts->trx;
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -1725,8 +1736,8 @@
 	msgb_tv_put(msg, RSL_IE_IPAC_RTP_PAYLOAD, lchan->abis_ip.rtp_payload);
 	if (rtp_payload2)
 		msgb_tv_put(msg, RSL_IE_IPAC_RTP_PAYLOAD2, rtp_payload2);
-	
-	msg->trx = lchan->ts->trx;
+
+	msg->dst = lchan->ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -1764,7 +1775,7 @@
 	DEBUGP(DRSL, "%s IPAC_PDCH_%sACT\n", gsm_ts_name(ts),
 		act ? "" : "DE");
 
-	msg->trx = ts->trx;
+	msg->dst = ts->trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -1829,11 +1840,12 @@
 
 static int abis_rsl_rx_ipacc(struct msgb *msg)
 {
+	struct e1inp_sign_link *sign_link = msg->dst;
 	struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
 	char *ts_name;
 	int rc = 0;
 
-	msg->lchan = lchan_lookup(msg->trx, rllh->chan_nr);
+	msg->lchan = lchan_lookup(sign_link->trx, rllh->chan_nr);
 	ts_name = gsm_lchan_name(msg->lchan);
 	
 	switch (rllh->c.msg_type) {
@@ -1949,7 +1961,7 @@
 	ch->msg_discr = ABIS_RSL_MDISC_TRX;
 	ch->msg_type = 0x40; /* Nokia SI Begin */
 
-	msg->trx = trx;
+	msg->dst = trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -1965,7 +1977,7 @@
 
 	msgb_tv_put(msg, 0xFD, 0x00); /* Nokia Pagemode Info, No paging reorganisation required */
 
-	msg->trx = trx;
+	msg->dst = trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
@@ -1982,7 +1994,7 @@
 	msgb_tv_put(msg, RSL_IE_CHAN_NR, channel);
 	msgb_tv_put(msg, RSL_IE_BS_POWER, reduction); /* reduction in 2dB steps */
 
-	msg->trx = trx;
+	msg->dst = trx->rsl_link;
 
 	return abis_rsl_sendmsg(msg);
 }
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c
index 78fee88..7563378 100644
--- a/openbsc/src/libbsc/bsc_api.c
+++ b/openbsc/src/libbsc/bsc_api.c
@@ -277,7 +277,7 @@
 
 	sapi = link_id & 0x7;
 	msg->lchan = conn->lchan;
-	msg->trx = msg->lchan->ts->trx;
+	msg->dst = msg->lchan->ts->trx->rsl_link;
 
 	/* If we are on a TCH and need to submit a SMS (on SAPI=3) we need to use the SACH */
 	if (allow_sach && sapi != 0) {
diff --git a/openbsc/src/libbsc/bts_hsl_femtocell.c b/openbsc/src/libbsc/bts_hsl_femtocell.c
index f943693..8463202 100644
--- a/openbsc/src/libbsc/bts_hsl_femtocell.c
+++ b/openbsc/src/libbsc/bts_hsl_femtocell.c
@@ -98,20 +98,20 @@
 	msg = hsl_alloc_msgb();
 	cur = msgb_put(msg, sizeof(l1_msg));
 	memcpy(msg->data, l1_msg, sizeof(l1_msg));
-	msg->trx = bts->c0;
+	msg->dst = bts->c0->rsl_link;
 	abis_rsl_sendmsg(msg);
 
 #if 1
 	msg = hsl_alloc_msgb();
 	cur = msgb_put(msg, sizeof(conn_trau_msg));
 	memcpy(msg->data, conn_trau_msg, sizeof(conn_trau_msg));
-	msg->trx = bts->c0;
+	msg->dst = bts->c0->rsl_link;
 	abis_rsl_sendmsg(msg);
 #endif
 	msg = hsl_alloc_msgb();
 	cur = msgb_put(msg, sizeof(conn_trau_msg2));
 	memcpy(msg->data, conn_trau_msg2, sizeof(conn_trau_msg2));
-	msg->trx = bts->c0;
+	msg->dst = bts->c0->rsl_link;
 	abis_rsl_sendmsg(msg);
 
 	*((uint16_t *)oml_arfcn_bsic+10) = htons(bts->c0->arfcn);
@@ -120,7 +120,7 @@
 	msg = hsl_alloc_msgb();
 	cur = msgb_put(msg, sizeof(oml_arfcn_bsic));
 	memcpy(msg->data, oml_arfcn_bsic, sizeof(oml_arfcn_bsic));
-	msg->trx = bts->c0;
+	msg->dst = bts->c0->rsl_link;
 	_abis_nm_sendmsg(msg, 0);
 
 	/* Delay the OPSTART until after SI have been set via RSL */
diff --git a/openbsc/src/libbsc/bts_ipaccess_nanobts.c b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
index e756f2a..c86b1e1 100644
--- a/openbsc/src/libbsc/bts_ipaccess_nanobts.c
+++ b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
@@ -373,7 +373,8 @@
 static int sw_activ_rep(struct msgb *mb)
 {
 	struct abis_om_fom_hdr *foh = msgb_l3(mb);
-	struct gsm_bts *bts = mb->trx->bts;
+	struct e1inp_sign_link *sign_link = mb->dst;
+	struct gsm_bts *bts = sign_link->trx->bts;
 	struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, foh->obj_inst.trx_nr);
 
 	if (!trx)
diff --git a/openbsc/src/libbsc/bts_nokia_site.c b/openbsc/src/libbsc/bts_nokia_site.c
index b5bc2fe..8ba01d0 100644
--- a/openbsc/src/libbsc/bts_nokia_site.c
+++ b/openbsc/src/libbsc/bts_nokia_site.c
@@ -1474,7 +1474,8 @@
 
 static int abis_nm_rcvmsg_fom(struct msgb *mb)
 {
-	struct gsm_bts *bts = mb->trx->bts;
+	struct e1inp_sign_link *sign_link = (struct e1inp_sign_link *)mb->dst;
+	struct gsm_bts *bts = sign_link->trx->bts;
 	struct abis_om_hdr *oh = msgb_l2(mb);
 	struct abis_om_nokia_hdr *noh = msgb_l3(mb);
 	uint8_t mt = noh->msg_type;
@@ -1579,7 +1580,8 @@
 		if (bts->nokia.configured != 0) {
 			/* start TRX  (RSL link) */
 
-			struct gsm_e1_subslot *e1_link = &mb->trx->rsl_e1_link;
+			struct gsm_e1_subslot *e1_link =
+					&sign_link->trx->rsl_e1_link;
 			struct e1inp_line *line;
 
 			bts->nokia.configured = 0;
@@ -1590,7 +1592,7 @@
 				LOGP(DINP, LOGL_ERROR,
 				     "TRX (%u/%u) RSL link referring "
 				     "to non-existing E1 line %u\n",
-				     mb->trx->bts->nr, mb->trx->nr,
+				     sign_link->trx->bts->nr, sign_link->trx->nr,
 				     e1_link->e1_nr);
 				return -ENOMEM;
 			}
diff --git a/openbsc/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c
index 92335f2..968e62e 100644
--- a/openbsc/src/libbsc/gsm_04_08_utils.c
+++ b/openbsc/src/libbsc/gsm_04_08_utils.c
@@ -44,7 +44,7 @@
 static int gsm48_sendmsg(struct msgb *msg)
 {
 	if (msg->lchan)
-		msg->trx = msg->lchan->ts->trx;
+		msg->dst = msg->lchan->ts->trx->rsl_link;
 
 	msg->l3h = msg->data;
 	return rsl_data_request(msg, 0);
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index bd452ed..59baa5a 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -49,6 +49,7 @@
 #include <openbsc/silent_call.h>
 #include <openbsc/bsc_api.h>
 #include <openbsc/osmo_msc.h>
+#include <openbsc/e1_input.h>
 #include <osmocom/core/bitvec.h>
 
 #include <osmocom/gsm/gsm48.h>
@@ -94,17 +95,22 @@
 
 
 	if (msg->lchan) {
-		msg->trx = msg->lchan->ts->trx;
+		struct e1inp_sign_link *sign_link =
+				msg->lchan->ts->trx->rsl_link;
+
+		msg->dst = sign_link;
 		if ((gh->proto_discr & GSM48_PDISC_MASK) == GSM48_PDISC_CC)
 			DEBUGP(DCC, "(bts %d trx %d ts %d ti %02x) "
-				"Sending '%s' to MS.\n", msg->trx->bts->nr,
-				msg->trx->nr, msg->lchan->ts->nr,
+				"Sending '%s' to MS.\n",
+				sign_link->trx->bts->nr,
+				sign_link->trx->nr, msg->lchan->ts->nr,
 				gh->proto_discr & 0xf0,
 				gsm48_cc_msg_name(gh->msg_type));
 		else
 			DEBUGP(DCC, "(bts %d trx %d ts %d pd %02x) "
-				"Sending 0x%02x to MS.\n", msg->trx->bts->nr,
-				msg->trx->nr, msg->lchan->ts->nr,
+				"Sending 0x%02x to MS.\n",
+				sign_link->trx->bts->nr,
+				sign_link->trx->nr, msg->lchan->ts->nr,
 				gh->proto_discr, gh->msg_type);
 	}
 
@@ -874,6 +880,7 @@
 
 static int gsm48_rx_mm_imsi_detach_ind(struct msgb *msg)
 {
+	struct e1inp_sign_link *sign_link = msg->lchan->ts->trx->rsl_link;
 	struct gsm_bts *bts = msg->lchan->ts->trx->bts;
 	struct gsm48_hdr *gh = msgb_l3(msg);
 	struct gsm48_imsi_detach_ind *idi =
@@ -907,7 +914,7 @@
 	}
 
 	if (subscr) {
-		subscr_update(subscr, msg->trx->bts,
+		subscr_update(subscr, sign_link->trx->bts,
 				GSM_SUBSCRIBER_UPDATE_DETACHED);
 		DEBUGP(DMM, "Subscriber: %s\n", subscr_name(subscr));
 
diff --git a/openbsc/src/utils/rs232.c b/openbsc/src/utils/rs232.c
index 4e35cb0..01b8c7e 100644
--- a/openbsc/src/utils/rs232.c
+++ b/openbsc/src/utils/rs232.c
@@ -128,7 +128,7 @@
 	if (!sh->rx_msg) {
 		sh->rx_msg = msgb_alloc(SERIAL_ALLOC_SIZE, "RS232 Rx");
 		sh->rx_msg->l2h = NULL;
-		sh->rx_msg->trx = sh->bts->c0;
+		sh->rx_msg->dst = sh->bts->c0->rsl_link;
 	}
 	msg = sh->rx_msg;