rymanluk commented on a change in pull request #636: NimBLE/host: 
`ble_gap_unpair` should continue un-pairing after connection termination
URL: https://github.com/apache/mynewt-nimble/pull/636#discussion_r343932026
 
 

 ##########
 File path: nimble/host/src/ble_gap.c
 ##########
 @@ -5192,7 +5192,7 @@ ble_gap_unpair(const ble_addr_t *peer_addr)
     conn = ble_hs_conn_find_by_addr(peer_addr);
     if (conn != NULL) {
         rc = ble_gap_terminate_with_conn(conn, BLE_ERR_REM_USER_CONN_TERM);
-        if ((rc != BLE_HS_EALREADY) && (rc != BLE_HS_ENOTCONN)) {
+        if ((rc != 0) &&  (rc != BLE_HS_EALREADY) && (rc != BLE_HS_ENOTCONN)) {
 
 Review comment:
   I agree here, but actually I don't understand why we return here if 
disconnection will not succeed (which is very unlikely imho), I believe we 
should not return at all but just go further and do unpair. 
   
   However there is an issue below anyway  in
   
       rc = ble_hs_pvcy_remove_entry(peer_addr->type,
                                     peer_addr->val);
   
   Issue here is that in case of privacy, the provided peer_addr_type here is 
probably either 0x02 or 0x03 which is invalid type for 
ble_hs_pvcy_remove_entry().
   
   I think we should modify ble_hs_pvcy_remove_entry() in the way that this 
will not reject types 0x02 and 0x03 but instead will translate it to the 
appropriate HCI parameters (0x00, 0x01).  
   
   If you could create separate patch out of it it would be great.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to