[PATCH] input: fix multiple BTS attached to single line scenario

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
Tue Aug 30 14:45:27 UTC 2011


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

With multiple BTS attached to a single line, we have to call
->line_update() multiple times. I broke this myself while avoiding
that A-bis over IP drivers bind to the socket several times.

To fix this situation, this patch adds the E1INP_DRV_F_LINE_ETHER
flag which allows us to skip multiple invocation of ->line_update()
only in case that this is an A-bis over IP driver.

Reported-by: Gus Bourg <gus at bourg.net>
---
 include/osmocom/abis/e1_input.h |    5 +++++
 src/e1_input.c                  |    4 ++--
 src/input/hsl.c                 |    1 +
 src/input/ipaccess.c            |    1 +
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index 42b1758..bbbbf29 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -124,9 +124,14 @@ enum e1inp_line_role {
 	E1INP_LINE_R_MAX
 };
 
+enum {
+	E1INP_DRV_F_LINE_ETHER = (1 << 0),	/* Driver uses ethernet line. */
+};
+
 struct e1inp_driver {
 	struct llist_head list;
 	const char *name;
+	unsigned int flags;
 	int (*want_write)(struct e1inp_ts *ts);
 	int (*line_update)(struct e1inp_line *line);
 	void (*close)(struct e1inp_sign_link *link);
diff --git a/src/e1_input.c b/src/e1_input.c
index a549ba4..3c5ac7d 100644
--- a/src/e1_input.c
+++ b/src/e1_input.c
@@ -676,8 +676,8 @@ int e1inp_line_update(struct e1inp_line *line)
 
 	e1inp_line_get(line);
 
-	/* This line has been already initialized, skip this. */
-	if (line->refcnt > 2)
+	/* This ethernet line has been already initialized, skip this. */
+	if ((line->driver->flags & E1INP_DRV_F_LINE_ETHER) && line->refcnt > 2)
 		return 0;
 
 	if (line->driver && line->ops && line->driver->line_update) {
diff --git a/src/input/hsl.c b/src/input/hsl.c
index dc7532b..fe9e70c 100644
--- a/src/input/hsl.c
+++ b/src/input/hsl.c
@@ -322,6 +322,7 @@ static int hsl_line_update(struct e1inp_line *line);
 
 struct e1inp_driver hsl_driver = {
 	.name = "hsl",
+	.flags = E1INP_DRV_F_LINE_ETHER,
 	.want_write = ts_want_write,
 	.line_update = hsl_line_update,
 	.close = hsl_close,
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index b7391b3..b12383b 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -555,6 +555,7 @@ static int ipaccess_line_update(struct e1inp_line *line);
 
 struct e1inp_driver ipaccess_driver = {
 	.name = "ipa",
+	.flags = E1INP_DRV_F_LINE_ETHER,
 	.want_write = ts_want_write,
 	.line_update = ipaccess_line_update,
 	.close = ipaccess_close,
-- 
1.7.2.5





More information about the OpenBSC mailing list