aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libabis/input/dahdi.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-08-09 23:15:38 +0200
committerHarald Welte <laforge@gnumonks.org>2011-08-10 10:51:02 +0200
commitcd98656315c4e81816866823920fc1951f0c2a0b (patch)
tree280e0576a65721134a0bdf8a9f0f0a324b1c511f /openbsc/src/libabis/input/dahdi.c
parent1045697c349a432ef4b0a8dfd5ad20549afe2f39 (diff)
LAPD: Propagate lapd_receive() errors to the E1 driver
Scenario: BTS are configured and working, then the BSC stops working for some reason (crash or administrative stop). If the BSC comes back to life, LAPD among other things does not know about the previous existing TEIs. Instead of ignoring these frames, we notify the driver that we are seeing frames with unknown TEIs, so it can try to recover, e.g. by resending the SABM message.
Diffstat (limited to 'openbsc/src/libabis/input/dahdi.c')
-rw-r--r--openbsc/src/libabis/input/dahdi.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/openbsc/src/libabis/input/dahdi.c b/openbsc/src/libabis/input/dahdi.c
index a7b45a1af..eb66fa018 100644
--- a/openbsc/src/libabis/input/dahdi.c
+++ b/openbsc/src/libabis/input/dahdi.c
@@ -100,7 +100,7 @@ static int handle_ts1_read(struct osmo_fd *bfd)
struct msgb *msg = msgb_alloc(TS1_ALLOC_SIZE, "DAHDI TS1");
lapd_mph_type prim;
unsigned int sapi, tei;
- int ilen, ret;
+ int ilen, ret, error = 0;
uint8_t *idata;
if (!msg)
@@ -122,9 +122,21 @@ static int handle_ts1_read(struct osmo_fd *bfd)
DEBUGP(DMI, "<= len = %d, sapi(%d) tei(%d)", ret, sapi, tei);
- idata = lapd_receive(e1i_ts->driver.dahdi.lapd, msg->data, msg->len, &ilen, &prim);
- if (!idata && prim == 0)
- return -EIO;
+ idata = lapd_receive(e1i_ts->driver.dahdi.lapd, msg->data, msg->len, &ilen, &prim, &error);
+ if (!idata) {
+ switch(error) {
+ case LAPD_ERR_UNKNOWN_TEI:
+ /* We don't know about this TEI, probably the BSC
+ * lost local states (it crashed or it was stopped),
+ * notify the driver to see if it can do anything to
+ * recover the existing signalling links with the BTS.
+ */
+ e1inp_event(e1i_ts, S_INP_TEI_UNKNOWN, tei, sapi);
+ return -EIO;
+ }
+ if (prim == 0)
+ return -EIO;
+ }
msgb_pull(msg, 2);