Bluetooth: Add support for SMP timeout
Vinicius Costa Gomes [Tue, 14 Jun 2011 16:37:41 +0000 (13:37 -0300)]
This patch adds support for disconnecting the link when SMP procedure
takes more than 30 seconds.

SMP begins when either the Pairing Request command is sent or the
Pairing Response is received, and it ends when the link is encrypted
(or terminated). Vol 3, Part H Section 3.4.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>

include/net/bluetooth/l2cap.h
net/bluetooth/smp.c

index 4f34ad2..7493317 100644 (file)
@@ -418,6 +418,8 @@ struct l2cap_conn {
 
        struct timer_list security_timer;
 
+       struct timer_list security_timer;
+
        struct list_head chan_l;
        rwlock_t        chan_lock;
 };
index 391888b..c45dd73 100644 (file)
@@ -270,6 +270,9 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
        mod_timer(&conn->security_timer, jiffies +
                                        msecs_to_jiffies(SMP_TIMEOUT));
 
+       mod_timer(&conn->security_timer, jiffies +
+                                       msecs_to_jiffies(SMP_TIMEOUT));
+
        return 0;
 }