}
// We could have received a new link key without going through the pairing
- // flow.
- // If so, we don't want to perform SDP or any other operations on the
- // authenticated
- // device.
- if (bdcmp(p_auth_cmpl->bd_addr, pairing_cb.bd_addr) != 0) {
+ // flow. If so, we don't want to perform SDP or any other operations on the
+ // authenticated device. Also, make sure that the link key is not derived from
+ // secure LTK, because we will need to perform SDP in case of link key
+ // derivation to allow bond state change notification for the BR/EDR transport
+ // so that the subsequent BR/EDR connections to the remote can use the derived
+ // link key.
+ if ((bdcmp(p_auth_cmpl->bd_addr, pairing_cb.bd_addr) != 0) &&
+ (!pairing_cb.ble.is_penc_key_rcvd)) {
char address[32];
bt_bdaddr_t bt_bdaddr;