aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap_sock.c
diff options
context:
space:
mode:
authorVille Tervo <ville.tervo@nokia.com>2011-02-10 20:38:50 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2011-02-16 14:33:02 -0500
commitb62f328b8f20abe97cdbaaf44c6e4f5e7a610f18 (patch)
tree85788ac51ee97fc12765e715f679c447f27ba5ac /net/bluetooth/l2cap_sock.c
parentacd7d3708555b3da7522e23c183cc21efc785f72 (diff)
Bluetooth: Add server socket support for LE connection
Add support for LE server sockets. Signed-off-by: Ville Tervo <ville.tervo@nokia.com> Acked-by: Marcel Holtmann <marcel@holtmann.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.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index f45d361e84d1..a8d289373794 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -103,7 +103,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
103 len = min_t(unsigned int, sizeof(la), alen); 103 len = min_t(unsigned int, sizeof(la), alen);
104 memcpy(&la, addr, len); 104 memcpy(&la, addr, len);
105 105
106 if (la.l2_cid) 106 if (la.l2_cid && la.l2_psm)
107 return -EINVAL; 107 return -EINVAL;
108 108
109 lock_sock(sk); 109 lock_sock(sk);
@@ -145,6 +145,9 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
145 l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; 145 l2cap_pi(sk)->sec_level = BT_SECURITY_SDP;
146 } 146 }
147 147
148 if (la.l2_cid)
149 l2cap_pi(sk)->scid = la.l2_cid;
150
148 write_unlock_bh(&l2cap_sk_list.lock); 151 write_unlock_bh(&l2cap_sk_list.lock);
149 152
150done: 153done:
@@ -266,7 +269,7 @@ static int l2cap_sock_listen(struct socket *sock, int backlog)
266 goto done; 269 goto done;
267 } 270 }
268 271
269 if (!l2cap_pi(sk)->psm) { 272 if (!l2cap_pi(sk)->psm && !l2cap_pi(sk)->dcid) {
270 bdaddr_t *src = &bt_sk(sk)->src; 273 bdaddr_t *src = &bt_sk(sk)->src;
271 u16 psm; 274 u16 psm;
272 275