IPA: Allow RSL connection to different IP address as OML

This patch adds a new VTY command "ip.access rsl-ip A.B.C.D" at the
BTS level.  If you set this IP address, the BTS will be instructed to
establish the RSL link to the indiciated IP address, rather than using
the same as for the OML link (default).

Use "ip.access rsl-ip 0" to disable the feature.
diff --git a/openbsc/include/openbsc/gsm_data_shared.h b/openbsc/include/openbsc/gsm_data_shared.h
index f66a140..83758b1 100644
--- a/openbsc/include/openbsc/gsm_data_shared.h
+++ b/openbsc/include/openbsc/gsm_data_shared.h
@@ -602,6 +602,7 @@
 			uint16_t site_id;
 			uint16_t bts_id;
 			uint32_t flags;
+			uint32_t rsl_ip;
 		} ip_access;
 		struct {
 			struct {
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index d985e03..8027a63 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -540,6 +540,12 @@
 	case GSM_BTS_TYPE_OSMO_SYSMO:
 		vty_out(vty, "  ip.access unit_id %u %u%s",
 			bts->ip_access.site_id, bts->ip_access.bts_id, VTY_NEWLINE);
+		if (bts->ip_access.rsl_ip) {
+			struct in_addr ia;
+			ia.s_addr = htonl(bts->ip_access.rsl_ip);
+			vty_out(vty, "  ip.access rsl-ip %s%s", inet_ntoa(ia),
+				VTY_NEWLINE);
+		}
 		vty_out(vty, "  oml ip.access stream_id %u line %u%s",
 			bts->oml_tei, bts->oml_e1_link.e1_nr, VTY_NEWLINE);
 		break;
@@ -1626,6 +1632,28 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_bts_rsl_ip,
+      cfg_bts_rsl_ip_cmd,
+      "ip.access rsl-ip A.B.C.D",
+      "Abis/IP specific options\n"
+      "Set the IPA RSL IP Address of the BSC\n"
+      "Destination IP address for RSL connection\n")
+{
+	struct gsm_bts *bts = vty->index;
+	struct in_addr ia;
+
+	if (!is_ipaccess_bts(bts)) {
+		vty_out(vty, "%% BTS is not of ip.access type%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	inet_aton(argv[0], &ia);
+	bts->ip_access.rsl_ip = ntohl(ia.s_addr);
+
+	return CMD_SUCCESS;
+}
+
+
 DEFUN(cfg_bts_serno,
       cfg_bts_serno_cmd,
       "hsl serial-number STRING",
@@ -3022,6 +3050,7 @@
 	install_element(BTS_NODE, &cfg_bts_tsc_cmd);
 	install_element(BTS_NODE, &cfg_bts_bsic_cmd);
 	install_element(BTS_NODE, &cfg_bts_unit_id_cmd);
+	install_element(BTS_NODE, &cfg_bts_rsl_ip_cmd);
 	install_element(BTS_NODE, &cfg_bts_timezone_cmd);
 	install_element(BTS_NODE, &cfg_bts_no_timezone_cmd);
 	install_element(BTS_NODE, &cfg_bts_serno_cmd);
diff --git a/openbsc/src/libbsc/bts_ipaccess_nanobts.c b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
index 86c9fdc..5d96967 100644
--- a/openbsc/src/libbsc/bts_ipaccess_nanobts.c
+++ b/openbsc/src/libbsc/bts_ipaccess_nanobts.c
@@ -407,7 +407,8 @@
 		abis_nm_opstart(trx->bts, foh->obj_class,
 				trx->bts->bts_nr, trx->nr, 0xff);
 		/* TRX software is active, tell it to initiate RSL Link */
-		abis_nm_ipaccess_rsl_connect(trx, 0, 3003, trx->rsl_tei);
+		abis_nm_ipaccess_rsl_connect(trx, trx->bts->ip_access.rsl_ip,
+					     3003, trx->rsl_tei);
 		break;
 	case NM_OC_RADIO_CARRIER: {
 		/*