btpand example

View: New views
9 Messages — Rating Filter:   Alert me  

btpand example

by Daniel O'Connor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I just got btpand working with my phone (Samsung Omnia i900 - WinMo 6.1
based) and here's what I did..

On PDA: Programs -> Internet Sharing -> Connect
sudo hccontrol -n ubt0hci write_authentication_enable 1
sudo ifconfig tap0 create mtu 600
sudo btpand -d me -s NAP -i tap0 -a pda
[enter pin on PDA as per hcsecd.conf]
sudo dhclient tap0

Note that unlike the NetBSD example '-d ubt0' or '-d ubt0hci' doesn't
work as it reports unknown host. I have 'me' in /etc/bluetooth/hosts,
but that is non-standard (and '-d local' doesn't work).

Also, I found the MTU by trial and error, 600 works for me, 650 does
not. I am guessing this is a bluetooth thing but I'm not sure.. If it
is would it be possible for btpand to set the MTU?

Please CC me as I'm not on the list, thanks.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc (195 bytes) Download Attachment

Re: btpand example

by Iain Hibbert :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 14 May 2009, Daniel O'Connor wrote:

> Also, I found the MTU by trial and error, 600 works for me, 650 does
> not. I am guessing this is a bluetooth thing but I'm not sure.. If it
> is would it be possible for btpand to set the MTU?

Why did you think to change the MTU and what was the failure?

btpand itself doesn't actually care about the interface MTU and I talk to
a WinMo 6.0 system fine (from NetBSD) with default ethernet MTU of 1500.

On the bluetooth side, the BNEP minimum MTU is 1691 but we won't send
anything bigger than as we don't create any extension headers in client
mode. Packets will be what came from the tap.

regards,
iain
_______________________________________________
freebsd-bluetooth@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bluetooth
To unsubscribe, send any mail to "freebsd-bluetooth-unsubscribe@..."

Re: btpand example

by Daniel O'Connor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 14 May 2009, Iain Hibbert wrote:
> On Thu, 14 May 2009, Daniel O'Connor wrote:
> > Also, I found the MTU by trial and error, 600 works for me, 650
> > does not. I am guessing this is a bluetooth thing but I'm not
> > sure.. If it is would it be possible for btpand to set the MTU?
>
> Why did you think to change the MTU and what was the failure?

I found that pinging worked and I could connect to an SSH port but they
SSH key exchange stalled so I guessed MTU and got lucky.

> btpand itself doesn't actually care about the interface MTU and I
> talk to a WinMo 6.0 system fine (from NetBSD) with default ethernet
> MTU of 1500.

OK.

I later tried l2ping -s 1500 -a pda and it worked so I'm not sure what's
going on.

> On the bluetooth side, the BNEP minimum MTU is 1691 but we won't send
> anything bigger than as we don't create any extension headers in
> client mode. Packets will be what came from the tap.

OK.. I wonder where the problem is :(

I have done the same operation on the same hardware in Linux and it
worked without MTU tweaks, however I haven't looked to see what MTU it
used or anything.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc (195 bytes) Download Attachment

Re: btpand example

by Iain Hibbert :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 14 May 2009, Daniel O'Connor wrote:

> On Thu, 14 May 2009, Iain Hibbert wrote:
> > On Thu, 14 May 2009, Daniel O'Connor wrote:
> > > Also, I found the MTU by trial and error, 600 works for me, 650
> > > does not. I am guessing this is a bluetooth thing but I'm not
> > > sure.. If it is would it be possible for btpand to set the MTU?
> >
> > Why did you think to change the MTU and what was the failure?
>
> I found that pinging worked and I could connect to an SSH port but they
> SSH key exchange stalled so I guessed MTU and got lucky.

Hm, I do manage to use ssh successfully over a btpand/winmobile link..

> I later tried l2ping -s 1500 -a pda and it worked so I'm not sure what's
> going on.

probably better to try actual ping with larger packet sizes..?  l2ping
only tests the bluetooth link.

If you also added a log_debug() to the end of bnep_send() to display the
nw and pkt->len values you might see if lossage was happening at any
particular packet size. There is already a check that the packet doesn't
exceed the MTU of the link though.

> I have done the same operation on the same hardware in Linux and it
> worked without MTU tweaks, however I haven't looked to see what MTU it
> used or anything.

I do get a weird problem sometimes where incoming ethernet packet payload
is rejected by tap for being oversized. I've never tracked it down but I'm
blaming windows mobile for that because the ethernet packet probably
originates there rather than at the other end of the GPRS link (I could be
wrong)

eg

May  2 11:06:36 galant btpand[820]: bnep_recv: received long packet (type=0x02, proto=0x0800, len=1568)
May  2 11:06:36 galant /netbsd: tap0: discarding oversize frame (len=1582)

I find this will cause a HTTP transfer to stall but I think ssh recovers
from the lost packet ok.

iain
_______________________________________________
freebsd-bluetooth@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bluetooth
To unsubscribe, send any mail to "freebsd-bluetooth-unsubscribe@..."

Re: btpand example

by Maksim Yevmenkin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Daniel,

> I just got btpand working with my phone (Samsung Omnia i900 - WinMo 6.1
> based) and here's what I did..

cool! thank for reporting.

> Note that unlike the NetBSD example '-d ubt0' or '-d ubt0hci' doesn't
> work as it reports unknown host. I have 'me' in /etc/bluetooth/hosts,
> but that is non-standard (and '-d local' doesn't work).

could you please try this patch?
Index: btpand.c
===================================================================
--- btpand.c    (revision 192109)
+++ btpand.c    (working copy)
@@ -101,7 +101,7 @@
                        break;

                case 'd': /* local address */
-                       if (!bt_aton(optarg, &local_bdaddr)) {
+                       if (!bt_devaddr(optarg, &local_bdaddr)) {
                                struct hostent  *he;

                                if ((he = bt_gethostbyname(optarg)) == NULL)

===

> Also, I found the MTU by trial and error, 600 works for me, 650 does
> not. I am guessing this is a bluetooth thing but I'm not sure.. If it
> is would it be possible for btpand to set the MTU?

sure :) however, like Iain said, it would be interesting to see what
is going on. any chance we could get both hcidump (created with -w
option) and tcpdump? could it be something that has to do with tcp mss
fixup?

thanks,
max
_______________________________________________
freebsd-bluetooth@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bluetooth
To unsubscribe, send any mail to "freebsd-bluetooth-unsubscribe@..."

Re: btpand example

by Daniel O'Connor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 15 May 2009, Maksim Yevmenkin wrote:

> Daniel,
>
> > I just got btpand working with my phone (Samsung Omnia i900 - WinMo
> > 6.1 based) and here's what I did..
>
> cool! thank for reporting.
>
> > Note that unlike the NetBSD example '-d ubt0' or '-d ubt0hci'
> > doesn't work as it reports unknown host. I have 'me' in
> > /etc/bluetooth/hosts, but that is non-standard (and '-d local'
> > doesn't work).
>
> could you please try this patch?
> Index: btpand.c
> ===================================================================
> --- btpand.c    (revision 192109)
> +++ btpand.c    (working copy)
> @@ -101,7 +101,7 @@
>                         break;
>
>                 case 'd': /* local address */
> -                       if (!bt_aton(optarg, &local_bdaddr)) {
> +                       if (!bt_devaddr(optarg, &local_bdaddr)) {
>                                 struct hostent  *he;
>
>                                 if ((he = bt_gethostbyname(optarg))
> == NULL)
>
> ===
OK this works, thanks!
btpand -d ubt0 -s NAP -i tap0 -a pda

(and ubt0hci)

> > Also, I found the MTU by trial and error, 600 works for me, 650
> > does not. I am guessing this is a bluetooth thing but I'm not
> > sure.. If it is would it be possible for btpand to set the MTU?
>
> sure :) however, like Iain said, it would be interesting to see what
> is going on. any chance we could get both hcidump (created with -w
> option) and tcpdump? could it be something that has to do with tcp
> mss fixup?

Hmm, where do I get hcidump from?

Also, I just tried it again and now I can set the MTU to 1500 and it
works fine..

I have reset my phone in the mean time so maybe it was out of memory or
something silly like that..

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc (195 bytes) Download Attachment

Re: btpand example

by Daniel O'Connor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 14 May 2009, Iain Hibbert wrote:

> > I found that pinging worked and I could connect to an SSH port but
> > they SSH key exchange stalled so I guessed MTU and got lucky.
>
> Hm, I do manage to use ssh successfully over a btpand/winmobile
> link..
>
> > I later tried l2ping -s 1500 -a pda and it worked so I'm not sure
> > what's going on.
>
> probably better to try actual ping with larger packet sizes..?
> l2ping only tests the bluetooth link.
Sorry, I missed a step before, I did try ICMP pings when trying to work
it out.

600 was the largest I found (650 was too large)

> If you also added a log_debug() to the end of bnep_send() to display
> the nw and pkt->len values you might see if lossage was happening at
> any particular packet size. There is already a check that the packet
> doesn't exceed the MTU of the link though.

I can't reproduce the problem now.. Perhaps my phone was out of RAM or
something.

> > I have done the same operation on the same hardware in Linux and it
> > worked without MTU tweaks, however I haven't looked to see what MTU
> > it used or anything.
>
> I do get a weird problem sometimes where incoming ethernet packet
> payload is rejected by tap for being oversized. I've never tracked it
> down but I'm blaming windows mobile for that because the ethernet
> packet probably originates there rather than at the other end of the
> GPRS link (I could be wrong)
>
> eg
>
> May  2 11:06:36 galant btpand[820]: bnep_recv: received long packet
> (type=0x02, proto=0x0800, len=1568) May  2 11:06:36 galant /netbsd:
> tap0: discarding oversize frame (len=1582)
I haven't seen that [yet] but I've barely used it.

> I find this will cause a HTTP transfer to stall but I think ssh
> recovers from the lost packet ok.

OK.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc (195 bytes) Download Attachment

Re: btpand example

by Maksim Yevmenkin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, May 15, 2009 at 10:37 PM, Daniel O'Connor <doconnor@...> wrote:

> On Fri, 15 May 2009, Maksim Yevmenkin wrote:
>> Daniel,
>>
>> > I just got btpand working with my phone (Samsung Omnia i900 - WinMo
>> > 6.1 based) and here's what I did..
>>
>> cool! thank for reporting.
>>
>> > Note that unlike the NetBSD example '-d ubt0' or '-d ubt0hci'
>> > doesn't work as it reports unknown host. I have 'me' in
>> > /etc/bluetooth/hosts, but that is non-standard (and '-d local'
>> > doesn't work).
>>
>> could you please try this patch?

[...]

> OK this works, thanks!
> btpand -d ubt0 -s NAP -i tap0 -a pda
>
> (and ubt0hci)

great! thanks! i've committed it.

>> > Also, I found the MTU by trial and error, 600 works for me, 650
>> > does not. I am guessing this is a bluetooth thing but I'm not
>> > sure.. If it is would it be possible for btpand to set the MTU?
>>
>> sure :) however, like Iain said, it would be interesting to see what
>> is going on. any chance we could get both hcidump (created with -w
>> option) and tcpdump? could it be something that has to do with tcp
>> mss fixup?
>
> Hmm, where do I get hcidump from?

from ports comm/hcidump

> Also, I just tried it again and now I can set the MTU to 1500 and it
> works fine..
>
> I have reset my phone in the mean time so maybe it was out of memory or
> something silly like that..

hmm... interesting... if/when it happens again could you please get
both hci and tcp dumps?

thanks,
max
_______________________________________________
freebsd-bluetooth@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bluetooth
To unsubscribe, send any mail to "freebsd-bluetooth-unsubscribe@..."

Re: btpand example

by Daniel O'Connor-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 19 May 2009, Maksim Yevmenkin wrote:
> > OK this works, thanks!
> > btpand -d ubt0 -s NAP -i tap0 -a pda
> >
> > (and ubt0hci)
>
> great! thanks! i've committed it.

Thanks.

> > Hmm, where do I get hcidump from?
>
> from ports comm/hcidump

Ahah, it's installed now!

> > I have reset my phone in the mean time so maybe it was out of
> > memory or something silly like that..
>
> hmm... interesting... if/when it happens again could you please get
> both hci and tcp dumps?

Sure.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


signature.asc (195 bytes) Download Attachment