Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Mar 2008 16:03:48 -0800
From:      "Maksim Yevmenkin" <maksim.yevmenkin@gmail.com>
To:        mato <gamato@users.sf.net>
Cc:        freebsd-bluetooth@freebsd.org
Subject:   Re: BT issues
Message-ID:  <bb4a86c70803311703j4c4a4cfak2ffaacc4c70a7a7f@mail.gmail.com>
In-Reply-To: <47F13FEB.10503@users.sf.net>
References:  <47DBE7A4.3060006@users.sf.net> <bb4a86c70803161729y51f376d0t8333c30713c646d6@mail.gmail.com> <47EF6AA5.60403@users.sf.net> <bb4a86c70803311038p6a3d0a3fu8628f53683ba95fe@mail.gmail.com> <47F13FEB.10503@users.sf.net>

next in thread | previous in thread | raw e-mail | index | archive | help
[...]

> > 1) what is in your /etc/bluetooth/hcsecd.conf (on both freebsd machines)?
> >
> > 2) can you create (with hcidump -w trace) and send to me hcidump trace
> > that shows the problem after you boot from windows back to freebsd?
> >
> > also, as i explained to you, using the same device under two different
> > operating systems is a bit of a challenge. os is in charge of
> > initiating "pairing" process and storing link keys. just because you
> > pairing the same two devices does not mean that you will get the same
> > link key every time. as i explained to you, the best way to make it
> > work is to make sure link key is shared between both oses.
> >
>
>  1)
>
>  my home computer (the one with the internet connection) has:
>
>  device {
>        bdaddr  00:09:dd:50:0f:0a;
>        name    "Mato Edimax";
>        key     nokey;
>        pin     "1234";
>  }
>
>  my work computer has:
>
>  device {
>        bdaddr  00:16:41:12:09:53;
>        name    "Mato D820";
>        key     nokey;
>        pin     "1234";
>  }
>
>  Well, actually I've got the same hcsecd.conf with all the entries in both
> computers.

ok, that is fine. please try to do the following.

please run "hcidump -w trace1" on your sever while doing this.

1) boot your work computer into windows. pair both freebsd server and
your work computer (running windows);

2) stop hcsecd;

3) now, on your freebsd server look into the /var/db/hcsecd.keys file
and find a link key for your work computer (using your work computer's
bd_addr)

4) change hcsecd config on your freebsd server to and use link key
from (3) above, i.e. on freebsd server replace entry for your work
computer with something like

 device {
        bdaddr  <BD_ADDR_of_your_work_computer>;
        name    "work computer";
        key     0x<link_key_from_(3)_above goes here>;
        pin     nopin;
 }

5) restart hcsecd and try to connect from your work computer (running
windows) to your freebsd server and make sure it works;

6) send me the trace1 file

now reboot your work computer into freebsd and do the following.

please run "hcidump -w trace2" on your sever while doing this.

1) stop hcsecd

2) edit the hcsecd.conf file on the work computer (running freebsd)
and replace entry for the freebsd server with something like

 device {
        bdaddr  <BD_ADDR_of_your_SERVER_computer>;
        name    "SERVER computer";
        key     0x<link_key_from_(3)_above goes here>;
        pin     nopin;
 }

3) restart hcsecd and try to connect

4) send me the trace2 file

>  Just to be sure -- on which computer to run hcidump ?

read above

>  I do not know how to share link keys between FreeBSD and Windows.  Also, as
> explained in my previous email, there are situations when sharing a link key
> is not a choice.

you have to share the link key. there is no other way. hcsecd is not
setup to support multiple link keys between the same pair of the
devices. here what i think is going on. lets say you boot your work
computer into windows first. now, when you try to pair devices, both
server and work computer generate a unique link key and save it
locally. windows probably puts in somewhere in the registry and
freebsd server saves it in the  /var/db/hcsecd.key file. lets call
this link key "key1".

now, lets say you have booted freebsd on your work computer. at this
point hcsecd, running on your work computer, has no idea about link
key "key1" that you have generated while running windows on the same
work computer. however, freebsd server _KNOWS_ about link key "key1"
and assumes that this is a valid key for your work computer (well,
technically, it is a valid key to use with bluetooth device with given
bd_addr);

now, when you try to initiate connection from your work computer
(running freebsd) to your server computer, the server computer will
try to use link key "key1". the server computer has no idea that the
same bd_addr is now controlled by different os. since your work
computer does not know anything about link key "key1", it will reject
the key. because you have configured the pin code, hcsecd will try to
generate another unique link key and will update its database. lets
call it link key "key2". at the end, both freebsd work computer and
freebsd server computer will end up with the same link key "key2".

finally, you boot windows on your work computer again. when you try to
connect to the server computer, widows will use link key "key1". of
course, the server computer will reject the key (because it was
replaced with link key "key2" while you were running freebsd on your
work computer). i'm not sure what will happen on windows side, it may
simply fail to connect or it make ask for a pin again. if the later is
true, another link key will be generated and freebsd server will
update its database with it.

>  However, Windows can manage this as it asks for PIN key when connection
> initiation fails.  While I don't expect FreeBSD asking for a PIN, it might
> be quite useful if it could automatically (upon a connection establishing
> failure) throw away its stored link key and recreate it from PIN as Windows
> does.  This would definitely help as it is basically what I have to do
> manually after each Windows run (that is to say .. stop hcsecd, rm
> hcsecd.keys, start hcsecd).

it already does that in background. like i explained, the rules are

1) use link key (if configured or found in /var/db/hcsecd.key) file

2) if there are no link key or received negative link key reply use pin code

3) if no pin code configured - fail

thanks,
max



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bb4a86c70803311703j4c4a4cfak2ffaacc4c70a7a7f>