Discussion:
Bluetooth PAN daemon
(too old to reply)
Iain Hibbert
2008-08-13 15:17:15 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

Finally I wrote a Bluetooth PAN daemon for NetBSD, it opens a tap(4)
interface and can handle all roles:

NAP Network Access Point is like an ethernet bridge

GN Group ad-hoc Network is a NAP with no external network

PANU Personal Area Networking User in both host (like GN but
a single connection) and client (the device that connects
to all the others) mode.

source at:

http://www.netbsd.org/~plunky/btpand-20080812.tar.gz

any comments, suggestions or test results welcome (I'm fiddling with
details at the moment but the core is finished)

It should work on any NetBSD4+ system, the only thing is that the
/usr/sbin/sdpd and <sdp.h> function should be up to date in order to
register GN or PANU services (I added some padding recently so that
nap/gn/panu structure are the same size)

I only tested PANU (netbsd) -> NAP (windows mobile 6) so far, it performs
better than PPP (solid 6Kb/s against 2-5Kb/s using ppp to DUN service. I
blame the phone for that though :)

Also, is this something we want in NetBSD base system (it is written for
NetBSD), or should I go the pkgsrc route (it could be adapted without too
much trouble for other BSD systems)?

iain
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (NetBSD)

iQEcBAEBAgAGBQJIovr7AAoJEPFJxoMWDXVDoekH/03lJEsWfIKIrkaGC3+Bt+lS
2Mv2LpciYIc5JSFeE12YkHk+zyaRkWzx07+WRb7S/pEYD5qILfeU/SKpNy9Ymfn2
eYaym7nAdd0fplEjFsBO89rejokpVJTksqLY07llo0pTrXnA2QMojPeBprBwfO6i
xSaFB5C1u1BzjhRMgiWEgUASpYffXzlxXV+0mqByuTOH6YiktBW3qaEpiDy7Wowe
KmLWlTWLHNHGYydNmFXK/CSDAX/PHI4MAY8LlE/4DdCoUpSD2eMN/go7cH9MC0/Y
mQKWixf+dGAf5K0NNvSHNmkHDZhLV47I2oW86KBfVJK9brjCKvZqJ/zF9RYPpr0=
=jqkJ
-----END PGP SIGNATURE-----

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
David Brownlee
2008-08-13 16:34:16 UTC
Permalink
Post by Iain Hibbert
Hi,
Finally I wrote a Bluetooth PAN daemon for NetBSD, it opens a tap(4)
NAP Network Access Point is like an ethernet bridge
GN Group ad-hoc Network is a NAP with no external network
PANU Personal Area Networking User in both host (like GN but
a single connection) and client (the device that connects
to all the others) mode.
http://www.netbsd.org/~plunky/btpand-20080812.tar.gz
any comments, suggestions or test results welcome (I'm fiddling with
details at the moment but the core is finished)
It should work on any NetBSD4+ system, the only thing is that the
/usr/sbin/sdpd and <sdp.h> function should be up to date in order to
register GN or PANU services (I added some padding recently so that
nap/gn/panu structure are the same size)
I only tested PANU (netbsd) -> NAP (windows mobile 6) so far, it performs
better than PPP (solid 6Kb/s against 2-5Kb/s using ppp to DUN service. I
blame the phone for that though :)
Also, is this something we want in NetBSD base system (it is written for
NetBSD), or should I go the pkgsrc route (it could be adapted without too
much trouble for other BSD systems)?
I'd love to see this in the base system. Having a quick
play with NetBSD 4.0 and it looks like btpand.h needs to
include sys/types.h before net/if.h to get the definition
of u_long and server.c needs sys/time.h before event.h for
timeval.

Would it make sense to ask for an sdp.h & usr.sbin/sdpd
pullup into netbsd-4 ?
--
David/absolute -- www.NetBSD.org: No hype required --

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Iain Hibbert
2008-08-13 19:15:44 UTC
Permalink
Post by David Brownlee
I'd love to see this in the base system. Having a quick
play with NetBSD 4.0 and it looks like btpand.h needs to
include sys/types.h before net/if.h to get the definition
of u_long and server.c needs sys/time.h before event.h for
timeval.
ok added
Post by David Brownlee
Would it make sense to ask for an sdp.h & usr.sbin/sdpd
pullup into netbsd-4 ?
Perhaps - I'm not sure of the timeframe for 4.1 but if I get this in for
5.0 I'll request a pullup for btpand too.

iain

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Iain Hibbert
2008-08-17 14:11:47 UTC
Permalink
Post by David Brownlee
I'd love to see this in the base system.
I've cleared it with core and imported an updated version just now.
Post by David Brownlee
Would it make sense to ask for an sdp.h & usr.sbin/sdpd
pullup into netbsd-4 ?
I've done that also, will leave the btpand to mature for a bit* before
seeing about 4.0.

iain
(* I'm going to be away for a couple of weeks in any case)

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Hubert Feyrer
2008-08-17 15:57:40 UTC
Permalink
Post by Iain Hibbert
Post by David Brownlee
I'd love to see this in the base system.
I've cleared it with core and imported an updated version just now.
Post by David Brownlee
Would it make sense to ask for an sdp.h & usr.sbin/sdpd
pullup into netbsd-4 ?
I've done that also, will leave the btpand to mature for a bit* before
seeing about 4.0.
Maybe add something to the Bluetooth chapter in the Guide
(http://www.netbsd.org/docs/guide/en/chap-bluetooth.html).


- Hubert

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Iain Hibbert
2008-08-17 21:19:24 UTC
Permalink
Post by Hubert Feyrer
Post by Iain Hibbert
Post by David Brownlee
I'd love to see this in the base system.
I've cleared it with core and imported an updated version just now.
Post by David Brownlee
Would it make sense to ask for an sdp.h & usr.sbin/sdpd
pullup into netbsd-4 ?
I've done that also, will leave the btpand to mature for a bit* before
seeing about 4.0.
Maybe add something to the Bluetooth chapter in the Guide
(http://www.netbsd.org/docs/guide/en/chap-bluetooth.html).
Ok, I have added a "Personal Area Networking" section with an example of a
PANU client. I'll continue to work on a NAP (or GN) section as I work out
how best to do that, but if anybody wants to do that in the meantime,
it is basically:

ifconfig tap0 create
ifconfig bridge0 create
brconfig bridge0 add tap0 add eth0 up
btpand -d ubt0 -s NAP -i tap0

btpand needs to be run after sdpd in the boot sequence, so I'll have to
make an rc.d script for it rather than use the ifconfig.tap0 file.

iain

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Maksim Yevmenkin
2008-08-13 16:39:49 UTC
Permalink
Hi Iain,
Post by Iain Hibbert
Finally I wrote a Bluetooth PAN daemon for NetBSD, it opens a tap(4)
NAP Network Access Point is like an ethernet bridge
GN Group ad-hoc Network is a NAP with no external network
PANU Personal Area Networking User in both host (like GN but
a single connection) and client (the device that connects
to all the others) mode.
http://www.netbsd.org/~plunky/btpand-20080812.tar.gz
any comments, suggestions or test results welcome (I'm fiddling with
details at the moment but the core is finished)
It should work on any NetBSD4+ system, the only thing is that the
/usr/sbin/sdpd and <sdp.h> function should be up to date in order to
register GN or PANU services (I added some padding recently so that
nap/gn/panu structure are the same size)
I only tested PANU (netbsd) -> NAP (windows mobile 6) so far, it performs
better than PPP (solid 6Kb/s against 2-5Kb/s using ppp to DUN service. I
blame the phone for that though :)
Also, is this something we want in NetBSD base system (it is written for
NetBSD), or should I go the pkgsrc route (it could be adapted without too
much trouble for other BSD systems)?
i think its great stuff. just started to look at it. with your
permission, i'd like to import this into freebsd base.

any particular reason for using libevent? its not in freebsd base, so
i would have to hack it.

thanks,
max

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Iain Hibbert
2008-08-13 19:13:12 UTC
Permalink
Post by Maksim Yevmenkin
Hi Iain,
i think its great stuff. just started to look at it. with your
permission, i'd like to import this into freebsd base.
Of course, no permission needed.
Post by Maksim Yevmenkin
any particular reason for using libevent? its not in freebsd base, so
i would have to hack it.
only that I like libevent, it makes it easier to handle a bunch of
disparate events.

iain

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Maksim Yevmenkin
2008-08-13 19:37:44 UTC
Permalink
Post by Iain Hibbert
Post by Maksim Yevmenkin
Hi Iain,
i think its great stuff. just started to look at it. with your
permission, i'd like to import this into freebsd base.
Of course, no permission needed.
cool, thanks!
Post by Iain Hibbert
Post by Maksim Yevmenkin
any particular reason for using libevent? its not in freebsd base, so
i would have to hack it.
only that I like libevent, it makes it easier to handle a bunch of
disparate events.
ok, for now i will install it from the ports and try to make it work.

btw, i will import your handy bdaddr_xxx utility functions and i also
need to import stuff from libc/uuid/uuid_stream.c into freebsd :)

thanks,
max

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Iain Hibbert
2008-11-09 15:35:07 UTC
Permalink
Post by Maksim Yevmenkin
ok, for now i will install it from the ports and try to make it work.
Hi Max, just out of interest .. did you get that btpand working?

(Some guy was asking about it for OpenBSD but they don't have a tap(4)
device)

iain

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Quentin Garnier
2008-11-09 18:45:56 UTC
Permalink
On Sun, Nov 09, 2008 at 03:35:07PM +0000, Iain Hibbert wrote:
[...]
Post by Iain Hibbert
(Some guy was asking about it for OpenBSD but they don't have a tap(4)
device)
They have. It's tun(4) plus some ioctl to switch it to Ethernet mode.
--
Quentin Garnier - ***@cubidou.net - ***@NetBSD.org
"See the look on my face from staying too long in one place
[...] every time the morning breaks I know I'm closer to falling"
KT Tunstall, Saving My Face, Drastic Fantastic, 2007.
Iain Hibbert
2008-11-09 19:31:38 UTC
Permalink
Post by Quentin Garnier
[...]
Post by Iain Hibbert
(Some guy was asking about it for OpenBSD but they don't have a tap(4)
device)
(heh, I didn't intend that msg to go to tech-net :)
Post by Quentin Garnier
They have. It's tun(4) plus some ioctl to switch it to Ethernet mode.
Mm, interesting .. do we want that?

iain

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Quentin Garnier
2008-11-09 20:36:00 UTC
Permalink
[...]
Post by Iain Hibbert
Post by Quentin Garnier
They have. It's tun(4) plus some ioctl to switch it to Ethernet mode.
Mm, interesting .. do we want that?
Having tap(4) separate from tun(4) was intentional. It was discussed at
the time.
--
Quentin Garnier - ***@cubidou.net - ***@NetBSD.org
"See the look on my face from staying too long in one place
[...] every time the morning breaks I know I'm closer to falling"
KT Tunstall, Saving My Face, Drastic Fantastic, 2007.
Rafal Boni
2008-08-14 01:18:47 UTC
Permalink
Post by Iain Hibbert
Finally I wrote a Bluetooth PAN daemon for NetBSD, it opens a tap(4)
Ooh, excellent!
Post by Iain Hibbert
http://www.netbsd.org/~plunky/btpand-20080812.tar.gz
bnep.c:572, channel.c:211, tap.c:116 all need %d -> %zd for the size_t
byte counts (building on sparc64).

Haven't had a chance to set it up yet however.. more when I get there.

Thanks,
--rafal


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Iain Hibbert
2008-08-14 07:52:29 UTC
Permalink
bnep.c:572, channel.c:211, tap.c:116 all need %d -> %zd for the size_t byte
counts (building on sparc64).
was lost for a minute, but I removed those already (way too verbose :)

http://www.netbsd.org/~plunky/btpand-20080814.tar.gz

iain

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Iain Hibbert
2008-08-15 08:37:39 UTC
Permalink
Post by Iain Hibbert
http://www.netbsd.org/~plunky/btpand-20080812.tar.gz
Bah, detach code wasn't working properly (kqueue is not inherited by child
processes) so I've reworked that to fork earlier.

http://www.netbsd.org/~plunky/btpand-20080815.tar.gz

iain

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
KIYOHARA Takashi
2008-08-19 13:47:56 UTC
Permalink
Hi! Iain,


From: Iain Hibbert <***@rya-online.net>
Date: Wed, 13 Aug 2008 16:17:15 +0100 (BST)
Post by Iain Hibbert
Finally I wrote a Bluetooth PAN daemon for NetBSD, it opens a tap(4)
NAP Network Access Point is like an ethernet bridge
GN Group ad-hoc Network is a NAP with no external network
PANU Personal Area Networking User in both host (like GN but
a single connection) and client (the device that connects
to all the others) mode.
http://www.netbsd.org/~plunky/btpand-20080812.tar.gz
Does your PAN work only in the user-land?
Don't I need in kernel source?

I have not read the source yet. However, I thought that BNEP was a
function in the kernel.

Thanks,
--
kiyohara

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Iain Hibbert
2008-08-19 17:51:55 UTC
Permalink
Post by KIYOHARA Takashi
Does your PAN work only in the user-land?
Don't I need in kernel source?
I have not read the source yet. However, I thought that BNEP was a
function in the kernel.
No, it uses tap(4) interface directly with an L2CAP socket. BNEP is in the
userland.

Although a bnep(4) interface could make some aspects more efficient
(context switch is expensive on some platform?), it could also make more
difficulty (a kernel device cannot make a record for SDP) and would be
more complex overall.

I think for the lower data rate of a Bluetooth device its not so bad for
now, but perhaps a busy NAP on small hardware might be a different matter
(needs to copy packet to multiple sockets)

iain

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...