bsc_api: Only forward L3 messages when the channel is active
Avoid forwarding messages from a channel that is already being
closed. Harald has forwarded a crash report where this was failing.
diff --git a/openbsc/src/bsc_api.c b/openbsc/src/bsc_api.c
index 856dc61..2cb3b1a 100644
--- a/openbsc/src/bsc_api.c
+++ b/openbsc/src/bsc_api.c
@@ -29,6 +29,7 @@
#include <openbsc/abis_rsl.h>
#include <openbsc/chan_alloc.h>
#include <openbsc/handover.h>
+#include <openbsc/debug.h>
#include <osmocore/talloc.h>
@@ -94,6 +95,12 @@
struct gsm_lchan *lchan;
lchan = msg->lchan;
+ if (lchan->state != LCHAN_S_ACTIVE) {
+ LOGP(DRSL, LOGL_ERROR, "Got data in non active state. discarding.\n");
+ return -1;
+ }
+
+
if (lchan->conn) {
api->dtap(lchan->conn, msg);
} else {