aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-05-14 06:23:13 -0400
committerMarcel Holtmann <marcel@holtmann.org>2013-12-05 10:05:32 -0500
commitbf20fd4ec1d39df78e31fd7c7a4066f69b8bcd8a (patch)
treeee0a5ae44cc31690c3542935f1aeaf38ee68eeca /net
parent9149761ad74f618371b58fd37141d4c3706d88fc (diff)
Bluetooth: Update l2cap_global_chan_by_psm() to take a link type
Once connection oriented L2CAP channels become possible for LE we need to be able to specify the link type we're interested in when looking up L2CAP channels. Therefore, add a link_type parameter to the l2cap_global_chan_by_psm() function which gets compared to the address type associated with each l2cap_chan. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/l2cap_core.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 70be2eb8ed03..03b641c2f39d 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1703,7 +1703,8 @@ EXPORT_SYMBOL(l2cap_conn_put);
1703 */ 1703 */
1704static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm, 1704static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm,
1705 bdaddr_t *src, 1705 bdaddr_t *src,
1706 bdaddr_t *dst) 1706 bdaddr_t *dst,
1707 u8 link_type)
1707{ 1708{
1708 struct l2cap_chan *c, *c1 = NULL; 1709 struct l2cap_chan *c, *c1 = NULL;
1709 1710
@@ -1713,6 +1714,12 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm,
1713 if (state && c->state != state) 1714 if (state && c->state != state)
1714 continue; 1715 continue;
1715 1716
1717 if (link_type == ACL_LINK && c->src_type != BDADDR_BREDR)
1718 continue;
1719
1720 if (link_type == LE_LINK && c->src_type == BDADDR_BREDR)
1721 continue;
1722
1716 if (c->psm == psm) { 1723 if (c->psm == psm) {
1717 int src_match, dst_match; 1724 int src_match, dst_match;
1718 int src_any, dst_any; 1725 int src_any, dst_any;
@@ -3713,7 +3720,7 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
3713 3720
3714 /* Check if we have socket listening on psm */ 3721 /* Check if we have socket listening on psm */
3715 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, 3722 pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src,
3716 &conn->hcon->dst); 3723 &conn->hcon->dst, ACL_LINK);
3717 if (!pchan) { 3724 if (!pchan) {
3718 result = L2CAP_CR_BAD_PSM; 3725 result = L2CAP_CR_BAD_PSM;
3719 goto sendresp; 3726 goto sendresp;
@@ -6380,7 +6387,8 @@ static void l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm,
6380 if (hcon->type != ACL_LINK) 6387 if (hcon->type != ACL_LINK)
6381 goto drop; 6388 goto drop;
6382 6389
6383 chan = l2cap_global_chan_by_psm(0, psm, &hcon->src, &hcon->dst); 6390 chan = l2cap_global_chan_by_psm(0, psm, &hcon->src, &hcon->dst,
6391 ACL_LINK);
6384 if (!chan) 6392 if (!chan)
6385 goto drop; 6393 goto drop;
6386 6394