From: Bobby Noelte <b0661n0e17e@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Bobby Noelte <b0661n0e17e@gmail.com>
Subject: [Patch BlueZ v2 0/1] Make network server interface handling more robust
Date: Mon, 19 Sep 2016 22:32:22 +0200 [thread overview]
Message-ID: <1474317143-7998-1-git-send-email-b0661n0e17e@gmail.com> (raw)
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
next reply other threads:[~2016-09-19 20:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-19 20:32 Bobby Noelte [this message]
2016-09-19 20:32 ` [Patch BlueZ v2 1/1] Make network server interface handling more robust Bobby Noelte
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=1474317143-7998-1-git-send-email-b0661n0e17e@gmail.com \
--to=b0661n0e17e@gmail.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 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).