[abis_nm] introduce and use abis_nm_ipaccess_rsl_connect()
diff --git a/openbsc/include/openbsc/abis_nm.h b/openbsc/include/openbsc/abis_nm.h
index 3e72321..c3b8e55 100644
--- a/openbsc/include/openbsc/abis_nm.h
+++ b/openbsc/include/openbsc/abis_nm.h
@@ -748,6 +748,8 @@
 int abis_nm_ipaccess_set_nvattr(struct gsm_bts *bts, u_int8_t *attr,
 				int attr_len);
 int abis_nm_ipaccess_restart(struct gsm_bts *bts);
+int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx, 
+				 u_int32_t ip, u_int16_t port, u_int8_t stream);
 
 /* Functions calling into other code parts */
 enum nm_evt {
diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c
index ff122dc..58dd2b8 100755
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -2479,7 +2479,7 @@
 		foh->obj_inst.bts_nr, foh->obj_inst.trx_nr,
 		foh->obj_inst.ts_nr);
 
-	DEBUGP(DNM, "IPACCESS(0x%02x): ", foh->msg_type);
+	DEBUGPC(DNM, "IPACCESS(0x%02x): ", foh->msg_type);
 
 	switch (foh->msg_type) {
 	case NM_MT_IPACC_RSL_CONNECT_ACK:
@@ -2602,6 +2602,34 @@
 				    attr_len);
 }
 
+int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx, 
+				 u_int32_t ip, u_int16_t port, u_int8_t stream)
+{
+	struct in_addr ia;
+	u_int8_t attr[] = { NM_ATT_IPACC_STREAM_ID, 0,
+			    NM_ATT_IPACC_DST_IP_PORT, 0, 0,
+			    NM_ATT_IPACC_DST_IP, 0, 0, 0, 0 };
+
+	int attr_len = sizeof(attr);
+
+	ia.s_addr = htonl(ip);
+	attr[1] = stream;
+	attr[3] = port >> 8;
+	attr[4] = port & 0xff;
+	*(u_int32_t *)(attr+6) = ia.s_addr;
+
+	/* if ip == 0, we use the default IP */
+	if (ip == 0)
+		attr_len -= 5;
+
+	DEBUGP(DNM, "ip.access RSL CONNECT IP=%s PORT=%u STREAM=0x%02x\n",
+		inet_ntoa(ia), htons(port), stream);
+
+	return abis_nm_ipaccess_msg(trx->bts, NM_MT_IPACC_RSL_CONNECT,
+				    NM_OC_BASEB_TRANSC, trx->bts->bts_nr,
+				    trx->nr, 0xff, attr, attr_len);
+}
+
 /* restart / reboot an ip.access nanoBTS */
 int abis_nm_ipaccess_restart(struct gsm_bts *bts)
 {
diff --git a/openbsc/src/bsc_init.c b/openbsc/src/bsc_init.c
index adf37ed..40047c2 100644
--- a/openbsc/src/bsc_init.c
+++ b/openbsc/src/bsc_init.c
@@ -338,11 +338,6 @@
 	NM_ATT_ARFCN_LIST, 0x00, 0x02, HARDCODED_ARFCN >> 8, HARDCODED_ARFCN & 0xff,
 };
 
-static unsigned char nanobts_attr_e0[] = {
-	NM_ATT_IPACC_STREAM_ID, 0x00,
-	NM_ATT_IPACC_DST_IP_PORT, 0x0b, 0xbb,	/* TCP PORT for RSL */
-};
-
 /* Callback function to be called whenever we get a GSM 12.21 state change event */
 int nm_state_event(enum nm_evt evt, u_int8_t obj_class, void *obj,
 		   struct gsm_nm_state *old_state, struct gsm_nm_state *new_state)
@@ -414,9 +409,7 @@
 	switch (foh->obj_class) {
 	case NM_OC_BASEB_TRANSC:
 		/* TRX software is active, tell it to initiate RSL Link */
-		abis_nm_ipaccess_msg(trx->bts, 0xe0, NM_OC_BASEB_TRANSC,
-				     trx->bts->bts_nr, trx->nr, 0xff,
-				     nanobts_attr_e0, sizeof(nanobts_attr_e0));
+		abis_nm_ipaccess_rsl_connect(trx, 0, 3003, 0);
 		abis_nm_opstart(trx->bts, NM_OC_BASEB_TRANSC,
 				trx->bts->bts_nr, trx->nr, 0xff);
 		abis_nm_chg_adm_state(trx->bts, NM_OC_BASEB_TRANSC,