All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Alfonso Acosta <fons@spotify.com>
Cc: BlueZ development <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH v3] Bluetooth: Add HCI_AUTO_CONN_DIRECT_REPORT_IND
Date: Fri, 3 Oct 2014 11:55:43 +0200	[thread overview]
Message-ID: <35741970-1ED7-4A2B-8625-4F16186FA764@holtmann.org> (raw)
In-Reply-To: <CAHF=Y4r0Dx1b8vwWAwTWSNq+JD_1_622px4UG4FD1vsfS+BWiw@mail.gmail.com>

Hi Alfonso,

> As you guys suggested, including ADV_IND in the Device Connected event
> made the trick (for which I just submitted a patch).
> 
> Everything goes well if I disconnect when rebonding (using Unpair
> Device with Disconnect=0x01).
> 
> However, I am struggling to go one step further and rebond without
> disconnecting (using Unpair Device with Disconnect=0x00) before the
> security elevation happens. The sequence of "events" is exactly as
> Johan described:
> 
>> 1. mgmt_ev_device_connected (connected_callback() in adapter.c)
>> 2. Connection indication on ATT server socket (src/attrib-server.c)
>> 3. device_attach_attrib() called (due to step 2)
>> 4. bt_io_set(io, ..., BT_IO_SEC_MEDIUM, ...);
> 
> Now I can detect the need to rebond in (1), which gives me control
> over the next steps. However, since rebonding is asynchronous, I don't
> know a simple way to ensure it is done before the security elevation
> happens. My ideas so far:
> 
> * Stall (3) through synchronization primitives until the rebonding is
> done, which sounds horrible.
> * Cancel (3) and somehow force an ATT reconnection (2) once the
> rebonding is done, which in turn would cause another security
> elevation, but I don't know how (I am probably making wrong
> assumptions about how the ATT socket works).

what sounds most simple to me is that we allow for a way to suspend and later resume the trigger for doing service discovery. Attaching the attribute channel is fine, but then essentially tell it to stay put.

This all becomes tricky and we might need to have some redesign and cleanups to do to make this work cleanly. We also long term want to switch to the newly designed gatt-client.c that we are working on. So something to keep in mind.

However one thing has to present and that is our GATT server. So even if we stall everything else and even if we drop the keys and unpair, the GATT server needs to be operational. So we need to attach the ATT protocol to the ATT socket that we are getting from the kernel on every single connection.

Regards

Marcel


  reply	other threads:[~2014-10-03  9:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-26 15:54 [PATCH v3] Bluetooth: Add HCI_AUTO_CONN_DIRECT_REPORT_IND Alfonso Acosta
2014-09-29  8:37 ` Marcel Holtmann
2014-09-29 10:59   ` Alfonso Acosta
2014-09-29 11:34     ` Marcel Holtmann
2014-09-29 13:33       ` Alfonso Acosta
2014-09-29 14:29         ` Marcel Holtmann
2014-09-29 14:49           ` Alfonso Acosta
2014-09-29 14:54             ` Marcel Holtmann
2014-10-03  8:37             ` Alfonso Acosta
2014-10-03  9:55               ` Marcel Holtmann [this message]
2014-10-09  1:01                 ` Alfonso Acosta
2014-09-29 14:35         ` Johan Hedberg
2014-09-29 15:25           ` Alfonso Acosta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35741970-1ED7-4A2B-8625-4F16186FA764@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=fons@spotify.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.