summaryrefslogtreecommitdiffstats
path: root/src/input/hsl.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso2011-08-31 16:47:44 +0200
committerHarald Welte2011-08-31 17:55:33 +0200
commitd6216405b7363c94174a6d301b96f5ed4a8730ce (patch)
treea2973e137d5cb7ddd9b00d4cd0390262a93d4749 /src/input/hsl.c
parentlapd: stop timers in lapd_instance_free() (diff)
downloadlibosmo-abis-d6216405b7363c94174a6d301b96f5ed4a8730ce.tar.gz
libosmo-abis-d6216405b7363c94174a6d301b96f5ed4a8730ce.tar.xz
libosmo-abis-d6216405b7363c94174a6d301b96f5ed4a8730ce.zip
input: fix multiple BTS attached to single line scenario
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, Harald prefers that this case is internally handled by the ipaccess and hsl drivers by means of the driver_data field in the e1inp_line structure. Reported-by: Gus Bourg <gus@bourg.net>
Diffstat (limited to 'src/input/hsl.c')
-rw-r--r--src/input/hsl.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/input/hsl.c b/src/input/hsl.c
index dc7532b..60eea17 100644
--- a/src/input/hsl.c
+++ b/src/input/hsl.c
@@ -456,9 +456,29 @@ static int hsl_bts_connect(struct ipa_client_link *link)
return 0;
}
+struct hsl_line {
+ int line_already_initialized;
+};
+
static int hsl_line_update(struct e1inp_line *line)
{
int ret = -ENOENT;
+ struct hsl_line *hl;
+
+ if (!line->driver_data)
+ line->driver_data = talloc_zero(line, struct hsl_line);
+
+ if (!line->driver_data) {
+ LOGP(DLINP, LOGL_NOTICE, "hsl: OOM in line update\n");
+ return -ENOMEM;
+ }
+ hl = line->driver_data;
+
+ /* We only initialize this line once. */
+ if (hl->line_already_initialized)
+ return 0;
+
+ hl->line_already_initialized = 1;
switch(line->ops->cfg.ipa.role) {
case E1INP_LINE_R_BSC: