Skip to content

Commit 65f53e9

Browse files
holtmannjhedberg
authored andcommitted
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>
1 parent 755b82a commit 65f53e9

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

‎net/bluetooth/bnep/core.c‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <asm/unaligned.h>
3333

3434
#include <net/bluetooth/bluetooth.h>
35+
#include <net/bluetooth/l2cap.h>
3536
#include <net/bluetooth/hci_core.h>
3637

3738
#include "bnep.h"
@@ -510,20 +511,13 @@ static int bnep_session(void *arg)
510511

511512
static struct device *bnep_get_device(struct bnep_session *session)
512513
{
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;
516514
struct hci_conn *conn;
517515

518-
hdev = hci_get_route(dst, src);
519-
if (!hdev)
516+
conn = l2cap_pi(session->sock->sk)->chan->conn->hcon;
517+
if (!conn)
520518
return NULL;
521519

522-
conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
523-
524-
hci_dev_put(hdev);
525-
526-
return conn ? &conn->dev : NULL;
520+
return &conn->dev;
527521
}
528522

529523
static struct device_type bnep_type = {
@@ -539,8 +533,8 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
539533

540534
BT_DBG("");
541535

542-
baswap((void *) dst, &bt_sk(sock->sk)->dst);
543-
baswap((void *) src, &bt_sk(sock->sk)->src);
536+
baswap((void *) dst, &l2cap_pi(sock->sk)->chan->dst);
537+
baswap((void *) src, &l2cap_pi(sock->sk)->chan->src);
544538

545539
/* session struct allocated as private part of net_device */
546540
dev = alloc_netdev(sizeof(struct bnep_session),

0 commit comments

Comments
 (0)