You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/11/18 07:47:52 UTC

[GitHub] [mynewt-nimble] rymanluk commented on a change in pull request #650: host/l2cap_coc: fix receiving of frames with size 1

rymanluk commented on a change in pull request #650: host/l2cap_coc: fix receiving of frames with size 1
URL: https://github.com/apache/mynewt-nimble/pull/650#discussion_r347235166
 
 

 ##########
 File path: nimble/host/src/ble_l2cap_coc.c
 ##########
 @@ -186,9 +186,13 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan)
     rx = &chan->coc_rx;
 
     om_total = OS_MBUF_PKTLEN(*om);
-    rc = ble_hs_mbuf_pullup_base(om, BLE_L2CAP_SDU_SIZE);
-    if (rc != 0) {
-        return rc;
+    /* Continuation LE frames might be of size 1, so we skip the pullup step
+     * for these */
+    if (om_total >= BLE_L2CAP_SDU_SIZE) {
+        rc = ble_hs_mbuf_pullup_base(om, BLE_L2CAP_SDU_SIZE);
 
 Review comment:
   As you noticed that should be done only for the very first packet.
   Therefore instead of that `if` please move that code  below the 
   
   ``` 
      /* First LE frame */
       if (OS_MBUF_PKTLEN(rx->sdu) == 0) {
   ```
   
   Btw this pullup might look paranoid but we want to do it before accessing om_data directly.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services