You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ry...@apache.org on 2020/03/07 00:09:33 UTC

[mynewt-nimble] 02/11: nimble/l2cap: Disconnect CoC when too big SDU is sent by peer

This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 7f0a9c950388b5f5c08632b6e0017e8e408d6cc0
Author: Ɓukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Mon Jan 27 21:46:52 2020 +0100

    nimble/l2cap: Disconnect CoC when too big SDU is sent by peer
    
    This is to satisfy PTS and we actually planned to do so anyway.
---
 nimble/host/src/ble_l2cap_coc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/nimble/host/src/ble_l2cap_coc.c b/nimble/host/src/ble_l2cap_coc.c
index f8561e1..329c87c 100644
--- a/nimble/host/src/ble_l2cap_coc.c
+++ b/nimble/host/src/ble_l2cap_coc.c
@@ -199,9 +199,11 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan)
 
         sdu_len = get_le16((*om)->om_data);
         if (sdu_len > rx->mtu) {
-            /* TODO Disconnect?*/
             BLE_HS_LOG(INFO, "error: sdu_len > rx->mtu (%d>%d)\n",
                        sdu_len, rx->mtu);
+
+            /* Disconnect peer with invalid behaviour */
+            ble_l2cap_disconnect(chan);
             return BLE_HS_EBADDATA;
         }