aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-01-31 18:36:27 +0100
committerlaforge <laforge@osmocom.org>2021-02-02 11:37:48 +0000
commit36c5e2b3e0406ed5f0748339ec3c81a3457e3ccf (patch)
tree92261cc97ebace0ac77d4411ceab28e57036b4e3
parent2cc1d4d7dfc8fb9837fc62992ccb92c1f8613706 (diff)
frame_relay: Discard received messages for DLC not yet active
If we receive messages for a DLC which has not yet reported as being available by Q.933 LMI, drop the incoming message. Otherwise we would dispatch it to the user, and the user wants to respond - but then we reject the transmission due to the inactive DLC. Change-Id: Ia4a045fdf165b526f429f4617e0fdc76036480bd Related: OS#4999
-rw-r--r--src/gb/frame_relay.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gb/frame_relay.c b/src/gb/frame_relay.c
index a7e1da8a..e9436fef 100644
--- a/src/gb/frame_relay.c
+++ b/src/gb/frame_relay.c
@@ -784,19 +784,22 @@ int osmo_fr_rx(struct msgb *msg)
goto out;
}
- llist_for_each_entry(dlc, &link->dlc_list, list) {
- if (dlc->dlci == dlci) {
+ dlc = osmo_fr_dlc_by_dlci(link, dlci);
+ if (dlc) {
+ if (dlc->active) {
/* dispatch to handler of respective DLC */
msg->dst = dlc;
return dlc->rx_cb(dlc->cb_data, msg);
+ } else {
+ LOGPFRL(link, LOGL_NOTICE, "DLCI %u not yet active, discarding\n", dlci);
}
+ } else {
+ if (link->unknown_dlc_rx_cb)
+ return link->unknown_dlc_rx_cb(link->unknown_dlc_rx_cb_data, msg);
+ else
+ LOGPFRL(link, LOGL_NOTICE, "DLCI %u doesn't exist, discarding\n", dlci);
}
- if (link->unknown_dlc_rx_cb)
- return link->unknown_dlc_rx_cb(link->unknown_dlc_rx_cb_data, msg);
- else
- LOGPFRL(link, LOGL_NOTICE, "DLCI %u doesn't exist, discarding\n", dlci);
-
out:
msgb_free(msg);