Bluetooth: Store address information in L2CAP channel structure
With the effort of abstracting the L2CAP socket from the underlying L2CAP channel it is important to store the source and destination address information directly in the L2CAP channel structure. Direct access to the HCI connection address information is not possible since they might not be avaiable at L2CAP channel creation time. The address information will be updated when the underlying BR/EDR or LE connection status changes. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:

committed by
Johan Hedberg

parent
4637f7c0d0
commit
7eafc59e2f
@@ -112,7 +112,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
|
||||
break;
|
||||
}
|
||||
|
||||
bacpy(&bt_sk(sk)->src, &la.l2_bdaddr);
|
||||
bacpy(&chan->src, &la.l2_bdaddr);
|
||||
|
||||
chan->state = BT_BOUND;
|
||||
sk->sk_state = BT_BOUND;
|
||||
@@ -274,11 +274,11 @@ static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr,
|
||||
|
||||
if (peer) {
|
||||
la->l2_psm = chan->psm;
|
||||
bacpy(&la->l2_bdaddr, &bt_sk(sk)->dst);
|
||||
bacpy(&la->l2_bdaddr, &chan->dst);
|
||||
la->l2_cid = cpu_to_le16(chan->dcid);
|
||||
} else {
|
||||
la->l2_psm = chan->sport;
|
||||
bacpy(&la->l2_bdaddr, &bt_sk(sk)->src);
|
||||
bacpy(&la->l2_bdaddr, &chan->src);
|
||||
la->l2_cid = cpu_to_le16(chan->scid);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user