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 2017/03/03 17:36:18 UTC
[03/26] incubator-mynewt-core git commit: nimble/l2cap: Fix L2CAP LE
CoC disconnection handling
nimble/l2cap: Fix L2CAP LE CoC disconnection handling
This patch fixes mess around scid/dcid on L2CAP disconnection
request
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/506e3738
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/506e3738
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/506e3738
Branch: refs/heads/develop
Commit: 506e3738f7cd4155b5126fa7427536b81613536f
Parents: ced3e8b
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Wed Feb 22 17:37:39 2017 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Fri Mar 3 12:40:41 2017 +0100
----------------------------------------------------------------------
net/nimble/host/src/ble_l2cap_sig.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/506e3738/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 a1a3399..9292137 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -877,15 +877,21 @@ ble_l2cap_sig_disc_req_rx(uint16_t conn_handle, struct ble_l2cap_sig_hdr *hdr,
req = (struct ble_l2cap_sig_disc_req *) (*om)->om_data;
+ /* Let's find matching channel. Note that destination CID in the request
+ * is from peer perspective. It is source CID from nimble perspective
+ */
chan = ble_hs_conn_chan_find(conn, le16toh(req->dcid));
- if (!chan || (le16toh(req->scid) != chan->scid)) {
+ if (!chan || (le16toh(req->scid) != chan->dcid)) {
os_mbuf_free_chain(txom);
ble_hs_unlock();
return 0;
}
- rsp->dcid = htole16(chan->dcid);
- rsp->scid = htole16(chan->scid);
+ /* Note that in the response destination CID is form peer perspective and
+ * it is source CID from nimble perspective.
+ */
+ rsp->dcid = htole16(chan->scid);
+ rsp->scid = htole16(chan->dcid);
ble_l2cap_event_coc_disconnected(chan);