# bluez 4.x PAN access point on gentoo

## tox2ik

I am trying to share my network connection with a laptop through bluetooth. 

the laptop is an asus eee pc 1000h and runs debian testing (squeeze) with the bluez package from unstable: 

```

deeebian: ~

$ dpkg -l blue*  |grep ^i 

ii  bluetooth                            4.40-2                        Bluetooth support

ii  bluez                                4.40-2                        Bluetooth tools and daemons

ii  bluez-alsa                           4.40-2                        Bluetooth audio support

ii  bluez-cups                           4.40-2                        Bluetooth printer driver for CUPS

ii  bluez-gstreamer                      4.40-2                        Bluetooth GStreamer support

```

the desktop (PAN access point) is a gentoo 2008 machine with: 

```

raptor: /etc/bluetooth

$ equery l blue 

[I--] [ ~] net-wireless/bluez-4.39 (0)

```

/etc/init.d/bluetoothd start on either of the machines, neither detects (hcitool scan) nor l2pings the other one. they are able to detect and ping my neighbours cell phone, however.

```

raptor: ~

$ hcitool scan 

Scanning ...

        00:21:09:94:2C:B8       Nokia frode

$ l2ping  00:21:09:94:2C:B8 

Ping: 00:21:09:94:2C:B8 from 00:10:60:D0:25:E9 (data size 44) ...

0 bytes from 00:21:09:94:2C:B8 id 0 time 20.97ms

0 bytes from 00:21:09:94:2C:B8 id 1 time 36.47ms

0 bytes from 00:21:09:94:2C:B8 id 2 time 33.48ms

```

after enabling page and inquiry scan on the hci0 for the machine i am trying to l2ping i get the following:

```
$ /etc/init.d/bluetooth restart

* Shutting down Bluetooth...                                                                [ ok ]

* Starting Bluetooth...

*     Starting bluetoothd...                                                                [ ok ]

*     Starting rfcomm...                                                                    [ ok ]

$ hciconfig -a

hci0:   Type: USB

        BD Address: 00:10:60:D0:25:E9 ACL MTU: 384:8 SCO MTU: 64:8

        [B]UP RUNNING PSCAN[/B]

        RX bytes:5437 acl:13 sco:0 events:158 errors:0

        TX bytes:2170 acl:13 sco:0 commands:97 errors:0

        Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80

        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3

        Link policy: RSWITCH HOLD SNIFF PARK

        Link mode: SLAVE ACCEPT

        Name: 'rap.lan'

        Class: 0x020104

        Service Classes: Networking

        Device Class: Computer, Desktop workstation

        HCI Ver: 2.0 (0x3) HCI Rev: 0x7a6 LMP Ver: 2.0 (0x3) LMP Subver: 0x7a6

        Manufacturer: Cambridge Silicon Radio (10)

$ ssh eee.lan hcitool scan

Scanning ...

$ hciconfig hci0 piscan

$ hciconfig -a

hci0:   Type: USB

        BD Address: 00:10:60:D0:25:E9 ACL MTU: 384:8 SCO MTU: 64:8

        [B]UP RUNNING PSCAN ISCAN[/B]

        RX bytes:3850 acl:13 sco:0 events:115 errors:0

        TX bytes:1500 acl:13 sco:0 commands:54 errors:0

        Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80

        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3

        Link policy: RSWITCH HOLD SNIFF PARK

        Link mode: SLAVE ACCEPT

        Name: 'rap.lan'

        Class: 0x022108

        Service Classes: Networking

        Device Class: Computer, Server

        HCI Ver: 2.0 (0x3) HCI Rev: 0x7a6 LMP Ver: 2.0 (0x3) LMP Subver: 0x

        Manufacturer: Cambridge Silicon Radio (10)

$ ssh eee.lan hcitool scan

Scanning ...

        00:10:60:D0:25:E9       rap.lan

$ ssh eee.lan l2ping  00:10:60:D0:25:E9

Ping: 00:10:60:D0:25:E9 from 00:22:43:CE:73:82 (data size 44) ...

44 bytes from 00:10:60:D0:25:E9 id 0 time 37.79ms

44 bytes from 00:10:60:D0:25:E9 id 1 time 11.82ms

44 bytes from 00:10:60:D0:25:E9 id 2 time 31.83ms

44 bytes from 00:10:60:D0:25:E9 id 3 time 32.83ms

44 bytes from 00:10:60:D0:25:E9 id 4 time 11.83ms

44 bytes from 00:10:60:D0:25:E9 id 5 time 33.85ms

44 bytes from 00:10:60:D0:25:E9 id 6 time 37.84ms

44 bytes from 00:10:60:D0:25:E9 id 7 time 20.84ms

44 bytes from 00:10:60:D0:25:E9 id 8 time 11.84ms

44 bytes from 00:10:60:D0:25:E9 id 9 time 10.83ms

Send failed: Connection reset by peer

```

in other words, they are seeing each other. They both appear to have a working pan0 interface, which to my understanding is what should give me network.

```

raptor: ~

$ hciconfig hci0 lm master,accept 

$ hciconfig hci0 class 0x020108   

$ ifconfig  pan0 192.168.0.1 netmask 255.255.255.0 up 

$ hciconfig -a 

hci0:   Type: USB

        BD Address: 00:10:60:D0:25:E9 ACL MTU: 384:8 SCO MTU: 64:8

        UP RUNNING PSCAN ISCAN 

        RX bytes:7933 acl:26 sco:0 events:228 errors:0

        TX bytes:3051 acl:26 sco:0 commands:124 errors:0

        Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80

        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 

        Link policy: RSWITCH HOLD SNIFF PARK 

        Link mode: ACCEPT MASTER 

        Name: 'rap.lan'

        Class: 0x020108

        Service Classes: Networking

        Device Class: Computer, Server

        HCI Ver: 2.0 (0x3) HCI Rev: 0x7a6 LMP Ver: 2.0 (0x3) LMP Subver: 0x7a6

        Manufacturer: Cambridge Silicon Radio (10)

raptor: ~

$ ifconfig  pan0 

pan0      Link encap:Ethernet  HWaddr f2:b6:77:3e:88:3f  

          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 B)  TX bytes:1212 (1.1 KiB)

$ ssh eee.lan ifconfig  pan0 192.168.0.2 netmask 255.255.255.0 up 

Agent pid 6799

raptor: ~

$ ssh eee.lan ifconfig  pan0 

Agent pid 6799

pan0      Link encap:Ethernet  HWaddr 2e:8e:c2:13:50:9e  

          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::2c8e:c2ff:fe13:509e/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:107 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 B)  TX bytes:11858 (11.5 KiB)

raptor: ~

$ ssh eee.lan hciconfig -a 

Agent pid 6799

hci0:   Type: USB

        BD Address: 00:22:43:CE:73:82 ACL MTU: 1021:8 SCO MTU: 64:1

        UP RUNNING PSCAN ISCAN 

        RX bytes:23648 acl:104 sco:0 events:904 errors:0

        TX bytes:35589 acl:78 sco:0 commands:686 errors:0

        Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x79 0x83

        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 

        Link policy: RSWITCH HOLD SNIFF PARK 

        Link mode: SLAVE ACCEPT 

        Name: 'eee main.conf'

        Class: 0x02210c

        Service Classes: Networking

        Device Class: Computer, Laptop

        HCI Ver: 2.1 (0x4) HCI Rev: 0x50f1 LMP Ver: 2.1 (0x4) LMP Subver: 0x420e

        Manufacturer: Broadcom Corporation (15)

```

but im unable to get anything: 

```

$ ping 192.168.0.2 

PING 192.168.0.2 (192.168.0.2) 56(84) bytes of data.

From 192.168.0.1 icmp_seq=2 Destination Host Unreachable

From 192.168.0.1 icmp_seq=3 Destination Host Unreachable

From 192.168.0.1 icmp_seq=4 Destination Host Unreachable

^C

--- 192.168.0.2 ping statistics ---

5 packets transmitted, 0 received, +3 errors, 100% packet loss, time 4001ms

, pipe 3

```

I have failed to find any decent info on bluez 4.x on the net, I other words i dont know what to put im my  /etc/bluetooth/master.conf and /etc/bluetooth/network.conf. here is what i have on raptor (the PAN access point): 

```

/etc/bluetooth/main.conf

[General]

# List of plugins that should not be loaded on bluetoothd startup

#DisablePlugins = network,input

DisablePlugins = audio,input,netlink

# Default adaper name

# %h - substituted for hostname

# %d - substituted for adapter id

#Name = %h-%d

Name = raptor main.conf

# Default device class. Only the major and minor device class bits are

# considered.

Class = 0x020108

# How long to stay in discoverable mode before going back to non-discoverable

# The value is in seconds. Default is 180, i.e. 3 minutes.

# 0 = disable timer, i.e. stay discoverable forever

DiscoverableTimeout = 0

# How long to stay in pairable mode before going back to non-discoverable

# The value is in seconds. Default is 0.

# 0 = disable timer, i.e. stay pairable forever

PairableTimeout = 0

# Use some other page timeout than the controller default one

# which is 16384 (10 seconds).

PageTimeout = 8192

# Discover scheduler interval used in Adapter.DiscoverDevices

# The value is in seconds. Defaults is 0 to use controller scheduler.

DiscoverSchedulerInterval = 0

# What value should be assumed for the adapter Powered property when

# SetProperty(Powered, ...) hasn't been called yet. Defaults to true

InitiallyPowered = true

# Remember the previously stored Powered state when initializing adapters

RememberPowered = true

# Use vendor, product and version information for DID profile support.

# The values are separated by ":" and VID, PID and version.

#DeviceID = 1234:5678:abcd

#DeviceID = 1337:8004:affd

# Do reverse service discovery for previously unknown devices that connect to

# us. This option is really only needed for qualification since the BITE tester

# doesn't like us doing reverse SDP for some test cases (though there could in

# theory be other useful purposes for this too). Defaults to true.

ReverseServiceDiscovery = true

/etc/bluetooth/network.conf

# Configuration file for the network service

# This section contains options which are not specific to any

# particular interface

[General]

# Disable link encryption: default=false

#DisableSecurity=true

[PANU Role]

# Network interface name for PANU for connections. default:bnep%d

# (up to 16 characters)

#Interface=

# PAN user connection interface up script. default:none

Script=avahi-autoipd

[GN Role]

# Network Interface name for Group Network server. default:pan0

#Interface=

# Group Network connection interface up script. default:none

Script=avahi-autoipd

[NAP Role]

# Network Interface name for Network Access Point server. default:pan1

#Interface=

/etc/bluetooth/network.service

# Network Access Point connection interface up script. default:none

Script=dhclient

[Bluetooth Service]

Identifier=network

Name=Network service

Description=Bluetooth Personal Area Network service

Autostart=true

```

and bluetoothd -nd gives me:

```

daemon 4.39

bluetoothd[15756]: Enabling debug information

bluetoothd[15756]: parsing main.conf

bluetoothd[15756]: discovto=0

bluetoothd[15756]: pairto=0

bluetoothd[15756]: pageto=8192

bluetoothd[15756]: name=raptor main.conf

bluetoothd[15756]: class=0x020108

bluetoothd[15756]: discov_interval=0

bluetoothd[15756]: Key file does not have key 'DeviceID'

bluetoothd[15756]: Starting SDP server

bluetoothd[15756]: Loading builtin plugins

bluetoothd[15756]: Loading service plugin

bluetoothd[15756]: Loading hciops plugin

bluetoothd[15756]: Loading hal plugin

bluetoothd[15756]: Loading storage plugin

bluetoothd[15756]: Loading plugins /usr/lib64/bluetooth/plugins

bluetoothd[15756]: Loading serial plugin

bluetoothd[15756]: Loading network plugin

bluetoothd[15756]: register_interface: path /org/bluez/15756/any

bluetoothd[15756]: Registered interface org.bluez.Service on path /org/bluez/15756/any

bluetoothd[15756]: /etc/bluetooth/network.conf: Key file does not have key 'Disable'

bluetoothd[15756]: /etc/bluetooth/network.conf: Key file does not have key 'DisableSecurity'

bluetoothd[15756]: /etc/bluetooth/network.conf: Key file does not have key 'Interface'

bluetoothd[15756]: /etc/bluetooth/network.conf: Key file does not have key 'Interface'

bluetoothd[15756]: /etc/bluetooth/network.conf: Key file does not have key 'Interface'

bluetoothd[15756]: Config options: InterfacePrefix=bnep%d, PANU_Script=(null), GN_Script=(null), NAP_Script=(null), GN_Interface=pan0, NAP_Interface=pan1, Security=true

bluetoothd[15756]: Can't create GN bridge

bluetoothd[15756]: HCI dev 0 registered

bluetoothd[15756]: child 15757 forked

bluetoothd[15756]: Entering main loop

bluetoothd[15756]: child 15757 exited

bluetoothd[15756]: HCI dev 0 up

bluetoothd[15756]: Starting security manager 0

bluetoothd[15756]: register_interface: path /org/bluez/15756/hci0

bluetoothd[15756]: Registered interface org.bluez.Service on path /org/bluez/15756/hci0

bluetoothd[15756]: network_server_probe: path /org/bluez/15756/hci0

bluetoothd[15756]: Adding record with handle 0x10000

bluetoothd[15756]: Record pattern UUID 0000000f-0000-1000-8000-00805f9

bluetoothd[15756]: Record pattern UUID 00000100-0000-1000-8000-00805f9

bluetoothd[15756]: Record pattern UUID 00001002-0000-1000-8000-00805f9

bluetoothd[15756]: Record pattern UUID 00001115-0000-1000-8000-00805f9

bluetoothd[15756]: Changing service classes to 0x020104

bluetoothd[15756]: register_server_record: got record id 0x10000

bluetoothd[15756]: Registered interface org.bluez.NetworkPeer on path /org/bluez/15756/hci0

bluetoothd[15756]: network_server_probe: path /org/bluez/15756/hci0

bluetoothd[15756]: Adding record with handle 0x10001

bluetoothd[15756]: Record pattern UUID 0000000f-0000-1000-8000-00805f9

bluetoothd[15756]: Record pattern UUID 00000100-0000-1000-8000-00805f9

bluetoothd[15756]: Record pattern UUID 00001002-0000-1000-8000-00805f9

bluetoothd[15756]: Record pattern UUID 00001117-0000-1000-8000-00805f9

bluetoothd[15756]: Changing service classes to 0x020104

bluetoothd[15756]: register_server_record: got record id 0x10001

bluetoothd[15756]: Registered interface org.bluez.NetworkHub on path /org/bluez/15756/hci0

bluetoothd[15756]: network_server_probe: path /org/bluez/15756/hci0

bluetoothd[15756]: Adding record with handle 0x10002

bluetoothd[15756]: Record pattern UUID 0000000f-0000-1000-8000-00805f9

bluetoothd[15756]: Record pattern UUID 00000100-0000-1000-8000-00805f9

bluetoothd[15756]: Record pattern UUID 00001002-0000-1000-8000-00805f9

bluetoothd[15756]: Record pattern UUID 00001116-0000-1000-8000-00805f9

bluetoothd[15756]: Changing service classes to 0x020104

bluetoothd[15756]: register_server_record: got record id 0x10002

bluetoothd[15756]: Registered interface org.bluez.NetworkRouter on path /org/bluez/15756/hci0

bluetoothd[15756]: proxy_probe: path /org/bluez/15756/hci0

bluetoothd[15756]: Registered interface org.bluez.SerialProxyManager on path /org/bluez/15756/hci0

bluetoothd[15756]: Adapter /org/bluez/15756/hci0 has been enabled

bluetoothd[15756]: Computer is classified as desktop

bluetoothd[15756]: Current device class is 0x020104

bluetoothd[15756]: Setting 0x000104 for major/minor device class

bluetoothd[15756]: Changing major/minor class to 0x020104

bluetoothd[15756]: Removing adapter /org/bluez/15756/hci0

bluetoothd[15756]: unregister_interface: path /org/bluez/15756/hci0

bluetoothd[15756]: network_server_remove: path /org/bluez/15756/hci0

bluetoothd[15756]: Unregistered interface org.bluez.NetworkPeer on path /org/bluez/15756/hci0

bluetoothd[15756]: Removing record with handle 0x10000

bluetoothd[15756]: network_server_remove: path /org/bluez/15756/hci0

bluetoothd[15756]: Unregistered interface org.bluez.NetworkHub on path /org/bluez/15756/hci0

bluetoothd[15756]: Removing record with handle 0x10001

bluetoothd[15756]: network_server_remove: path /org/bluez/15756/hci0

bluetoothd[15756]: Unregistered interface org.bluez.NetworkRouter on path /org/bluez/15756/hci0

bluetoothd[15756]: Removing record with handle 0x10002

bluetoothd[15756]: proxy_remove: path /org/bluez/15756/hci0

bluetoothd[15756]: Cleanup plugins

bluetoothd[15756]: unregister_interface: path /org/bluez/15756/any

bluetoothd[15756]: Can't remove GN bridge

bluetoothd[15756]: Stopping SDP server

bluetoothd[15756]: Exit <-- manual ctl+c

```

any help, pointers or solutions are most welcome.

----------

