From 36c5e2b3e0406ed5f0748339ec3c81a3457e3ccf Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 31 Jan 2021 18:36:27 +0100 Subject: 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 --- src/gb/frame_relay.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') 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); -- cgit v1.2.3