aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/bnep
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2013-10-13 12:49:57 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2013-10-13 13:00:35 -0400
commit65f53e9802dbfae0e5758a91793c3f5f8bece49b (patch)
tree8b74115025f59407caa7532a9a18249ce14e0d04 /net/bluetooth/bnep
parent755b82aa2fdb62a61990f6c132df150abd9e9206 (diff)
Bluetooth: Access BNEP session addresses through L2CAP channel
The L2CAP socket structure does not contain the address information anymore. They need to be accessed through the L2CAP channel. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/bnep')
-rw-r--r--net/bluetooth/bnep/core.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index e430b1abcd2f..a841d3e776c5 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -32,6 +32,7 @@
32#include <asm/unaligned.h> 32#include <asm/unaligned.h>
33 33
34#include <net/bluetooth/bluetooth.h> 34#include <net/bluetooth/bluetooth.h>
35#include <net/bluetooth/l2cap.h>
35#include <net/bluetooth/hci_core.h> 36#include <net/bluetooth/hci_core.h>
36 37
37#include "bnep.h" 38#include "bnep.h"
@@ -510,20 +511,13 @@ static int bnep_session(void *arg)
510 511
511static struct device *bnep_get_device(struct bnep_session *session) 512static struct device *bnep_get_device(struct bnep_session *session)
512{ 513{
513 bdaddr_t *src = &bt_sk(session->sock->sk)->src;
514 bdaddr_t *dst = &bt_sk(session->sock->sk)->dst;
515 struct hci_dev *hdev;
516 struct hci_conn *conn; 514 struct hci_conn *conn;
517 515
518 hdev = hci_get_route(dst, src); 516 conn = l2cap_pi(session->sock->sk)->chan->conn->hcon;
519 if (!hdev) 517 if (!conn)
520 return NULL; 518 return NULL;
521 519
522 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); 520 return &conn->dev;
523
524 hci_dev_put(hdev);
525
526 return conn ? &conn->dev : NULL;
527} 521}
528 522
529static struct device_type bnep_type = { 523static struct device_type bnep_type = {
@@ -539,8 +533,8 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
539 533
540 BT_DBG(""); 534 BT_DBG("");
541 535
542 baswap((void *) dst, &bt_sk(sock->sk)->dst); 536 baswap((void *) dst, &l2cap_pi(sock->sk)->chan->dst);
543 baswap((void *) src, &bt_sk(sock->sk)->src); 537 baswap((void *) src, &l2cap_pi(sock->sk)->chan->src);
544 538
545 /* session struct allocated as private part of net_device */ 539 /* session struct allocated as private part of net_device */
546 dev = alloc_netdev(sizeof(struct bnep_session), 540 dev = alloc_netdev(sizeof(struct bnep_session),