Configuration d'un PAN Bluetooth


20

J'essaie de créer un PAN Bluetooth entre deux appareils où je peux accéder aux services Web basés sur REST via la connexion Bluetooth. J'ai eu un certain succès avec diverses preuves de concepts (Bluetooth Legacy et Bluetooth Smart), mais j'ai des problèmes pour créer un réseau de groupe ou un réseau PANU <-> PANU. Je suis capable de faire fonctionner un réseau en utilisant le scénario de point d'accès réseau, mais notre cas d'utilisation doit être un seul appareil communiquant avec un autre appareil unique sans routage vers d'autres appareils ou réseaux.

Pour commencer, j'ai un Raspberry Pi avec le dernier OS Raspbian. Cela vient avec bluez 5.23. Pour que le point d'accès réseau fonctionne, j'utilise le code suivant:

brctl addbr pan0
brctl setfd pan0 0
brctl stp pan0 off

ifconfig pan0 inet6 add fd00::5ef3:70ff:xxxx:xxxx
iplink set pan0 up

bt-network –d –s nap pan0

Cela fonctionne très bien et je suis capable de connecter des périphériques Linux et Windows. Je peux également accéder à un serveur Web Apache fonctionnant sur le Raspberry Pi à partir de l'appareil auquel je me suis connecté.

Sur le périphérique Linux, j'utilise blueman pour me connecter. J'ai également utilisé le réseau bt avec l'option –c pour me connecter également. Pour le périphérique Windows (tablette Windows 10), je jumelle le périphérique, puis je me connecte au réseau à partir de l'écran Périphériques réseau personnel Bluetooth. J'ai eu besoin d'utiliser bluetoothctl pour faire confiance aux deux appareils avant de me connecter.

Le NAP fonctionnant, je voulais tenter de faire fonctionner le réseau de groupe ou le réseau panu-panu comme décrit dans ce document: http://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=6554 Ces scénarios fonctionne le mieux pour nous car nous ne voulons pas acheminer vers des réseaux ou des appareils supplémentaires (le scénario panu-panu serait idéal)

Ma pensée initiale est tout ce que je devrais faire est de changer la commande bt-network en une de ces deux commandes:

bt-network –d –s gn pan0

bt-network –d –s panu pan0

Ces deux commandes démarrent avec des erreurs mais je ne parviens pas à établir une connexion réseau entre mes périphériques Linux ou Windows. Je peux coupler avec succès les appareils (j'utilise la commande «hciconfig hci0 piscan» pour faire de la publicité) mais je ne parviens pas à mettre le réseau en place.

Si je lance hcidump, j'obtiens la sortie suivante. Remarque J'ai inclus le hcidump entier de la tentative de connexion, donc c'est assez long mais j'ai pensé que cela pourrait aider à identifier le problème. C'est pour un réseau de groupe mais j'obtiens la même erreur avec le scénario panu-panu:

HCI sniffer - Bluetooth packet analyzer ver 5.23
device: hci0 snap_len: 1500 filter: 0xffffffff
> HCI Event: Connect Request (0x04) plen 10
    bdaddr 5C:F3:70:66:XX:XX class 0x000000 type ACL
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
    bdaddr 5C:F3:70:66:XX:XX role 0x00
    Role: Master
> HCI Event: Command Status (0x0f) plen 4
    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
> HCI Event: Role Change (0x12) plen 8
    status 0x00 bdaddr 5C:F3:70:66:XX:XX role 0x00
    Role: Master
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 11 bdaddr 5C:F3:70:66:XX:XX type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 11
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
> HCI Event: Max Slots Change (0x1b) plen 3
    handle 11 slots 5
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 11
    Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
< HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3
    handle 11 page 1
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
> HCI Event: Read Remote Extended Features (0x23) plen 13
    status 0x00 handle 11 page 1 max 1
    Features: 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr 5C:F3:70:66:XX:XX mode 2 clkoffset 0x0000
< ACL data: handle 11 flags 0x00 dlen 10
    L2CAP(s): Info req: type 2
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr 5C:F3:70:66:XX:XX name 'raspberrypi'
> HCI Event: IO Capability Response (0x32) plen 9
    bdaddr 5C:F3:70:66:XX:XX capability 0x01 oob 0x00 auth 0x03
    Capability: DisplayYesNo (OOB data not present)
    Authentication: Dedicated Bonding (MITM Protection)
> HCI Event: IO Capability Request (0x31) plen 6
    bdaddr 5C:F3:70:66:XX:XX
< HCI Command: IO Capability Request Reply (0x01|0x002b) plen 9
    bdaddr 5C:F3:70:66:XX:XX capability 0x03 oob 0x00 auth 0x02
    Capability: NoInputNoOutput (OOB data not present)
    Authentication: Dedicated Bonding (No MITM Protection)
> HCI Event: Command Complete (0x0e) plen 10
    IO Capability Request Reply (0x01|0x002b) ncmd 1
    status 0x00 bdaddr 5C:F3:70:66:XX:XX
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 11 packets 1
> HCI Event: User Confirmation Request (0x33) plen 10
    bdaddr 5C:F3:70:66:XX:XX passkey 774674
< HCI Command: User Confirmation Request Reply (0x01|0x002c) plen 6
    bdaddr 5C:F3:70:66:XX:XX
> HCI Event: Command Complete (0x0e) plen 10
    User Confirmation Request Reply (0x01|0x002c) ncmd 1
    status 0x00 bdaddr 5C:F3:70:66:XX:XX
> HCI Event: Simple Pairing Complete (0x36) plen 7
    status 0x00 bdaddr 5C:F3:70:66:XX:XX
> HCI Event: Link Key Notification (0x18) plen 23
    bdaddr 5C:F3:70:66:XX:XX key 839802CBF65CA6D1D864F91831A288B0 type 4
    Type: Unauthenticated Combination Key
> HCI Event: Encrypt Change (0x08) plen 4
    status 0x00 handle 11 encrypt 0x01
> ACL data: handle 11 flags 0x02 dlen 10
    L2CAP(s): Info req: type 2
> ACL data: handle 11 flags 0x02 dlen 16
    L2CAP(s): Info rsp: type 2 result 0
      Extended feature mask 0x02b8
        Enhanced Retransmission mode
        Streaming mode
        FCS Option
        Fixed Channels
        Unicast Connectless Data Reception
< ACL data: handle 11 flags 0x00 dlen 16
    L2CAP(s): Info rsp: type 2 result 0
      Extended feature mask 0x02b8
        Enhanced Retransmission mode
        Streaming mode
        FCS Option
        Fixed Channels
        Unicast Connectless Data Reception
< ACL data: handle 11 flags 0x00 dlen 10
    L2CAP(s): Info req: type 3
> ACL data: handle 11 flags 0x02 dlen 10
    L2CAP(s): Info req: type 3
< ACL data: handle 11 flags 0x00 dlen 20
    L2CAP(s): Info rsp: type 3 result 0
      Fixed channel list 0x00000006
        L2CAP Signalling Channel
        L2CAP Connless
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 11 packets 2
> ACL data: handle 11 flags 0x02 dlen 20
    L2CAP(s): Info rsp: type 3 result 0
      Fixed channel list 0x00000006
        L2CAP Signalling Channel
        L2CAP Connless
> ACL data: handle 11 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 1 scid 0x0040
< ACL data: handle 11 flags 0x00 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 0 status 0
      Connection successful
< ACL data: handle 11 flags 0x00 dlen 23
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 11
      RFC 0x00 (Basic) 
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 11 packets 2
> ACL data: handle 11 flags 0x02 dlen 23
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 11
      RFC 0x00 (Basic) 
< ACL data: handle 11 flags 0x00 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      MTU 672 
> ACL data: handle 11 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
      MTU 672 
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 11 packets 2
> ACL data: handle 11 flags 0x02 dlen 24
    L2CAP(d): cid 0x0040 len 20 [psm 1]
        SDP SSA Req: tid 0x0 len 0xf
          pat uuid-16 0x0100 (L2CAP)
          max 65535
          aid(s) 0x0000 - 0xffff
          cont 00
< ACL data: handle 11 flags 0x00 dlen 606
    L2CAP(d): cid 0x0040 len 602 [psm 1]
        SDP SSA Rsp: tid 0x0 len 0x255
          count 594
          record #0
              aid 0x0000 (SrvRecHndl)
                 uint 0x10001
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1800 >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x1f > <
                 uuid-16 0x0007 uint 0x1 uint 0x8 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x000a (DocURL)
                 url "http://www.bluez.org/"
              aid 0x000b (ClientExeURL)
                 url "http://www.bluez.org/"
              aid 0x000c (IconURL)
                 url "http://www.bluez.org/"
              aid 0x0100 (SrvName)
                 str "Generic Access Profile"
              aid 0x0102 (ProviderName)
                 str "BlueZ"
          record #1
              aid 0x0000 (SrvRecHndl)
                 uint 0x10002
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1801 >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x1f > <
                 uuid-16 0x0007 uint 0x10 uint 0x10 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0100 (SrvName)
                 str "Generic Attribute Profile"
              aid 0x0102 (ProviderName)
                 str "BlueZ"
          record #2
              aid 0x0000 (SrvRecHndl)
                 uint 0x10003
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x110e (AVRemote) uuid-16 0x110f (AVRemCt) >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x17 > <
                 uuid-16 0x0017 (AVCTP) uint 0x103 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x110e (AVRemote) uint 0x105 > >
              aid 0x000d (AdditionalProtocolDescLists)
                 < < < uuid-16 0x0100 (L2CAP) uint 0x1b > < uuid-16 0x0017 (AVCTP) uint 0x103 > > >
              aid 0x0100 (SrvName)
                 str "AVRCP CT"
              aid 0x0311 (SuppFeatures)
                 uint 0x4f
          record #3
              aid 0x0000 (SrvRecHndl)
                 uint 0x10004
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x110c (AVRemTarget) >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0x17 > <
                 uuid-16 0x0017 (AVCTP) uint 0x103 > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x110e (AVRemote) uint 0x104 > >
              aid 0x000d (AdditionalProtocolDescLists)
                 < < < uuid-16 0x0100 (L2CAP) uint 0x1b > < uuid-16 0x0017 (AVCTP) uint 0x103 > > >
              aid 0x0100 (SrvName)
                 str "AVRCP TG"
              aid 0x0311 (SuppFeatures)
                 uint 0x5f
          record #4
              aid 0x0000 (SrvRecHndl)
                 uint 0x10005
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1117 (GN) >
              aid 0x0004 (ProtocolDescList)
                 < < uuid-16 0x0100 (L2CAP) uint 0xf > <
                 uuid-16 0x000f (BNEP) uint 0x100 < uint 0x800 uint 0x806 > > >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0006 (LangBaseAttrIDList)
                 < uint 0x656e uint 0x6a uint 0x100 >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x1117 (GN) uint 0x100 > >
              aid 0x0100 (SrvName)
                 str "Network service"
              aid 0x0101 (SrvDesc)
                 str "Network service"
              aid 0x030a (SecurityDescription)
                 uint 0x1
          cont 00
> ACL data: handle 11 flags 0x02 dlen 24
    L2CAP(d): cid 0x0040 len 20 [psm 1]
        SDP SSA Req: tid 0x1 len 0xf
          pat uuid-16 0x1200 (PNPInfo)
          max 65535
          aid(s) 0x0000 - 0xffff
          cont 00
< ACL data: handle 11 flags 0x00 dlen 88
    L2CAP(d): cid 0x0040 len 84 [psm 1]
        SDP SSA Rsp: tid 0x1 len 0x4f
          count 76
          record #0
              aid 0x0000 (SrvRecHndl)
                 uint 0x10000
              aid 0x0001 (SrvClassIDList)
                 < uuid-16 0x1200 (PNPInfo) >
              aid 0x0005 (BrwGrpList)
                 < uuid-16 0x1002 (PubBrwsGrp) >
              aid 0x0009 (BTProfileDescList)
                 < < uuid-16 0x1200 (PNPInfo) uint 0x103 > >
              aid 0x0200 (VersionNumList)
                 uint 0x103
              aid 0x0201 (SrvDBState)
                 uint 0x1d6b
              aid 0x0202 (unknown)
                 uint 0x246
              aid 0x0203 (unknown)
                 uint 0x517
              aid 0x0204 (unknown)
                 bool 0x1
              aid 0x0205 (unknown)
                 uint 0x2
          cont 00
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 11 packets 2
> ACL data: handle 11 flags 0x02 dlen 12
    L2CAP(s): Disconn req: dcid 0x0040 scid 0x0040
< ACL data: handle 11 flags 0x00 dlen 12
    L2CAP(s): Disconn rsp: dcid 0x0040 scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 11 packets 1
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 11 reason 0x13
    Reason: Remote User Terminated Connection
> HCI Event: Connect Request (0x04) plen 10
    bdaddr 5C:F3:70:66:XX:XX class 0x000000 type ACL
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
    bdaddr 5C:F3:70:66:XX:XX role 0x00
    Role: Master
> HCI Event: Command Status (0x0f) plen 4
    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
> HCI Event: Role Change (0x12) plen 8
    status 0x00 bdaddr 5C:F3:70:66:XX:XX role 0x00
    Role: Master
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 12 bdaddr 5C:F3:70:66:XX:XX type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 12
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
> HCI Event: Max Slots Change (0x1b) plen 3
    handle 12 slots 5
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 12
    Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
< HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3
    handle 12 page 1
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
> HCI Event: Read Remote Extended Features (0x23) plen 13
    status 0x00 handle 12 page 1 max 1
    Features: 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr 5C:F3:70:66:XX:XX mode 2 clkoffset 0x0000
< ACL data: handle 12 flags 0x00 dlen 10
    L2CAP(s): Info req: type 2
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr 5C:F3:70:66:XX:XX name 'raspberrypi'
> HCI Event: Link Key Request (0x17) plen 6
    bdaddr 5C:F3:70:66:XX:XX
< HCI Command: Link Key Request Reply (0x01|0x000b) plen 22
    bdaddr 5C:F3:70:66:XX:XX key 839802CBF65CA6D1D864F91831A288B0
> HCI Event: Command Complete (0x0e) plen 10
    Link Key Request Reply (0x01|0x000b) ncmd 1
    status 0x00 bdaddr 5C:F3:70:66:XX:XX
> HCI Event: Encrypt Change (0x08) plen 4
    status 0x00 handle 12 encrypt 0x01
> ACL data: handle 12 flags 0x02 dlen 10
    L2CAP(s): Info req: type 2
< ACL data: handle 12 flags 0x00 dlen 16
    L2CAP(s): Info rsp: type 2 result 0
      Extended feature mask 0x02b8
        Enhanced Retransmission mode
        Streaming mode
        FCS Option
        Fixed Channels
        Unicast Connectless Data Reception
> ACL data: handle 12 flags 0x02 dlen 16
    L2CAP(s): Info rsp: type 2 result 0
      Extended feature mask 0x02b8
        Enhanced Retransmission mode
        Streaming mode
        FCS Option
        Fixed Channels
        Unicast Connectless Data Reception
< ACL data: handle 12 flags 0x00 dlen 10
    L2CAP(s): Info req: type 3
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 10
    L2CAP(s): Info req: type 3
< ACL data: handle 12 flags 0x00 dlen 20
    L2CAP(s): Info rsp: type 3 result 0
      Fixed channel list 0x00000006
        L2CAP Signalling Channel
        L2CAP Connless
> ACL data: handle 12 flags 0x02 dlen 20
    L2CAP(s): Info rsp: type 3 result 0
      Fixed channel list 0x00000006
        L2CAP Signalling Channel
        L2CAP Connless
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 15 scid 0x0040
< ACL data: handle 12 flags 0x00 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 1 status 2
      Connection pending - Authorization pending
< ACL data: handle 12 flags 0x00 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 3 status 0
      Connection refused - security block
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 12 packets 2
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 12 reason 0x13
    Reason: Remote User Terminated Connection

À la fin de ce vidage, j'obtiens l'erreur: "Connexion refusée - bloc de sécurité". Je crois que c'est le problème, mais je fais confiance aux appareils aux deux extrémités. J'obtiens cette même erreur si j'essaie d'utiliser un gn ou un panu comme type de serveur et avec une connexion à partir des périphériques Linux ou Windows.

Je vois beaucoup d'exemples pour le point d'accès réseau (NAP) mais j'ai du mal à trouver des exemples pour le réseau de groupe ou panu. Quelqu'un a-t-il réussi à faire fonctionner un réseau de groupe ou panu en utilisant bt-network (bluez 5.23)? Suis-je simplement en train de manquer quelque chose? Toute aide serait appréciée.

Merci

Jon

Réponses:


1

Appuyez avec le bouton droit sur le symbole dans le territoire d'avertissement du gadget Bluetooth et sélectionnez Rejoindre une région individuelle. L'aperçu des gadgets Bluetooth apparaît. ...

Appuyez sur le nom du PC auquel vous devez vous associer. Au moment où la page de propriétés de ce gadget s'affiche, cliquez sur OK pour fermer cette page.

Utilisation de Snap Connect.

En utilisant notre site, vous reconnaissez avoir lu et compris notre politique liée aux cookies et notre politique de confidentialité.
Licensed under cc by-sa 3.0 with attribution required.