diff options
author | Vinicius Costa Gomes <vinicius.gomes@openbossa.org> | 2011-08-19 20:06:50 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-09-21 11:58:10 -0400 |
commit | e2dcd113d15ef99d23498859e7006955b5367698 (patch) | |
tree | c5349d3b23e09b413bbfd21d0964408aa374f18b /net/bluetooth/smp.c | |
parent | 52087a792c1513b85de674a4fc67fb92855474c3 (diff) |
Bluetooth: Reset the security timer when a command is queued
Each time a SMP command is enqueued, we reset the SMP timer,
this way we follow exactly what the spec mandates:
"The Security Manager Timer shall be reset when an L2CAP SMP command is
queued for transmission." 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>
Diffstat (limited to 'net/bluetooth/smp.c')
-rw-r--r-- | net/bluetooth/smp.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 391888b88a92..20c82c7000ac 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -182,6 +182,9 @@ static void smp_send_cmd(struct l2cap_conn *conn, u8 code, u16 len, void *data) | |||
182 | return; | 182 | return; |
183 | 183 | ||
184 | hci_send_acl(conn->hcon, skb, 0); | 184 | hci_send_acl(conn->hcon, skb, 0); |
185 | |||
186 | mod_timer(&conn->security_timer, jiffies + | ||
187 | msecs_to_jiffies(SMP_TIMEOUT)); | ||
185 | } | 188 | } |
186 | 189 | ||
187 | static __u8 seclevel_to_authreq(__u8 level) | 190 | static __u8 seclevel_to_authreq(__u8 level) |
@@ -267,9 +270,6 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
267 | 270 | ||
268 | smp_send_cmd(conn, SMP_CMD_PAIRING_RSP, sizeof(rsp), &rsp); | 271 | smp_send_cmd(conn, SMP_CMD_PAIRING_RSP, sizeof(rsp), &rsp); |
269 | 272 | ||
270 | mod_timer(&conn->security_timer, jiffies + | ||
271 | msecs_to_jiffies(SMP_TIMEOUT)); | ||
272 | |||
273 | return 0; | 273 | return 0; |
274 | } | 274 | } |
275 | 275 | ||
@@ -351,9 +351,6 @@ static u8 smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb) | |||
351 | smp_send_cmd(conn, SMP_CMD_PAIRING_CONFIRM, sizeof(cp), &cp); | 351 | smp_send_cmd(conn, SMP_CMD_PAIRING_CONFIRM, sizeof(cp), &cp); |
352 | } | 352 | } |
353 | 353 | ||
354 | mod_timer(&conn->security_timer, jiffies + | ||
355 | msecs_to_jiffies(SMP_TIMEOUT)); | ||
356 | |||
357 | return 0; | 354 | return 0; |
358 | } | 355 | } |
359 | 356 | ||
@@ -446,9 +443,6 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
446 | 443 | ||
447 | smp_send_cmd(conn, SMP_CMD_PAIRING_REQ, sizeof(cp), &cp); | 444 | smp_send_cmd(conn, SMP_CMD_PAIRING_REQ, sizeof(cp), &cp); |
448 | 445 | ||
449 | mod_timer(&conn->security_timer, jiffies + | ||
450 | msecs_to_jiffies(SMP_TIMEOUT)); | ||
451 | |||
452 | set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->pend); | 446 | set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->pend); |
453 | 447 | ||
454 | return 0; | 448 | return 0; |
@@ -498,9 +492,6 @@ int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level) | |||
498 | conn->preq[0] = SMP_CMD_PAIRING_REQ; | 492 | conn->preq[0] = SMP_CMD_PAIRING_REQ; |
499 | memcpy(&conn->preq[1], &cp, sizeof(cp)); | 493 | memcpy(&conn->preq[1], &cp, sizeof(cp)); |
500 | 494 | ||
501 | mod_timer(&conn->security_timer, jiffies + | ||
502 | msecs_to_jiffies(SMP_TIMEOUT)); | ||
503 | |||
504 | smp_send_cmd(conn, SMP_CMD_PAIRING_REQ, sizeof(cp), &cp); | 495 | smp_send_cmd(conn, SMP_CMD_PAIRING_REQ, sizeof(cp), &cp); |
505 | } else { | 496 | } else { |
506 | struct smp_cmd_security_req cp; | 497 | struct smp_cmd_security_req cp; |