linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch BlueZ v2 0/1] Make network server interface handling more robust
@ 2016-09-19 20:32 Bobby Noelte
  2016-09-19 20:32 ` [Patch BlueZ v2 1/1] " Bobby Noelte
  0 siblings, 1 reply; 2+ messages in thread
From: Bobby Noelte @ 2016-09-19 20:32 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bobby Noelte

Hi,

Changes since - (v1):
  * Replaced sleep() by sched_yield() 
    on comment from Luiz Augusto von Dentz:
    "sleep is no acceptable in the daemon code, it should never block in
     any circumstances"
    sched_yield only used in error pathes.
  * Removed DBG statements from critical race pathes.

Tested and no connection errors due to interface creation realized so far.
Retries are still necessary.

- (v1):

I encountered a lot problems connecting to a NAP server running on
Ubuntu 16.04 x86_64. Systemd-udev was renaming the bnepx interfaces
before network server could bring up the interface. Network server
went on to use the original interface name and failed on the creation
of the interface. This did not happen always but quite often.

The obvious solution was to prevent udev from renaming. But I could
not make that work. Also, IMHO, it is the task of bluetoothd to cope
with this situation because systemd-udev is now pretty common.

The choosen solution is to use the interface index where possible.
It does not change on rename. The kernel does not provide the ifindex
on BNEPCONNADD, but the interface name. So there is still a race
condition when retrieving the ifindex. Also there are race conditions
when using an interface name that was retrieved by interface index;
which is necessary for if up/down. To cope with these potential
races retry cycles are added.

The patched version of bluetoothd was tested using a SAMSUNG S2
(Android 4.1.2) and a NVIDIA Shield (Android 5.1.1). No connection
errors due to interface creation were realized so far. The
retries are necessary though.

The patch is 'minimal invasive'. Only the file bnep.c is changed.
Only static local function interfaces of bnep.c are changed/ added.
The patch also adds documentation to the static local functions
that are substantially changed or added. make check is passed.

Comments, suggestions appreciated.
Thanks,

Bobby

Bobby Noelte (1):
  Make network server interface handling more robust

 profiles/network/bnep.c | 317 ++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 265 insertions(+), 52 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-19 20:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-19 20:32 [Patch BlueZ v2 0/1] Make network server interface handling more robust Bobby Noelte
2016-09-19 20:32 ` [Patch BlueZ v2 1/1] " Bobby Noelte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).