diff options
author | Vinicius Costa Gomes <vinicius.gomes@openbossa.org> | 2011-01-26 19:42:57 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-06-13 15:05:34 -0400 |
commit | f1cb9af557dd8fb5d98fbcc4b5d3eb9d6d235af7 (patch) | |
tree | e2701e2cecfbf5cea1a079a7a87f8bfe020b7598 /net/bluetooth/l2cap_sock.c | |
parent | 9b3d67405b17d61ba8be9d824222fb410f487b8a (diff) |
Bluetooth: Add support for resuming socket when SMP is finished
This adds support for resuming the user space traffic when SMP
negotiation is complete.
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/l2cap_sock.c')
-rw-r--r-- | net/bluetooth/l2cap_sock.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 1d9c36509d7b..5c819e002fb1 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <net/bluetooth/bluetooth.h> | 29 | #include <net/bluetooth/bluetooth.h> |
30 | #include <net/bluetooth/hci_core.h> | 30 | #include <net/bluetooth/hci_core.h> |
31 | #include <net/bluetooth/l2cap.h> | 31 | #include <net/bluetooth/l2cap.h> |
32 | #include <net/bluetooth/smp.h> | ||
32 | 33 | ||
33 | static const struct proto_ops l2cap_sock_ops; | 34 | static const struct proto_ops l2cap_sock_ops; |
34 | static void l2cap_sock_init(struct sock *sk, struct sock *parent); | 35 | static void l2cap_sock_init(struct sock *sk, struct sock *parent); |
@@ -562,6 +563,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch | |||
562 | struct l2cap_chan *chan = l2cap_pi(sk)->chan; | 563 | struct l2cap_chan *chan = l2cap_pi(sk)->chan; |
563 | struct bt_security sec; | 564 | struct bt_security sec; |
564 | struct bt_power pwr; | 565 | struct bt_power pwr; |
566 | struct l2cap_conn *conn; | ||
565 | int len, err = 0; | 567 | int len, err = 0; |
566 | u32 opt; | 568 | u32 opt; |
567 | 569 | ||
@@ -598,6 +600,20 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch | |||
598 | } | 600 | } |
599 | 601 | ||
600 | chan->sec_level = sec.level; | 602 | chan->sec_level = sec.level; |
603 | |||
604 | conn = chan->conn; | ||
605 | if (conn && chan->scid == L2CAP_CID_LE_DATA) { | ||
606 | if (!conn->hcon->out) { | ||
607 | err = -EINVAL; | ||
608 | break; | ||
609 | } | ||
610 | |||
611 | if (smp_conn_security(conn, sec.level)) | ||
612 | break; | ||
613 | |||
614 | err = 0; | ||
615 | sk->sk_state = BT_CONFIG; | ||
616 | } | ||
601 | break; | 617 | break; |
602 | 618 | ||
603 | case BT_DEFER_SETUP: | 619 | case BT_DEFER_SETUP: |