aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/input
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-06-20 10:41:47 +0200
committerHarald Welte <laforge@gnumonks.org>2010-06-20 10:44:15 +0200
commitb37e5f8a603d513056da697e08a9976206fd843b (patch)
tree662ada073294b99ca4768ea9b60a524899d37aca /openbsc/src/input
parentb88b6d3ea612985cb09d6b2785c0d0c4c94895ee (diff)
[BSC] mISDN: Avoid sending RSL messages to wrong channel number
In some cases, we get a DL_INFORMATION_IND with a wrong channel number, and only in the DL_ESTABLISH_IND we will see the real channel number that is to be used for this (TEI, SAPI) tuple.
Diffstat (limited to 'openbsc/src/input')
-rw-r--r--openbsc/src/input/misdn.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/openbsc/src/input/misdn.c b/openbsc/src/input/misdn.c
index 83b01f2ca..fa8aca02c 100644
--- a/openbsc/src/input/misdn.c
+++ b/openbsc/src/input/misdn.c
@@ -141,7 +141,18 @@ static int handle_ts1_read(struct bsc_fd *bfd)
break;
case DL_ESTABLISH_IND:
DEBUGP(DMI, "DL_ESTABLISH_IND: channel(%d) sapi(%d) tei(%d)\n",
- l2addr.channel, l2addr.sapi, l2addr.tei);
+ l2addr.channel, l2addr.sapi, l2addr.tei);
+ /* For some strange reason, sometimes the DL_INFORMATION_IND tells
+ * us the wrong channel, and we only get the real channel number
+ * during the DL_ESTABLISH_IND */
+ link = e1inp_lookup_sign_link(e1i_ts, l2addr.tei, l2addr.sapi);
+ if (!link) {
+ DEBUGPC(DMI, "mISDN message for unknown sign_link\n");
+ msgb_free(msg);
+ return -EINVAL;
+ }
+ /* save the channel number in the driver private struct */
+ link->driver.misdn.channel = l2addr.channel;
ret = e1inp_event(e1i_ts, EVT_E1_TEI_UP, l2addr.tei, l2addr.sapi);
break;
case DL_RELEASE_IND:
@@ -217,7 +228,8 @@ static int handle_ts1_write(struct bsc_fd *bfd)
hh = (struct mISDNhead *) msgb_push(msg, sizeof(*hh));
hh->prim = DL_DATA_REQ;
- DEBUGP(DMI, "TX TEI(%d) SAPI(%d): %s\n", sign_link->tei,
+ DEBUGP(DMI, "TX channel(%d) TEI(%d) SAPI(%d): %s\n",
+ sign_link->driver.misdn.channel, sign_link->tei,
sign_link->sapi, hexdump(l2_data, msg->len - MISDN_HEADER_LEN));
/* construct the sockaddr */