Skip to contentSkip to conversation

BlueZ: NAP by PAND + BRIDGE

Bluez-devel Al Chane 1 participant 1 message Feb 20, 2006 Bluetooth drivers

lore
Share & tools
lore

Al Chane

author
#0 lore raw

Hi,

I'm trying to implement a BlueZ NAP by using PAND + bridge + iptables.
The followings are what I've done:

1. on master (NAP) Fedora Core 2:

Quoted 6 lines

brctl addbr pan0
ifconfig pan0 10.0.0.1
brctl setfd pan0 0
brctl stp pan0 disable
modprobe bnep
pand --listen --master --role=NAP

2. on slave side #1 Fedora Core 1:

Quoted 4 lines

modprobe bnep
pand -c xx:xx:xx:xx:xx:xx
ifconfig bnep0 10.0.0.2 netmask 255.255.255.0 route add default gw 10.0.0.1

3. on master (NAP):

Quoted 2 lines

brctl addif pan0 bnep0
ifconfig bnep0 0.0.0.0

so far it works fine, bnep0 is created, and adding bridge interface bnep0 to pan0 seems ok.
=============================================================

Feb 20 13:32:47 AL30 hcid[1960]: link_key_request (sba=00:10:60:A2:D8:7C, dba=00 :09:C5:02:00:42)
Feb 20 13:32:47 AL30 hcid[1960]: pin_code_request (sba=00:10:60:A2:D8:7C, dba=00 :09:C5:02:00:42)
Feb 20 13:32:54 AL30 hcid[1960]: link_key_notify (sba=00:10:60:A2:D8:7C)
Feb 20 13:32:54 AL30 hcid[1960]: Replacing link key 00:10:60:A2:D8:7C 00:09:C5:0 2:00:42
Feb 20 13:32:54 AL30 pand[11631]: New connection from 00:09:C5:02:00:42 bnep0
Feb 20 13:32:55 AL30 kernel: ip_tables: (C) 2000-2002 Netfilter core team
Feb 20 13:32:55 AL30 kernel: ip_tables: (C) 2000-2002 Netfilter core team
Feb 20 13:34:21 AL30 kernel: device bnep0 entered promiscuous mode
Feb 20 13:34:21 AL30 kernel: pan0: port 1(bnep0) entering learning state
Feb 20 13:34:21 AL30 kernel: pan0: topology change detected, propgating
Feb 20 13:34:21 AL30 kernel: pan0: port 1(bnep0) entering forwarding state

===========================================================================

4. slave side #2 connection to NAP:

Quoted 4 lines

modprobe bnep
pand -c xx:xx:xx:xx:xx:xx
ifconfig bnep0 10.0.0.3 netmask 255.255.255.0 route add default gw 10.0.0.1

5. Once bnep1 is created, on master NAP side:

Quoted 2 lines

brctl addif pan0 bnep1
ifconfig bnep1 0.0.0.0

#bnep1 cannot be added to bridge pan0:
#console shows: br_add_interface: File exists
#system log shows: kernel: bnep1: attempt to add interface with same source ad dress. ========================================================================Feb 20 13:34:50 AL30 hcid[1960]: link_key_request (sba=00:10:60:A2:D8:7C, dba=00 :11:67:09:2B:A3)

Feb 20 13:34:50 AL30 hcid[1960]: pin_code_request (sba=00:10:60:A2:D8:7C, dba=00 :11:67:09:2B:A3)
Feb 20 13:34:56 AL30 hcid[1960]: link_key_notify (sba=00:10:60:A2:D8:7C)
Feb 20 13:34:56 AL30 hcid[1960]: Replacing link key 00:10:60:A2:D8:7C 00:11:67:0 9:2B:A3
Feb 20 13:34:59 AL30 hcid[1960]: link_key_request (sba=00:10:60:A2:D8:7C, dba=00 :11:67:09:2B:A3)
Feb 20 13:35:03 AL30 hcid[1960]: link_key_request (sba=00:10:60:A2:D8:7C, dba=00 :11:67:09:2B:A3)
Feb 20 13:35:04 AL30 pand[11755]: New connection from 00:11:67:09:2B:A3 bnep1
Feb 20 13:35:28 AL30 kernel: bnep1: attempt to add interface with same source ad dress.

==============================================================================

Quoted 1 line

ifconfig

bnep0 Link encap:Ethernet HWaddr 00:10:60:A2:D8:7C
inet6 addr: fe80::210:60ff:fea2:d87c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:126 errors:0 dropped:0 overruns:0 frame:0 TX packets:19 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000
RX bytes:7592 (7.4 Kb) TX bytes:656 (656.0 b)

bnep1 Link encap:Ethernet HWaddr 00:10:60:A2:D8:7C
inet6 addr: fe80::210:60ff:fea2:d87c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:49 errors:0 dropped:0 overruns:0 frame:0 TX packets:5 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000
RX bytes:5613 (5.4 Kb) TX bytes:188 (188.0 b)

eth0 Link encap:Ethernet HWaddr 00:01:29:4C:06:46

          inet addr:172.16.20.30  Bcast:172.16.20.255  Mask:255.255.255.0
          inet6 addr: fe80::201:29ff:fe4c:646/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:782 errors:0 dropped:0 overruns:0 frame:0
          TX packets:577 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:622359 (607.7 Kb)  TX bytes:81575 (79.6 Kb)
          Interrupt:11 Base address:0x1000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2672 errors:0 dropped:0 overruns:0 frame:0 TX packets:2672 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0
RX bytes:1994880 (1.9 Mb) TX bytes:1994880 (1.9 Mb)

pan0 Link encap:Ethernet HWaddr 00:10:60:A2:D8:7C
inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0 inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:108 errors:0 dropped:0 overruns:0 frame:0 TX packets:17 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0
RX bytes:6496 (6.3 Kb) TX bytes:994 (994.0 b)
============================================================================

Why the bnep1 cannot be added to bridge pan0? Please note that bnep0 and bnep1 's BT addresses refer to the same address as pan0's address. Is it normal?

Thanks for the helps,

Al