You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/11/30 20:07:05 UTC

[4/8] incubator-mynewt-core git commit: nimble/l2cap: Fix for handling unknown L2CAP signaling commands

nimble/l2cap: Fix for handling unknown L2CAP signaling commands

With this patch, all unsupported signaling commands are rejected with
a reason "command not understood".

Note that with this patch reject command goes from a single place for
signaling commands.

This patch is a fix for qualification test TC_LE_REJ_BI_02


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/63c20682
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/63c20682
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/63c20682

Branch: refs/heads/develop
Commit: 63c20682e5acb8fbd7ec6928364d30aa965e90c8
Parents: 9db957a
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Mon Nov 28 15:07:01 2016 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Tue Nov 29 23:03:49 2016 +0100

----------------------------------------------------------------------
 net/nimble/host/src/ble_l2cap_sig.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/63c20682/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index 1223934..1e6548c 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -364,9 +364,6 @@ ble_l2cap_sig_update_req_rx(uint16_t conn_handle,
         rc = ble_l2cap_sig_update_rsp_tx(conn_handle, hdr->identifier,
                                          l2cap_result);
     } else {
-        ble_l2cap_sig_reject_tx(conn_handle, hdr->identifier,
-                                BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD,
-                                NULL, 0);
         rc = BLE_HS_L2C_ERR(BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD);
     }
 
@@ -504,14 +501,17 @@ ble_l2cap_sig_rx(uint16_t conn_handle, struct os_mbuf **om)
 
     rx_cb = ble_l2cap_sig_dispatch_get(hdr.op);
     if (rx_cb == NULL) {
-        ble_l2cap_sig_reject_tx(conn_handle, hdr.identifier,
-                                BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD,
-                                NULL, 0);
         rc = BLE_HS_L2C_ERR(BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD);
     } else {
         rc = rx_cb(conn_handle, &hdr, om);
     }
 
+    if (rc) {
+        ble_l2cap_sig_reject_tx(conn_handle, hdr.identifier,
+                                        BLE_L2CAP_SIG_ERR_CMD_NOT_UNDERSTOOD,
+                                        NULL, 0);
+    }
+
     return rc;
 }