[PATCH 1/2] ipaccess: bts: OML and RSL links may use different address

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

pablo at gnumonks.org pablo at gnumonks.org
Sun Feb 10 22:02:38 UTC 2013


From: Pablo Neira Ayuso <pablo at gnumonks.org>

This patch allows you to set different addresses for the OML and
RSL links.

You can set the RSL address anytime via line->ops->cfg.ipa.rsl.addr
before the second call to e1inp_line_update() that brings the RSL
link up.
---
 include/osmocom/abis/e1_input.h |    7 ++++++-
 src/input/hsl.c                 |    4 ++--
 src/input/ipaccess.c            |    4 ++--
 tests/e1inp_ipa_bts_test.c      |    7 ++++++-
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index 16e7f8b..fac7bac 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -140,8 +140,13 @@ struct e1inp_line_ops {
 	union {
 		struct {
 			enum e1inp_line_role role;	/* BSC or BTS mode. */
-			const char *addr;		/* IP address .*/
 			void *dev;			/* device parameters. */
+			struct {
+				const char *addr;	/* IP address .*/
+			} oml;
+			struct {
+				const char *addr;
+			} rsl;
 		} ipa;
 		struct {
 			const char *port;		/* e.g. /dev/ttyUSB0 */
diff --git a/src/input/hsl.c b/src/input/hsl.c
index 1a60c2b..cfe7157 100644
--- a/src/input/hsl.c
+++ b/src/input/hsl.c
@@ -476,7 +476,7 @@ static int hsl_line_update(struct e1inp_line *line)
 		LOGP(DLINP, LOGL_NOTICE, "enabling hsl BSC mode\n");
 
 		ret = osmo_sock_init(AF_INET, SOCK_STREAM, IPPROTO_TCP,
-				     line->ops->cfg.ipa.addr,
+				     line->ops->cfg.ipa.oml.addr,
 				     HSL_TCP_PORT, OSMO_SOCK_F_BIND);
 		if (ret < 0)
 			return ret;
@@ -499,7 +499,7 @@ static int hsl_line_update(struct e1inp_line *line)
 		link = ipa_client_conn_create(tall_hsl_ctx,
 					      &line->ts[E1INP_SIGN_OML-1],
 					      E1INP_SIGN_OML,
-					      line->ops->cfg.ipa.addr,
+					      line->ops->cfg.ipa.oml.addr,
 					      HSL_TCP_PORT,
 					      hsl_bts_connect,
 					      hsl_bts_process,
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index b8c1e7a..0fce15e 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -901,7 +901,7 @@ static int ipaccess_bts_oml_link_up(struct e1inp_line *line)
 	link = ipa_client_conn_create(tall_ipa_ctx,
 				      &line->ts[E1INP_SIGN_OML-1],
 				      E1INP_SIGN_OML,
-				      line->ops->cfg.ipa.addr,
+				      line->ops->cfg.ipa.oml.addr,
 				      IPA_TCP_PORT_OML,
 				      NULL,
 				      ipaccess_bts_cb,
@@ -930,7 +930,7 @@ static int ipaccess_bts_rsl_link_up(struct e1inp_line *line)
 	rsl_link = ipa_client_conn_create(tall_ipa_ctx,
 					  &line->ts[E1INP_SIGN_RSL-1],
 					  E1INP_SIGN_RSL,
-					  line->ops->cfg.ipa.addr,
+					  line->ops->cfg.ipa.rsl.addr,
 					  IPA_TCP_PORT_RSL,
 					  NULL,
 					  ipaccess_bts_cb,
diff --git a/tests/e1inp_ipa_bts_test.c b/tests/e1inp_ipa_bts_test.c
index 112af65..46c6483 100644
--- a/tests/e1inp_ipa_bts_test.c
+++ b/tests/e1inp_ipa_bts_test.c
@@ -282,8 +282,13 @@ int main(void)
 		.cfg = {
 			.ipa = {
 				.role	= E1INP_LINE_R_BTS,
-				.addr	= "127.0.0.1",
 				.dev	= &bts_dev_info,
+				.oml = {
+					.addr	= "127.0.0.1",
+				},
+				.rsl = {
+					.addr	= "127.0.0.1",
+				},
 			},
 		},
 		.sign_link_up	= sign_link_up,
-- 
1.7.10.4





More information about the OpenBSC mailing list