aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-05-29 06:59:13 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2012-06-04 23:34:13 -0400
commite072f5dab22e7bf0a10daf854acc0fc271396ee7 (patch)
tree8a03d1852e29948c29c3bd927b0d40a40a167673 /net/bluetooth
parenta28381dc9ca3e54b0678e2cd7c68c1afb2d7cc76 (diff)
Bluetooth: A2MP: Process A2MP Create Physlink Request
Placeholder for A2MP Create Physlink Request. Handles requests with invalid controler id as shown below: ... > ACL data: handle 11 flags 0x02 dlen 50 A2MP: Create Physical Link req: local id 1 remote id 85 Assoc data: <skipped> < ACL data: handle 11 flags 0x00 dlen 15 A2MP: Create Physical Link rsp: local id 85 remote id 1 status 1 Invalid Controller ID ... Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/a2mp.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index b8eeb33d60d7..ca52a91edd29 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -243,6 +243,43 @@ clean:
243 return 0; 243 return 0;
244} 244}
245 245
246static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
247 struct a2mp_cmd *hdr)
248{
249 struct a2mp_physlink_req *req = (void *) skb->data;
250
251 struct a2mp_physlink_rsp rsp;
252 struct hci_dev *hdev;
253
254 if (le16_to_cpu(hdr->len) < sizeof(*req))
255 return -EINVAL;
256
257 BT_DBG("local_id %d, remote_id %d", req->local_id, req->remote_id);
258
259 rsp.local_id = req->remote_id;
260 rsp.remote_id = req->local_id;
261
262 hdev = hci_dev_get(req->remote_id);
263 if (!hdev || hdev->amp_type != HCI_AMP) {
264 rsp.status = A2MP_STATUS_INVALID_CTRL_ID;
265 goto send_rsp;
266 }
267
268 /* TODO process physlink create */
269
270 rsp.status = A2MP_STATUS_SUCCESS;
271
272send_rsp:
273 if (hdev)
274 hci_dev_put(hdev);
275
276 a2mp_send(mgr, A2MP_CREATEPHYSLINK_RSP, hdr->ident, sizeof(rsp),
277 &rsp);
278
279 skb_pull(skb, le16_to_cpu(hdr->len));
280 return 0;
281}
282
246/* Handle A2MP signalling */ 283/* Handle A2MP signalling */
247static int a2mp_chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb) 284static int a2mp_chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
248{ 285{
@@ -289,6 +326,9 @@ static int a2mp_chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
289 break; 326 break;
290 327
291 case A2MP_CREATEPHYSLINK_REQ: 328 case A2MP_CREATEPHYSLINK_REQ:
329 err = a2mp_createphyslink_req(mgr, skb, hdr);
330 break;
331
292 case A2MP_DISCONNPHYSLINK_REQ: 332 case A2MP_DISCONNPHYSLINK_REQ:
293 case A2MP_CHANGE_RSP: 333 case A2MP_CHANGE_RSP:
294 case A2MP_DISCOVER_RSP: 334 case A2MP_DISCOVER_RSP: