You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ko...@apache.org on 2021/09/21 09:22:06 UTC

[mynewt-nimble] branch revert-1001-l2cap_disconn_inval_cids created (now aba90f6)

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

kopyscinski pushed a change to branch revert-1001-l2cap_disconn_inval_cids
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git.


      at aba90f6  Revert "host/l2cap: send command reject in L2CAP disc req for invalid CID"

This branch includes the following new commits:

     new 192b8ef  Revert "host/tests: add test for invalid CID in disconnection request"
     new aba90f6  Revert "host/l2cap: send command reject in L2CAP disc req for invalid CID"

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[mynewt-nimble] 01/02: Revert "host/tests: add test for invalid CID in disconnection request"

Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kopyscinski pushed a commit to branch revert-1001-l2cap_disconn_inval_cids
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 192b8efd675b5ad74dd334cd19ed4a73e7d1901b
Author: Krzysztof Kopyściński <32...@users.noreply.github.com>
AuthorDate: Tue Sep 21 11:22:03 2021 +0200

    Revert "host/tests: add test for invalid CID in disconnection request"
    
    This reverts commit e0b15dadd1d3007879b912ad48a481ed1a4bffec.
---
 nimble/host/test/src/ble_hs_test_util.h |  2 --
 nimble/host/test/src/ble_l2cap_test.c   | 64 ---------------------------------
 2 files changed, 66 deletions(-)

diff --git a/nimble/host/test/src/ble_hs_test_util.h b/nimble/host/test/src/ble_hs_test_util.h
index 7a0aa3e..411443c 100644
--- a/nimble/host/test/src/ble_hs_test_util.h
+++ b/nimble/host/test/src/ble_hs_test_util.h
@@ -162,8 +162,6 @@ int ble_hs_test_util_l2cap_rx_payload_flat(uint16_t conn_handle, uint16_t cid,
                                            const void *data, int len);
 uint8_t ble_hs_test_util_verify_tx_l2cap_sig(uint16_t opcode, void *cmd,
                                                  uint16_t cmd_size);
-uint8_t ble_hs_test_util_verify_tx_l2cap_discon_rej(uint16_t opcode, void *cmd,
-                                             uint16_t cmd_size);
 int ble_hs_test_util_inject_rx_l2cap_sig(uint16_t conn_handle, uint8_t opcode,
                                      uint8_t id, void *cmd, uint16_t cmd_size);
 void ble_hs_test_util_verify_tx_l2cap(struct os_mbuf *txom);
diff --git a/nimble/host/test/src/ble_l2cap_test.c b/nimble/host/test/src/ble_l2cap_test.c
index 0f55bc0..2b17da0 100644
--- a/nimble/host/test/src/ble_l2cap_test.c
+++ b/nimble/host/test/src/ble_l2cap_test.c
@@ -1000,46 +1000,6 @@ ble_l2cap_test_coc_disc_by_peer(struct test_data *t)
 }
 
 static void
-ble_l2cap_test_coc_disc_by_peer_invalid_dcid(struct test_data *t)
-{
-    struct ble_l2cap_sig_disc_req req;
-    struct event *ev = &t->event[t->event_iter++];
-    uint8_t id = 10;
-    int rc;
-    struct os_mbuf *cmd;
-    uint16_t rej_err = htole16(BLE_L2CAP_SIG_ERR_INVALID_CID);
-    req.dcid = htole16(t->chan[0]->dcid + 1);
-    req.scid = htole16(t->chan[0]->dcid);
-
-    rc = ble_hs_test_util_inject_rx_l2cap_sig(2, BLE_L2CAP_SIG_OP_DISCONN_REQ,
-                                              id, &req, sizeof(req));
-    TEST_ASSERT(rc == 0);
-
-    /* Ensure callback got NOT called. */
-    TEST_ASSERT(!ev->handled);
-
-    struct {
-        uint16_t local_cid;
-        uint16_t remote_cid;
-    } data = {
-        .local_cid = req.scid,
-        .remote_cid = req.dcid,
-    };
-
-    /* Ensure an we sent back Command Reject response
-     * Recect command should contain reason  and CIDs pair
-     */
-    cmd = os_mbuf_get(&sdu_os_mbuf_pool, 0);
-    os_mbuf_append(cmd, &rej_err, sizeof(uint16_t));
-    os_mbuf_append(cmd, &data, sizeof(data));
-
-    ble_hs_test_util_verify_tx_l2cap_sig(
-        BLE_L2CAP_SIG_OP_REJECT,
-        cmd->om_data, cmd->om_len);
-    os_mbuf_free_chain(cmd);
-}
-
-static void
 ble_l2cap_test_coc_invalid_disc_by_peer(struct test_data *t)
 {
     struct ble_l2cap_sig_disc_req req;
@@ -1401,29 +1361,6 @@ TEST_CASE_SELF(ble_l2cap_test_case_sig_coc_incoming_disconnect_failed)
     ble_hs_test_util_assert_mbufs_freed(NULL);
 }
 
-TEST_CASE_SELF(ble_l2cap_test_case_invalid_cid_in_disconnect_req)
-{
-    struct test_data t;
-
-    ble_l2cap_test_util_init();
-
-    ble_l2cap_test_set_chan_test_conf(BLE_L2CAP_TEST_PSM,
-    BLE_L2CAP_TEST_COC_MTU, &t);
-    t.expected_num_of_ev = 1;
-
-    t.event[0].type = BLE_L2CAP_EVENT_COC_CONNECTED;
-    t.event[0].app_status = 0;
-    t.event[0].l2cap_status = BLE_L2CAP_COC_ERR_CONNECTION_SUCCESS;
-    t.event[1].type = BLE_L2CAP_EVENT_COC_DISCONNECTED;
-
-    ble_l2cap_test_coc_connect(&t);
-    ble_l2cap_test_coc_disc_by_peer_invalid_dcid(&t);
-
-    TEST_ASSERT(t.expected_num_of_ev == t.event_cnt);
-
-    ble_hs_test_util_assert_mbufs_freed(NULL);
-}
-
 TEST_CASE_SELF(ble_l2cap_test_case_coc_send_data_succeed)
 {
     struct test_data t;
@@ -1556,7 +1493,6 @@ TEST_SUITE(ble_l2cap_test_suite)
     ble_l2cap_test_case_sig_coc_disconnect_succeed();
     ble_l2cap_test_case_sig_coc_incoming_disconnect_succeed();
     ble_l2cap_test_case_sig_coc_incoming_disconnect_failed();
-    ble_l2cap_test_case_invalid_cid_in_disconnect_req();
     ble_l2cap_test_case_coc_send_data_succeed();
     ble_l2cap_test_case_coc_send_data_failed_too_big_sdu();
     ble_l2cap_test_case_coc_recv_data_succeed();

[mynewt-nimble] 02/02: Revert "host/l2cap: send command reject in L2CAP disc req for invalid CID"

Posted by ko...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kopyscinski pushed a commit to branch revert-1001-l2cap_disconn_inval_cids
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit aba90f6dac40f42b07c2e422dda0e2dfa35fd34c
Author: Krzysztof Kopyściński <32...@users.noreply.github.com>
AuthorDate: Tue Sep 21 11:22:03 2021 +0200

    Revert "host/l2cap: send command reject in L2CAP disc req for invalid CID"
    
    This reverts commit fcb617a2ef533460b92bcd030aef81e3ed7106b9.
---
 nimble/host/src/ble_l2cap_sig.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/nimble/host/src/ble_l2cap_sig.c b/nimble/host/src/ble_l2cap_sig.c
index 2a36161..fab16ea 100644
--- a/nimble/host/src/ble_l2cap_sig.c
+++ b/nimble/host/src/ble_l2cap_sig.c
@@ -1552,13 +1552,7 @@ ble_l2cap_sig_disc_req_rx(uint16_t conn_handle, struct ble_l2cap_sig_hdr *hdr,
      * is from peer perspective. It is source CID from nimble perspective
      */
     chan = ble_hs_conn_chan_find_by_scid(conn, le16toh(req->dcid));
-    if (!chan) {
-        os_mbuf_free_chain(txom);
-        ble_hs_unlock();
-        ble_l2cap_sig_reject_invalid_cid_tx(conn_handle, hdr->identifier, req->dcid, req->scid);
-        return 0;
-    }
-    if (le16toh(req->scid) != chan->dcid) {
+    if (!chan || (le16toh(req->scid) != chan->dcid)) {
         os_mbuf_free_chain(txom);
         ble_hs_unlock();
         return 0;