Bluetooth: SMP: Report failure only for authenticated pairing

If JustWorks pairing is used for pairing don't report failure.

Change-Id: I23cee54a74dd021c1f273d987ca67066452d7801
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2015-08-17 17:49:46 +02:00 committed by Anas Nashif
commit 84e9c1ec69

View file

@ -770,6 +770,7 @@ static void smp_reset(struct bt_conn *conn)
static uint8_t smp_pairing_failed(struct bt_conn *conn, struct bt_buf *buf)
{
struct bt_smp_pairing_fail *req = (void *)buf->data;
struct bt_smp *smp = conn->smp;
BT_ERR("reason 0x%x\n", req->reason);
@ -779,16 +780,17 @@ static uint8_t smp_pairing_failed(struct bt_conn *conn, struct bt_buf *buf)
*/
ARG_UNUSED(req);
smp_reset(conn);
switch (bt_smp_io_capa) {
case BT_SMP_IO_DISPLAY_ONLY:
switch (smp->method) {
case PASSKEY_INPUT:
case PASSKEY_DISPLAY:
auth_cb->cancel(conn);
break;
default:
break;
}
smp_reset(conn);
/* return no error to avoid sending Pairing Failed in response */
return 0;
}