orangepi-xunlong / orangepi-build

Orange Pi build for H2+, H3, H5, H6, H616, RK3328, RK3399 and RK3588(s)
http://www.orangepi.cn/
GNU General Public License v2.0
687 stars 289 forks source link

Bluetooth BNEP fails on Orange PI 3 LTS - bnep.c:bnep_add_to_bridge() #44

Open pierre-pretorius opened 2 years ago

pierre-pretorius commented 2 years ago

I've tried the setup below with many different boards. For some reason it fails on the Orange PI 3 LTS. If you fix this error, I will port it to Armbian like I did with your previous fix.

Image: Orangepi3-lts_3.0.6_debian_bullseye_server_linux5.16.17.img (I've also tried orange pi buster, ubuntu, etc.)

Setup from clean image

nano /etc/systemd/network/pan0.netdev

Paste content:

[NetDev]
Name=pan0
Kind=bridge
nano /etc/systemd/network/pan0.network

Paste content:

[Match]
Name=pan0

[Network]
Address=10.10.0.5/24
DHCPServer=true

[DHCPServer]
PoolOffset=100
PoolSize=100
EmitDNS=yes
DNS=9.9.9.9

[Link]
RequiredForOnline=false
apt-get install -y bluez bluez-tools nginx
systemctl enable systemd-networkd
systemctl enable nginx
reboot

Reproduce the error

In one terminal, start bt-agent:

/usr/bin/yes | /usr/bin/bt-agent -c NoInputNoOutput

In another terminal, start bt-network:

/usr/bin/bt-network -s nap pan0

In a 3rd terminal, set properties and tail log:

/usr/bin/bt-adapter --set Discoverable 1
/usr/bin/bt-adapter --set Pairable 1
journalctl -u bluetooth -f

Now connect to Bluetooth with a mobile phone. It prints this error on the orange PI:

Sep 15 17:10:31 orangepi3-lts systemd[1]: Starting Bluetooth service...
Sep 15 17:10:31 orangepi3-lts bluetoothd[1037]: Bluetooth daemon 5.55
Sep 15 17:10:31 orangepi3-lts bluetoothd[1037]: Starting SDP server
Sep 15 17:10:31 orangepi3-lts systemd[1]: Started Bluetooth service.
Sep 15 17:10:32 orangepi3-lts bluetoothd[1037]: Bluetooth management interface 1.21 initialized
Sep 15 17:15:42 orangepi3-lts bluetoothd[1037]: profiles/network/bnep.c:bnep_add_to_bridge() bnep: Can't add bnep0 to the bridge pan0: Invalid argument(22)
Sep 15 17:15:42 orangepi3-lts bluetoothd[1037]: profiles/network/server.c:bnep_setup() BNEP server cannot be added

It breaks here, which seems like some sort of network adapter index error? https://github.com/bluez/bluez/blob/401643e5c5528a6d0c372f82b1059fc0e02aed8e/profiles/network/bnep.c#L450

Expected result: the mobile phone can open http://10.10.0.5 and see the nginx page.

If you get sap-server errors you can ignore them. Sap can be disabled and doesn't affect the problem reported here.

YueBingg commented 3 months ago

I have the same problem