* Re: [PATCH] Bluetooth: Update L2CAP socket source address from HCI connection
From: Johan Hedberg @ 2013-10-13 14:59 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381668997-1240-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Sun, Oct 13, 2013, Marcel Holtmann wrote:
> When having LE connections, the source address is not always the
> public address of the controller. So update the socket address
> based on the actual used source address of the HCI connection.
>
> This also remove the pointless source address pointer and adds
> a proper lock around the socket structure.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Fix coding style violations in SMP handling
From: Johan Hedberg @ 2013-10-13 14:58 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381668205-52698-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Sun, Oct 13, 2013, Marcel Holtmann wrote:
> The SMP source code has a few coding style violations. Fix them up
> all at once. No actual code has changed.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/smp.c | 35 +++++++++++++++++------------------
> 1 file changed, 17 insertions(+), 18 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 1/4] Bluetooth: Store source address of HCI connections
From: Johan Hedberg @ 2013-10-13 14:58 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381667042-46368-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Sun, Oct 13, 2013, Marcel Holtmann wrote:
> The source addressed was based on the public address of the HCI device,
> but with LE connections this not always the case. For example single
> mode LE-only controllers would use a static random address. And this
> address is configured by userspace.
>
> To not complicate the lookup of what kind of address is in use, store
> the correct source address for each HCI connection.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> include/net/bluetooth/hci_core.h | 1 +
> net/bluetooth/hci_conn.c | 7 +++++--
> 2 files changed, 6 insertions(+), 2 deletions(-)
All four patches in this set have been applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 1/2] Bluetooth: Remove pointless bdaddr_to_le() helper function
From: Johan Hedberg @ 2013-10-13 14:58 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381661859-32200-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Sun, Oct 13, 2013, Marcel Holtmann wrote:
> The bdaddr_to_le() function tries to convert the internal address
> type to one that matches the HCI address type for LE. It does not
> handle any address types not used by LE and in the end just make
> the code a lot harder to read.
>
> So instead of just hiding behind a magic function, just convert
> the internal address type where it needs to be converted. And it
> turns out that these are only two cases anyway. One when creating
> new LE connections and the other when loading the long term keys.
> In both cases this makes it more clear on what it going on.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> include/net/bluetooth/hci_core.h | 2 --
> net/bluetooth/hci_conn.c | 5 ++++-
> net/bluetooth/hci_core.c | 12 ------------
> net/bluetooth/mgmt.c | 10 +++++++---
> 4 files changed, 11 insertions(+), 18 deletions(-)
Both patches in this set have been applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 1/4] Bluetooth: Remove l2cap_conn->dst usage from AMP manager
From: Johan Hedberg @ 2013-10-13 14:57 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381656221-9821-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Sun, Oct 13, 2013, Marcel Holtmann wrote:
> The l2cap_conn->dst address is just a pointer into the hci_conn->dst
> structure. Use hci_conn->dst directly instead.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/a2mp.c | 3 ++-
> net/bluetooth/amp.c | 5 +++--
> 2 files changed, 5 insertions(+), 3 deletions(-)
All four patches in this set have been applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* [PATCH] Bluetooth: Update source address and type for incoming LE connections
From: Marcel Holtmann @ 2013-10-13 14:25 UTC (permalink / raw)
To: linux-bluetooth
The incoming LE connections do not have a proper source address and
address type set. The connection needs to be set with the same values
as used for advertising parameters.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/hci_event.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index bbe2d29..aa6fed3 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3477,6 +3477,17 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
conn->dst_type = ev->bdaddr_type;
+ /* The advertising parameters for own address type
+ * define which source address and source address
+ * type this connections has.
+ */
+ if (bacmp(&conn->src, BDADDR_ANY)) {
+ conn->src_type = ADDR_LE_DEV_PUBLIC;
+ } else {
+ bacpy(&conn->src, &hdev->static_addr);
+ conn->src_type = ADDR_LE_DEV_RANDOM;
+ }
+
if (ev->role == LE_CONN_ROLE_MASTER) {
conn->out = true;
conn->link_mode |= HCI_LM_MASTER;
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Update L2CAP socket source address from HCI connection
From: Marcel Holtmann @ 2013-10-13 12:56 UTC (permalink / raw)
To: linux-bluetooth
When having LE connections, the source address is not always the
public address of the controller. So update the socket address
based on the actual used source address of the HCI connection.
This also remove the pointless source address pointer and adds
a proper lock around the socket structure.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 3ed9a2b..062e28e 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1756,17 +1756,16 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
bdaddr_t *dst, u8 dst_type)
{
struct sock *sk = chan->sk;
- bdaddr_t *src = &bt_sk(sk)->src;
struct l2cap_conn *conn;
struct hci_conn *hcon;
struct hci_dev *hdev;
__u8 auth_type;
int err;
- BT_DBG("%pMR -> %pMR (type %u) psm 0x%2.2x", src, dst,
+ BT_DBG("%pMR -> %pMR (type %u) psm 0x%2.2x", &bt_sk(sk)->src, dst,
dst_type, __le16_to_cpu(psm));
- hdev = hci_get_route(dst, src);
+ hdev = hci_get_route(dst, &bt_sk(sk)->src);
if (!hdev)
return -EHOSTUNREACH;
@@ -1858,7 +1857,9 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
}
/* Update source addr of the socket */
- bacpy(src, &hdev->bdaddr);
+ lock_sock(sk);
+ bacpy(&bt_sk(sk)->src, &hcon->src);
+ release_sock(sk);
l2cap_chan_unlock(chan);
l2cap_chan_add(conn, chan);
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Fix coding style violations in SMP handling
From: Marcel Holtmann @ 2013-10-13 12:43 UTC (permalink / raw)
To: linux-bluetooth
The SMP source code has a few coding style violations. Fix them up
all at once. No actual code has changed.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/smp.c | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 112e581..463e50c 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -86,8 +86,8 @@ static int smp_e(struct crypto_blkcipher *tfm, const u8 *k, u8 *r)
}
static int smp_c1(struct crypto_blkcipher *tfm, u8 k[16], u8 r[16],
- u8 preq[7], u8 pres[7], u8 _iat, bdaddr_t *ia,
- u8 _rat, bdaddr_t *ra, u8 res[16])
+ u8 preq[7], u8 pres[7], u8 _iat, bdaddr_t *ia,
+ u8 _rat, bdaddr_t *ra, u8 res[16])
{
u8 p1[16], p2[16];
int err;
@@ -127,8 +127,8 @@ static int smp_c1(struct crypto_blkcipher *tfm, u8 k[16], u8 r[16],
return err;
}
-static int smp_s1(struct crypto_blkcipher *tfm, u8 k[16],
- u8 r1[16], u8 r2[16], u8 _r[16])
+static int smp_s1(struct crypto_blkcipher *tfm, u8 k[16], u8 r1[16],
+ u8 r2[16], u8 _r[16])
{
int err;
@@ -151,7 +151,7 @@ static int smp_rand(u8 *buf)
}
static struct sk_buff *smp_build_cmd(struct l2cap_conn *conn, u8 code,
- u16 dlen, void *data)
+ u16 dlen, void *data)
{
struct sk_buff *skb;
struct l2cap_hdr *lh;
@@ -214,9 +214,8 @@ static __u8 seclevel_to_authreq(__u8 sec_level)
}
static void build_pairing_cmd(struct l2cap_conn *conn,
- struct smp_cmd_pairing *req,
- struct smp_cmd_pairing *rsp,
- __u8 authreq)
+ struct smp_cmd_pairing *req,
+ struct smp_cmd_pairing *rsp, __u8 authreq)
{
u8 dist_keys = 0;
@@ -250,7 +249,7 @@ static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size)
struct smp_chan *smp = conn->smp_chan;
if ((max_key_size > SMP_MAX_ENC_KEY_SIZE) ||
- (max_key_size < SMP_MIN_ENC_KEY_SIZE))
+ (max_key_size < SMP_MIN_ENC_KEY_SIZE))
return SMP_ENC_KEY_SIZE;
smp->enc_key_size = max_key_size;
@@ -264,7 +263,7 @@ static void smp_failure(struct l2cap_conn *conn, u8 reason, u8 send)
if (send)
smp_send_cmd(conn, SMP_CMD_PAIRING_FAIL, sizeof(reason),
- &reason);
+ &reason);
clear_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags);
mgmt_auth_failed(hcon->hdev, &hcon->dst, hcon->type, hcon->dst_type,
@@ -310,8 +309,8 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
/* If either side has unknown io_caps, use JUST WORKS */
/* Otherwise, look up method from the table */
if (!(auth & SMP_AUTH_MITM) ||
- local_io > SMP_IO_KEYBOARD_DISPLAY ||
- remote_io > SMP_IO_KEYBOARD_DISPLAY)
+ local_io > SMP_IO_KEYBOARD_DISPLAY ||
+ remote_io > SMP_IO_KEYBOARD_DISPLAY)
method = JUST_WORKS;
else
method = gen_method[remote_io][local_io];
@@ -481,7 +480,7 @@ static void random_work(struct work_struct *work)
swap128(key, stk);
memset(stk + smp->enc_key_size, 0,
- SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size);
+ SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size);
hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
HCI_SMP_STK_SLAVE, 0, 0, stk, smp->enc_key_size,
@@ -498,7 +497,7 @@ static struct smp_chan *smp_chan_create(struct l2cap_conn *conn)
{
struct smp_chan *smp;
- smp = kzalloc(sizeof(struct smp_chan), GFP_ATOMIC);
+ smp = kzalloc(sizeof(*smp), GFP_ATOMIC);
if (!smp)
return NULL;
@@ -653,7 +652,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
memcpy(&smp->prsp[1], rsp, sizeof(*rsp));
if ((req->auth_req & SMP_AUTH_BONDING) &&
- (rsp->auth_req & SMP_AUTH_BONDING))
+ (rsp->auth_req & SMP_AUTH_BONDING))
auth = SMP_AUTH_BONDING;
auth |= (req->auth_req | rsp->auth_req) & SMP_AUTH_MITM;
@@ -688,7 +687,7 @@ static u8 smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb)
swap128(smp->prnd, random);
smp_send_cmd(conn, SMP_CMD_PAIRING_RANDOM, sizeof(random),
- random);
+ random);
} else if (test_bit(SMP_FLAG_TK_VALID, &smp->smp_flags)) {
queue_work(hdev->workqueue, &smp->confirm);
} else {
@@ -732,8 +731,8 @@ static u8 smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level)
hcon->enc_key_size = key->enc_size;
return 1;
-
}
+
static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
{
struct smp_cmd_security_req *rp = (void *) skb->data;
@@ -1014,7 +1013,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
bacpy(&addrinfo.bdaddr, &conn->hcon->src);
smp_send_cmd(conn, SMP_CMD_IDENT_ADDR_INFO, sizeof(addrinfo),
- &addrinfo);
+ &addrinfo);
*keydist &= ~SMP_DIST_ID_KEY;
}
--
1.8.3.1
^ permalink raw reply related
* [PATCH 4/4] Bluetooth: Fix input address type for SMP C1 function
From: Marcel Holtmann @ 2013-10-13 12:24 UTC (permalink / raw)
To: linux-bluetooth
The smp_c1() so far always assumed public addresses as input for its
operation. However it should provide actually the source address type
of the actual connection.
Finally the source address type is tracked in hci_conn->src_type and
so use that one as input.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/smp.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index f57b209..112e581 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -387,13 +387,13 @@ static void confirm_work(struct work_struct *work)
smp->tfm = tfm;
if (conn->hcon->out)
- ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp, 0,
- &conn->hcon->src, conn->hcon->dst_type,
- &conn->hcon->dst, res);
+ ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp,
+ conn->hcon->src_type, &conn->hcon->src,
+ conn->hcon->dst_type, &conn->hcon->dst, res);
else
ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp,
- conn->hcon->dst_type, &conn->hcon->dst, 0,
- &conn->hcon->src, res);
+ conn->hcon->dst_type, &conn->hcon->dst,
+ conn->hcon->src_type, &conn->hcon->src, res);
if (ret) {
reason = SMP_UNSPECIFIED;
goto error;
@@ -427,11 +427,13 @@ static void random_work(struct work_struct *work)
BT_DBG("conn %p %s", conn, conn->hcon->out ? "master" : "slave");
if (hcon->out)
- ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp, 0,
- &hcon->src, hcon->dst_type, &hcon->dst, res);
+ ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp,
+ hcon->src_type, &hcon->src,
+ hcon->dst_type, &hcon->dst, res);
else
ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp,
- hcon->dst_type, &hcon->dst, 0, &hcon->src, res);
+ hcon->dst_type, &hcon->dst,
+ hcon->src_type, &hcon->src, res);
if (ret) {
reason = SMP_UNSPECIFIED;
goto error;
--
1.8.3.1
^ permalink raw reply related
* [PATCH 3/4] Bluetooth: Use hci_conn->src address for L2CAP functions
From: Marcel Holtmann @ 2013-10-13 12:24 UTC (permalink / raw)
To: linux-bluetooth
The source address is now stored in hci_conn->src and so use that
one for L2CAP functions.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 41e2efe..3ed9a2b 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1381,8 +1381,7 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
/* Check if we have socket listening on cid */
pchan = l2cap_global_chan_by_scid(BT_LISTEN, L2CAP_CID_ATT,
- &conn->hcon->hdev->bdaddr,
- &conn->hcon->dst);
+ &conn->hcon->src, &conn->hcon->dst);
if (!pchan)
return;
@@ -1400,7 +1399,7 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
chan->dcid = L2CAP_CID_ATT;
- bacpy(&bt_sk(chan->sk)->src, &conn->hcon->hdev->bdaddr);
+ bacpy(&bt_sk(chan->sk)->src, &conn->hcon->src);
bacpy(&bt_sk(chan->sk)->dst, &conn->hcon->dst);
__l2cap_chan_add(conn, chan);
@@ -3759,8 +3758,7 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
BT_DBG("psm 0x%2.2x scid 0x%4.4x", __le16_to_cpu(psm), scid);
/* Check if we have socket listening on psm */
- pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm,
- &conn->hcon->hdev->bdaddr,
+ pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src,
&conn->hcon->dst);
if (!pchan) {
result = L2CAP_CR_BAD_PSM;
@@ -3799,7 +3797,7 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
*/
conn->hcon->disc_timeout = HCI_DISCONN_TIMEOUT;
- bacpy(&bt_sk(sk)->src, &conn->hcon->hdev->bdaddr);
+ bacpy(&bt_sk(sk)->src, &conn->hcon->src);
bacpy(&bt_sk(sk)->dst, &conn->hcon->dst);
chan->psm = psm;
chan->dcid = scid;
@@ -4923,7 +4921,7 @@ static inline int l2cap_move_channel_req(struct l2cap_conn *conn,
*/
if ((__chan_is_moving(chan) ||
chan->move_role != L2CAP_MOVE_ROLE_NONE) &&
- bacmp(&conn->hcon->hdev->bdaddr, &conn->hcon->dst) > 0) {
+ bacmp(&conn->hcon->src, &conn->hcon->dst) > 0) {
result = L2CAP_MR_COLLISION;
goto send_move_response;
}
@@ -6438,7 +6436,7 @@ static void l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm,
if (hcon->type != ACL_LINK)
goto drop;
- chan = l2cap_global_chan_by_psm(0, psm, &conn->hcon->hdev->bdaddr,
+ chan = l2cap_global_chan_by_psm(0, psm, &conn->hcon->src,
&conn->hcon->dst);
if (!chan)
goto drop;
@@ -6468,8 +6466,7 @@ static void l2cap_att_channel(struct l2cap_conn *conn,
goto drop;
chan = l2cap_global_chan_by_scid(BT_CONNECTED, L2CAP_CID_ATT,
- &conn->hcon->hdev->bdaddr,
- &conn->hcon->dst);
+ &conn->hcon->src, &conn->hcon->dst);
if (!chan)
goto drop;
--
1.8.3.1
^ permalink raw reply related
* [PATCH 2/4] Bluetooth: Use hci_conn->src address for SMP functions
From: Marcel Holtmann @ 2013-10-13 12:24 UTC (permalink / raw)
To: linux-bluetooth
The source address is now stored in hci_conn->src and so use that
one for SMP functions.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/smp.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 06a082ea..f57b209 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -388,12 +388,12 @@ static void confirm_work(struct work_struct *work)
if (conn->hcon->out)
ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp, 0,
- &conn->hcon->hdev->bdaddr, conn->hcon->dst_type,
+ &conn->hcon->src, conn->hcon->dst_type,
&conn->hcon->dst, res);
else
ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp,
conn->hcon->dst_type, &conn->hcon->dst, 0,
- &conn->hcon->hdev->bdaddr, res);
+ &conn->hcon->src, res);
if (ret) {
reason = SMP_UNSPECIFIED;
goto error;
@@ -428,12 +428,10 @@ static void random_work(struct work_struct *work)
if (hcon->out)
ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp, 0,
- &hcon->hdev->bdaddr, hcon->dst_type, &hcon->dst,
- res);
+ &hcon->src, hcon->dst_type, &hcon->dst, res);
else
ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp,
- hcon->dst_type, &hcon->dst, 0, &hcon->hdev->bdaddr,
- res);
+ hcon->dst_type, &hcon->dst, 0, &hcon->src, res);
if (ret) {
reason = SMP_UNSPECIFIED;
goto error;
@@ -1011,7 +1009,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
/* Just public address */
memset(&addrinfo, 0, sizeof(addrinfo));
- bacpy(&addrinfo.bdaddr, &conn->hcon->hdev->bdaddr);
+ bacpy(&addrinfo.bdaddr, &conn->hcon->src);
smp_send_cmd(conn, SMP_CMD_IDENT_ADDR_INFO, sizeof(addrinfo),
&addrinfo);
--
1.8.3.1
^ permalink raw reply related
* [PATCH 1/4] Bluetooth: Store source address of HCI connections
From: Marcel Holtmann @ 2013-10-13 12:23 UTC (permalink / raw)
To: linux-bluetooth
The source addressed was based on the public address of the HCI device,
but with LE connections this not always the case. For example single
mode LE-only controllers would use a static random address. And this
address is configured by userspace.
To not complicate the lookup of what kind of address is in use, store
the correct source address for each HCI connection.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
include/net/bluetooth/hci_core.h | 1 +
net/bluetooth/hci_conn.c | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 714da9e..0326b16 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -300,6 +300,7 @@ struct hci_conn {
bdaddr_t dst;
__u8 dst_type;
+ bdaddr_t src;
__u8 src_type;
__u16 handle;
__u16 state;
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index d9f7f93..ff04b05 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -381,6 +381,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
return NULL;
bacpy(&conn->dst, dst);
+ bacpy(&conn->src, &hdev->bdaddr);
conn->hdev = hdev;
conn->type = type;
conn->mode = HCI_CM_ACTIVE;
@@ -624,10 +625,12 @@ static struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
else
conn->dst_type = ADDR_LE_DEV_RANDOM;
- if (bacmp(&hdev->bdaddr, BDADDR_ANY))
+ if (bacmp(&conn->src, BDADDR_ANY)) {
conn->src_type = ADDR_LE_DEV_PUBLIC;
- else
+ } else {
+ bacpy(&conn->src, &hdev->static_addr);
conn->src_type = ADDR_LE_DEV_RANDOM;
+ }
conn->state = BT_CONNECT;
conn->out = true;
--
1.8.3.1
^ permalink raw reply related
* [PATCH 2/2] Bluetooth: Store the source address type of LE connections
From: Marcel Holtmann @ 2013-10-13 10:57 UTC (permalink / raw)
To: linux-bluetooth
When establishing LE connections, it is possible to use a public
address (if available) or a random address. The type of address
is only known when creating connections, so make sure it is
stored in hci_conn structure.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
include/net/bluetooth/hci_core.h | 1 +
net/bluetooth/hci_conn.c | 11 +++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7889495..714da9e 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -300,6 +300,7 @@ struct hci_conn {
bdaddr_t dst;
__u8 dst_type;
+ __u8 src_type;
__u16 handle;
__u16 state;
__u8 mode;
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index bb32f48..d9f7f93 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -566,10 +566,7 @@ static int hci_create_le_conn(struct hci_conn *conn)
cp.scan_window = cpu_to_le16(hdev->le_scan_window);
bacpy(&cp.peer_addr, &conn->dst);
cp.peer_addr_type = conn->dst_type;
- if (bacmp(&hdev->bdaddr, BDADDR_ANY))
- cp.own_address_type = ADDR_LE_DEV_PUBLIC;
- else
- cp.own_address_type = ADDR_LE_DEV_RANDOM;
+ cp.own_address_type = conn->src_type;
cp.conn_interval_min = __constant_cpu_to_le16(0x0028);
cp.conn_interval_max = __constant_cpu_to_le16(0x0038);
cp.supervision_timeout = __constant_cpu_to_le16(0x002a);
@@ -626,6 +623,12 @@ static struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
conn->dst_type = ADDR_LE_DEV_PUBLIC;
else
conn->dst_type = ADDR_LE_DEV_RANDOM;
+
+ if (bacmp(&hdev->bdaddr, BDADDR_ANY))
+ conn->src_type = ADDR_LE_DEV_PUBLIC;
+ else
+ conn->src_type = ADDR_LE_DEV_RANDOM;
+
conn->state = BT_CONNECT;
conn->out = true;
conn->link_mode |= HCI_LM_MASTER;
--
1.8.3.1
^ permalink raw reply related
* [PATCH 1/2] Bluetooth: Remove pointless bdaddr_to_le() helper function
From: Marcel Holtmann @ 2013-10-13 10:57 UTC (permalink / raw)
To: linux-bluetooth
The bdaddr_to_le() function tries to convert the internal address
type to one that matches the HCI address type for LE. It does not
handle any address types not used by LE and in the end just make
the code a lot harder to read.
So instead of just hiding behind a magic function, just convert
the internal address type where it needs to be converted. And it
turns out that these are only two cases anyway. One when creating
new LE connections and the other when loading the long term keys.
In both cases this makes it more clear on what it going on.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
include/net/bluetooth/hci_core.h | 2 --
net/bluetooth/hci_conn.c | 5 ++++-
net/bluetooth/hci_core.c | 12 ------------
net/bluetooth/mgmt.c | 10 +++++++---
4 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 6900454..7889495 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1187,8 +1187,6 @@ void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
__u8 ltk[16]);
-u8 bdaddr_to_le(u8 bdaddr_type);
-
#define SCO_AIRMODE_MASK 0x0003
#define SCO_AIRMODE_CVSD 0x0000
#define SCO_AIRMODE_TRANSP 0x0003
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index c52bfb7..bb32f48 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -622,7 +622,10 @@ static struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
if (!conn)
return ERR_PTR(-ENOMEM);
- conn->dst_type = bdaddr_to_le(dst_type);
+ if (dst_type == BDADDR_LE_PUBLIC)
+ conn->dst_type = ADDR_LE_DEV_PUBLIC;
+ else
+ conn->dst_type = ADDR_LE_DEV_RANDOM;
conn->state = BT_CONNECT;
conn->out = true;
conn->link_mode |= HCI_LM_MASTER;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 082f396..0e05ede 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3695,15 +3695,3 @@ static void hci_cmd_work(struct work_struct *work)
}
}
}
-
-u8 bdaddr_to_le(u8 bdaddr_type)
-{
- switch (bdaddr_type) {
- case BDADDR_LE_PUBLIC:
- return ADDR_LE_DEV_PUBLIC;
-
- default:
- /* Fallback to LE Random address type */
- return ADDR_LE_DEV_RANDOM;
- }
-}
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 338878c..020f95b 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3678,15 +3678,19 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
for (i = 0; i < key_count; i++) {
struct mgmt_ltk_info *key = &cp->keys[i];
- u8 type;
+ u8 type, addr_type;
+
+ if (key->addr.type == BDADDR_LE_PUBLIC)
+ addr_type = ADDR_LE_DEV_PUBLIC;
+ else
+ addr_type = ADDR_LE_DEV_RANDOM;
if (key->master)
type = HCI_SMP_LTK;
else
type = HCI_SMP_LTK_SLAVE;
- hci_add_ltk(hdev, &key->addr.bdaddr,
- bdaddr_to_le(key->addr.type),
+ hci_add_ltk(hdev, &key->addr.bdaddr, addr_type,
type, 0, key->authenticated, key->val,
key->enc_size, key->ediv, key->rand);
}
--
1.8.3.1
^ permalink raw reply related
* [PATCH 4/4] Bluetooth: Remove l2cap_conn->src and l2cap_conn->dst pointers
From: Marcel Holtmann @ 2013-10-13 9:23 UTC (permalink / raw)
To: linux-bluetooth
The l2cap_conn->src and l2cap_conn->dst pointers are no longer in use
and so just remove them.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
include/net/bluetooth/l2cap.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 56f540e..1a929af 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -559,9 +559,6 @@ struct l2cap_conn {
struct hci_conn *hcon;
struct hci_chan *hchan;
- bdaddr_t *dst;
- bdaddr_t *src;
-
unsigned int mtu;
__u32 feat_mask;
--
1.8.3.1
^ permalink raw reply related
* [PATCH 3/4] Bluetooth: Remove l2cap_conn->src and l2cap_conn->dst usage from L2CAP
From: Marcel Holtmann @ 2013-10-13 9:23 UTC (permalink / raw)
To: linux-bluetooth
The l2cap_conn->src and l2cap_conn->dst addresses are just a pointers
to hci_conn structure. Use hci_conn->hdev->bdaddr and hci_conn->dst
directly instead.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 13bb9da..41e2efe 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1381,7 +1381,8 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
/* Check if we have socket listening on cid */
pchan = l2cap_global_chan_by_scid(BT_LISTEN, L2CAP_CID_ATT,
- conn->src, conn->dst);
+ &conn->hcon->hdev->bdaddr,
+ &conn->hcon->dst);
if (!pchan)
return;
@@ -1399,8 +1400,8 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
chan->dcid = L2CAP_CID_ATT;
- bacpy(&bt_sk(chan->sk)->src, conn->src);
- bacpy(&bt_sk(chan->sk)->dst, conn->dst);
+ bacpy(&bt_sk(chan->sk)->src, &conn->hcon->hdev->bdaddr);
+ bacpy(&bt_sk(chan->sk)->dst, &conn->hcon->dst);
__l2cap_chan_add(conn, chan);
@@ -1665,9 +1666,6 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon)
break;
}
- conn->src = &hcon->hdev->bdaddr;
- conn->dst = &hcon->dst;
-
conn->feat_mask = 0;
if (hcon->type == ACL_LINK)
@@ -1861,7 +1859,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
}
/* Update source addr of the socket */
- bacpy(src, conn->src);
+ bacpy(src, &hdev->bdaddr);
l2cap_chan_unlock(chan);
l2cap_chan_add(conn, chan);
@@ -3761,7 +3759,9 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
BT_DBG("psm 0x%2.2x scid 0x%4.4x", __le16_to_cpu(psm), scid);
/* Check if we have socket listening on psm */
- pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, conn->src, conn->dst);
+ pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm,
+ &conn->hcon->hdev->bdaddr,
+ &conn->hcon->dst);
if (!pchan) {
result = L2CAP_CR_BAD_PSM;
goto sendresp;
@@ -3799,8 +3799,8 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
*/
conn->hcon->disc_timeout = HCI_DISCONN_TIMEOUT;
- bacpy(&bt_sk(sk)->src, conn->src);
- bacpy(&bt_sk(sk)->dst, conn->dst);
+ bacpy(&bt_sk(sk)->src, &conn->hcon->hdev->bdaddr);
+ bacpy(&bt_sk(sk)->dst, &conn->hcon->dst);
chan->psm = psm;
chan->dcid = scid;
chan->local_amp_id = amp_id;
@@ -4479,7 +4479,8 @@ static int l2cap_create_channel_req(struct l2cap_conn *conn,
struct amp_mgr *mgr = conn->hcon->amp_mgr;
struct hci_conn *hs_hcon;
- hs_hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, conn->dst);
+ hs_hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK,
+ &conn->hcon->dst);
if (!hs_hcon) {
hci_dev_put(hdev);
return -EBADSLT;
@@ -4922,7 +4923,7 @@ static inline int l2cap_move_channel_req(struct l2cap_conn *conn,
*/
if ((__chan_is_moving(chan) ||
chan->move_role != L2CAP_MOVE_ROLE_NONE) &&
- bacmp(conn->src, conn->dst) > 0) {
+ bacmp(&conn->hcon->hdev->bdaddr, &conn->hcon->dst) > 0) {
result = L2CAP_MR_COLLISION;
goto send_move_response;
}
@@ -6437,7 +6438,8 @@ static void l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm,
if (hcon->type != ACL_LINK)
goto drop;
- chan = l2cap_global_chan_by_psm(0, psm, conn->src, conn->dst);
+ chan = l2cap_global_chan_by_psm(0, psm, &conn->hcon->hdev->bdaddr,
+ &conn->hcon->dst);
if (!chan)
goto drop;
@@ -6466,7 +6468,8 @@ static void l2cap_att_channel(struct l2cap_conn *conn,
goto drop;
chan = l2cap_global_chan_by_scid(BT_CONNECTED, L2CAP_CID_ATT,
- conn->src, conn->dst);
+ &conn->hcon->hdev->bdaddr,
+ &conn->hcon->dst);
if (!chan)
goto drop;
--
1.8.3.1
^ permalink raw reply related
* [PATCH 2/4] Bluetooth: Remove l2cap_conn->src and l2cap_conn->dst usage from SMP
From: Marcel Holtmann @ 2013-10-13 9:23 UTC (permalink / raw)
To: linux-bluetooth
The l2cap_conn->src and l2cap_conn->dst addresses are just a pointer
to hci_conn->hdev->bdaddr and hci_conn->dst structures. Use the data
provided by hci_conn directly. This is done for hci_conn->dst_type
already anyway and with this change it makes it a lot clearer were
the address information comes from.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/smp.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 9272094..06a082ea 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -266,13 +266,13 @@ static void smp_failure(struct l2cap_conn *conn, u8 reason, u8 send)
smp_send_cmd(conn, SMP_CMD_PAIRING_FAIL, sizeof(reason),
&reason);
- clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->flags);
- mgmt_auth_failed(conn->hcon->hdev, conn->dst, hcon->type,
- hcon->dst_type, HCI_ERROR_AUTH_FAILURE);
+ clear_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags);
+ mgmt_auth_failed(hcon->hdev, &hcon->dst, hcon->type, hcon->dst_type,
+ HCI_ERROR_AUTH_FAILURE);
cancel_delayed_work_sync(&conn->security_timer);
- if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags))
+ if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags))
smp_chan_destroy(conn);
}
@@ -355,10 +355,10 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
hci_dev_lock(hcon->hdev);
if (method == REQ_PASSKEY)
- ret = mgmt_user_passkey_request(hcon->hdev, conn->dst,
+ ret = mgmt_user_passkey_request(hcon->hdev, &hcon->dst,
hcon->type, hcon->dst_type);
else
- ret = mgmt_user_confirm_request(hcon->hdev, conn->dst,
+ ret = mgmt_user_confirm_request(hcon->hdev, &hcon->dst,
hcon->type, hcon->dst_type,
cpu_to_le32(passkey), 0);
@@ -388,11 +388,12 @@ static void confirm_work(struct work_struct *work)
if (conn->hcon->out)
ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp, 0,
- conn->src, conn->hcon->dst_type, conn->dst, res);
+ &conn->hcon->hdev->bdaddr, conn->hcon->dst_type,
+ &conn->hcon->dst, res);
else
ret = smp_c1(tfm, smp->tk, smp->prnd, smp->preq, smp->prsp,
- conn->hcon->dst_type, conn->dst, 0, conn->src,
- res);
+ conn->hcon->dst_type, &conn->hcon->dst, 0,
+ &conn->hcon->hdev->bdaddr, res);
if (ret) {
reason = SMP_UNSPECIFIED;
goto error;
@@ -427,10 +428,12 @@ static void random_work(struct work_struct *work)
if (hcon->out)
ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp, 0,
- conn->src, hcon->dst_type, conn->dst, res);
+ &hcon->hdev->bdaddr, hcon->dst_type, &hcon->dst,
+ res);
else
ret = smp_c1(tfm, smp->tk, smp->rrnd, smp->preq, smp->prsp,
- hcon->dst_type, conn->dst, 0, conn->src, res);
+ hcon->dst_type, &hcon->dst, 0, &hcon->hdev->bdaddr,
+ res);
if (ret) {
reason = SMP_UNSPECIFIED;
goto error;
@@ -480,7 +483,7 @@ static void random_work(struct work_struct *work)
memset(stk + smp->enc_key_size, 0,
SMP_MAX_ENC_KEY_SIZE - smp->enc_key_size);
- hci_add_ltk(hcon->hdev, conn->dst, hcon->dst_type,
+ hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
HCI_SMP_STK_SLAVE, 0, 0, stk, smp->enc_key_size,
ediv, rand);
}
@@ -715,7 +718,7 @@ static u8 smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level)
struct smp_ltk *key;
struct hci_conn *hcon = conn->hcon;
- key = hci_find_ltk_by_addr(hcon->hdev, conn->dst, hcon->dst_type);
+ key = hci_find_ltk_by_addr(hcon->hdev, &hcon->dst, hcon->dst_type);
if (!key)
return 0;
@@ -836,9 +839,9 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
skb_pull(skb, sizeof(*rp));
hci_dev_lock(hdev);
- authenticated = (conn->hcon->sec_level == BT_SECURITY_HIGH);
- hci_add_ltk(conn->hcon->hdev, conn->dst, hcon->dst_type,
- HCI_SMP_LTK, 1, authenticated, smp->tk, smp->enc_key_size,
+ authenticated = (hcon->sec_level == BT_SECURITY_HIGH);
+ hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, HCI_SMP_LTK, 1,
+ authenticated, smp->tk, smp->enc_key_size,
rp->ediv, rp->rand);
smp_distribute_keys(conn, 1);
hci_dev_unlock(hdev);
@@ -986,7 +989,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
smp_send_cmd(conn, SMP_CMD_ENCRYPT_INFO, sizeof(enc), &enc);
authenticated = hcon->sec_level == BT_SECURITY_HIGH;
- hci_add_ltk(conn->hcon->hdev, conn->dst, hcon->dst_type,
+ hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
HCI_SMP_LTK_SLAVE, 1, authenticated,
enc.ltk, smp->enc_key_size, ediv, ident.rand);
@@ -1008,7 +1011,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
/* Just public address */
memset(&addrinfo, 0, sizeof(addrinfo));
- bacpy(&addrinfo.bdaddr, conn->src);
+ bacpy(&addrinfo.bdaddr, &conn->hcon->hdev->bdaddr);
smp_send_cmd(conn, SMP_CMD_IDENT_ADDR_INFO, sizeof(addrinfo),
&addrinfo);
--
1.8.3.1
^ permalink raw reply related
* [PATCH 1/4] Bluetooth: Remove l2cap_conn->dst usage from AMP manager
From: Marcel Holtmann @ 2013-10-13 9:23 UTC (permalink / raw)
To: linux-bluetooth
The l2cap_conn->dst address is just a pointer into the hci_conn->dst
structure. Use hci_conn->dst directly instead.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/a2mp.c | 3 ++-
net/bluetooth/amp.c | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 7e25be3..60ca528 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -537,7 +537,8 @@ static int a2mp_discphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
goto send_rsp;
}
- hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, mgr->l2cap_conn->dst);
+ hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK,
+ &mgr->l2cap_conn->hcon->dst);
if (!hcon) {
BT_ERR("No phys link exist");
rsp.status = A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS;
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 5497ed3..bb39509 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -111,7 +111,7 @@ static u8 __next_handle(struct amp_mgr *mgr)
struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
u8 remote_id, bool out)
{
- bdaddr_t *dst = mgr->l2cap_conn->dst;
+ bdaddr_t *dst = &mgr->l2cap_conn->hcon->dst;
struct hci_conn *hcon;
hcon = hci_conn_add(hdev, AMP_LINK, dst);
@@ -410,7 +410,8 @@ void amp_create_logical_link(struct l2cap_chan *chan)
struct hci_cp_create_accept_logical_link cp;
struct hci_dev *hdev;
- BT_DBG("chan %p hs_hcon %p dst %pMR", chan, hs_hcon, chan->conn->dst);
+ BT_DBG("chan %p hs_hcon %p dst %pMR", chan, hs_hcon,
+ &chan->conn->hcon->dst);
if (!hs_hcon)
return;
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Allow using obexd without systemd in the user session
From: Bastien Nocera @ 2013-10-12 16:25 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Giovanni Campagna, linux-bluetooth, Giovanni Campagna
In-Reply-To: <0262656B-5656-422C-B12D-C6BF7239AA11@holtmann.org>
On Sat, 2013-10-12 at 18:08 +0200, Marcel Holtmann wrote:
> Hi Giovanni,
<snip>
> that is something your distro specific package should be fixing if
> that is needed. The focus is on integration with systemd and nothing
> else. You can use --disable-systemd and provide your own set of D-Bus
> service files.
There aren't any distributions that ship systemd for user sessions
though.
^ permalink raw reply
* Re: [PATCH] Allow using obexd without systemd in the user session
From: Giovanni Campagna @ 2013-10-12 16:18 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <0262656B-5656-422C-B12D-C6BF7239AA11@holtmann.org>
2013/10/12 Marcel Holtmann <marcel@holtmann.org>:
> Hi Giovanni,
>
> [...]
>
> that is something your distro specific package should be fixing if that is needed. The focus is on integration with systemd and nothing else. You can use --disable-systemd and provide your own set of D-Bus service files.
I don't think shipping with upstream packages that require distro
patches in common configurations is a good idea (it breaks jhbuild
setups, for example), but ok, I filed
https://bugzilla.redhat.com/show_bug.cgi?id=1018496
Thanks for the quick answer,
Giovanni
^ permalink raw reply
* Re: [PATCH] Allow using obexd without systemd in the user session
From: Marcel Holtmann @ 2013-10-12 16:08 UTC (permalink / raw)
To: Giovanni Campagna; +Cc: linux-bluetooth, Giovanni Campagna
In-Reply-To: <1381592725-28212-1-git-send-email-scampa.giovanni@gmail.com>
Hi Giovanni,
> Not all sessions run systemd --user (actually, the majority
> doesn't), so the dbus daemon must be able to spawn obexd
> directly, and to do so it needs the full path of the daemon.
> ---
> Makefile.obexd | 4 ++--
> obexd/src/org.bluez.obex.service | 4 ----
> obexd/src/org.bluez.obex.service.in | 4 ++++
> 3 files changed, 6 insertions(+), 6 deletions(-)
> delete mode 100644 obexd/src/org.bluez.obex.service
> create mode 100644 obexd/src/org.bluez.obex.service.in
>
> diff --git a/Makefile.obexd b/Makefile.obexd
> index d5377cb..751e0e5 100644
> --- a/Makefile.obexd
> +++ b/Makefile.obexd
> @@ -2,12 +2,12 @@
> if SYSTEMD
> systemduserunitdir = @SYSTEMD_USERUNITDIR@
> systemduserunit_DATA = obexd/src/obex.service
> +endif
>
> dbussessionbusdir = @DBUS_SESSIONBUSDIR@
> dbussessionbus_DATA = obexd/src/org.bluez.obex.service
> -endif
>
> -EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service
> +EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in
>
> obex_plugindir = $(libdir)/obex/plugins
>
> diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service
> deleted file mode 100644
> index a538088..0000000
> --- a/obexd/src/org.bluez.obex.service
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -[D-BUS Service]
> -Name=org.bluez.obex
> -Exec=/bin/false
> -SystemdService=dbus-org.bluez.obex.service
> diff --git a/obexd/src/org.bluez.obex.service.in b/obexd/src/org.bluez.obex.service.in
> new file mode 100644
> index 0000000..9c815f2
> --- /dev/null
> +++ b/obexd/src/org.bluez.obex.service.in
> @@ -0,0 +1,4 @@
> +[D-BUS Service]
> +Name=org.bluez.obex
> +Exec=@libexecdir@/obexd
> +SystemdService=dbus-org.bluez.obex.service
that is something your distro specific package should be fixing if that is needed. The focus is on integration with systemd and nothing else. You can use --disable-systemd and provide your own set of D-Bus service files.
Regards
Marcel
^ permalink raw reply
* [PATCH] Allow using obexd without systemd in the user session
From: Giovanni Campagna @ 2013-10-12 15:45 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Giovanni Campagna
From: Giovanni Campagna <gcampagna@src.gnome.org>
Not all sessions run systemd --user (actually, the majority
doesn't), so the dbus daemon must be able to spawn obexd
directly, and to do so it needs the full path of the daemon.
---
Makefile.obexd | 4 ++--
obexd/src/org.bluez.obex.service | 4 ----
obexd/src/org.bluez.obex.service.in | 4 ++++
3 files changed, 6 insertions(+), 6 deletions(-)
delete mode 100644 obexd/src/org.bluez.obex.service
create mode 100644 obexd/src/org.bluez.obex.service.in
diff --git a/Makefile.obexd b/Makefile.obexd
index d5377cb..751e0e5 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -2,12 +2,12 @@
if SYSTEMD
systemduserunitdir = @SYSTEMD_USERUNITDIR@
systemduserunit_DATA = obexd/src/obex.service
+endif
dbussessionbusdir = @DBUS_SESSIONBUSDIR@
dbussessionbus_DATA = obexd/src/org.bluez.obex.service
-endif
-EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service
+EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in
obex_plugindir = $(libdir)/obex/plugins
diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service
deleted file mode 100644
index a538088..0000000
--- a/obexd/src/org.bluez.obex.service
+++ /dev/null
@@ -1,4 +0,0 @@
-[D-BUS Service]
-Name=org.bluez.obex
-Exec=/bin/false
-SystemdService=dbus-org.bluez.obex.service
diff --git a/obexd/src/org.bluez.obex.service.in b/obexd/src/org.bluez.obex.service.in
new file mode 100644
index 0000000..9c815f2
--- /dev/null
+++ b/obexd/src/org.bluez.obex.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.bluez.obex
+Exec=@libexecdir@/obexd
+SystemdService=dbus-org.bluez.obex.service
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH 2/2] Bluetooth: Unicast connectionless data reception is supported
From: Johan Hedberg @ 2013-10-12 15:32 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381591099-13207-2-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Sat, Oct 12, 2013, Marcel Holtmann wrote:
> The unicast connectionless data reception feature is actually support
> and has been supported all along. Mark it as supported in the L2CAP
> features bitmask.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 1/2] Bluetooth: The L2CAP fixed channel connectionless data is supported
From: Johan Hedberg @ 2013-10-12 15:32 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1381591099-13207-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Sat, Oct 12, 2013, Marcel Holtmann wrote:
> The implementation actually supports the L2CAP connectionless data
> channel. So set it as supported in the fixed channels bitmask.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> include/net/bluetooth/l2cap.h | 1 +
> net/bluetooth/l2cap_core.c | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* [PATCH 2/2] Bluetooth: Unicast connectionless data reception is supported
From: Marcel Holtmann @ 2013-10-12 15:18 UTC (permalink / raw)
To: linux-bluetooth
The unicast connectionless data reception feature is actually support
and has been supported all along. Mark it as supported in the L2CAP
features bitmask.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 8b5437c..13bb9da 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -43,7 +43,7 @@
bool disable_ertm;
-static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN;
+static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN | L2CAP_FEAT_UCD;
static u8 l2cap_fixed_chan[8] = { L2CAP_FC_L2CAP | L2CAP_FC_CONNLESS, };
static LIST_HEAD(chan_list);
--
1.8.3.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox