[PR #27] [CLOSED] Make Barrier work over Bluetooth sockets. #1547

Closed
opened 2026-05-05 07:56:04 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/debauchee/barrier/pull/27
Author: @ali1234
Created: 3/31/2018
Status: Closed

Base: masterHead: bluetooth-1


📝 Commits (3)

  • e309541 Non-breaking, ifdef-wrappable changes for Bluetooth.
  • c7ab51b More optional code.
  • 42245f8 Remaining breaking changes.

📊 Changes

8 files changed (+410 additions, -23 deletions)

View changed files

📝 CMakeLists.txt (+8 -0)
📝 src/lib/arch/IArchNetwork.h (+1 -0)
📝 src/lib/arch/unix/ArchNetworkBSD.cpp (+375 -14)
📝 src/lib/arch/unix/ArchNetworkBSD.h (+15 -1)
📝 src/lib/barrier/ArgParser.cpp (+6 -3)
📝 src/lib/ipc/IpcClient.cpp (+2 -2)
📝 src/lib/ipc/IpcServer.cpp (+1 -1)
📝 src/lib/net/NetworkAddress.cpp (+2 -2)

📄 Description

I don't expect you to merge this but I wanted to draw your attention to it, and ask if you are interested in this functionality.

This patch makes barrier run over RFCOMM bluetooth sockets. This is useful for a number of reasons:

  • It is encrypted by default.
  • It is "out of band" - meaning you won't lose control if the network connection goes down or is swamped by a large file transfer.
  • SDP allows a laptop running the client to "roam" between two or more servers, eg home and work.

It is adapted from synergy-bluetooth which I created nearly 10 years ago with assistance from Valmantas Palikša aka @walmis, who was the maintainer of Blueman at the time. I had thought the code lost, but I was inspired to go looking again with the release of Barrier. I have ported the old code to Barrier and tested that it still works. Unfortunately the change history and attribution is definitely lost, unless walmis has it.

This is Linux-only, and currently breaks TCP socket implementation.

To use it you must run bluetoothd with --compat and give yourself
write access to /var/run/sdp. The SDP code will need to be ported
to the new DBUS implementation to fix this.

No changes are needed in the server config file.

The client can be run with no arguments. It will scan for a server
using SDP. Alternatively a BDADDR can be supplied (run hciconfig
on the server to find it). This mode of operation is more reliable
and does not require the server to be discoverable. However, SDP
scanning allows a client to roam between servers seamlessly.

The SDP code is copyright (C) 2009 Valmantas Palikša.

The trick here is that bluetooth sockets are nearly interchangable with AF_INET sockets on Linux. Also, since the addition of ipv6, there is already support for two different AF socket families and the ability to select which address family to use in many (but not all) parts of the code. AF_BLUETOOTH only really requires slightly different name resolution and everything else works the same. In fact TCPListenSocket already works with AF_BLUETOOTH with no modifications, so maybe its name is not entirely accurate. ;)

The most obvious problem with this patch is that it currently replaces TCP/IP function. In the Ipc classes, and in some other places, the choice of address family is hardcoded. Rather than try to add run time selection like the old version did, I have simply changed them all to kBLUETOOTH. However, in many other places, adding support is as simple as adding another case: to a switch statement.

There is also the issue of SDP. This makes up the bulk of the patch. In Bluez 5 the API used here is deprecated, replaced by a DBus protocol. This may mean a dependency on glib or some other DBus handling library.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/debauchee/barrier/pull/27 **Author:** [@ali1234](https://github.com/ali1234) **Created:** 3/31/2018 **Status:** ❌ Closed **Base:** `master` ← **Head:** `bluetooth-1` --- ### 📝 Commits (3) - [`e309541`](https://github.com/debauchee/barrier/commit/e3095412844691d2cf61590701db4d10379d2012) Non-breaking, ifdef-wrappable changes for Bluetooth. - [`c7ab51b`](https://github.com/debauchee/barrier/commit/c7ab51ba99dc785aa0af4b2d6a8bc4b8fc9772d6) More optional code. - [`42245f8`](https://github.com/debauchee/barrier/commit/42245f8613b1990aa96cc22ff3d9c1803890e0c1) Remaining breaking changes. ### 📊 Changes **8 files changed** (+410 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+8 -0) 📝 `src/lib/arch/IArchNetwork.h` (+1 -0) 📝 `src/lib/arch/unix/ArchNetworkBSD.cpp` (+375 -14) 📝 `src/lib/arch/unix/ArchNetworkBSD.h` (+15 -1) 📝 `src/lib/barrier/ArgParser.cpp` (+6 -3) 📝 `src/lib/ipc/IpcClient.cpp` (+2 -2) 📝 `src/lib/ipc/IpcServer.cpp` (+1 -1) 📝 `src/lib/net/NetworkAddress.cpp` (+2 -2) </details> ### 📄 Description I don't expect you to merge this but I wanted to draw your attention to it, and ask if you are interested in this functionality. This patch makes barrier run over RFCOMM bluetooth sockets. This is useful for a number of reasons: * It is encrypted by default. * It is "out of band" - meaning you won't lose control if the network connection goes down or is swamped by a large file transfer. * SDP allows a laptop running the client to "roam" between two or more servers, eg home and work. It is adapted from synergy-bluetooth which I created nearly 10 years ago with assistance from Valmantas Palikša aka @walmis, who was the maintainer of Blueman at the time. I had thought the code lost, but I was inspired to go looking again with the release of Barrier. I have ported the old code to Barrier and tested that it still works. Unfortunately the change history and attribution is definitely lost, unless walmis has it. This is Linux-only, and currently breaks TCP socket implementation. To use it you must run bluetoothd with --compat and give yourself write access to /var/run/sdp. The SDP code will need to be ported to the new DBUS implementation to fix this. No changes are needed in the server config file. The client can be run with no arguments. It will scan for a server using SDP. Alternatively a BDADDR can be supplied (run hciconfig on the server to find it). This mode of operation is more reliable and does not require the server to be discoverable. However, SDP scanning allows a client to roam between servers seamlessly. The SDP code is copyright (C) 2009 Valmantas Palikša. The trick here is that bluetooth sockets are nearly interchangable with AF_INET sockets on Linux. Also, since the addition of ipv6, there is already support for two different AF socket families and the ability to select which address family to use in many (but not all) parts of the code. AF_BLUETOOTH only really requires slightly different name resolution and everything else works the same. In fact TCPListenSocket already works with AF_BLUETOOTH with no modifications, so maybe its name is not entirely accurate. ;) The most obvious problem with this patch is that it currently replaces TCP/IP function. In the Ipc classes, and in some other places, the choice of address family is hardcoded. Rather than try to add run time selection like the old version did, I have simply changed them all to kBLUETOOTH. However, in many other places, adding support is as simple as adding another case: to a switch statement. There is also the issue of SDP. This makes up the bulk of the patch. In Bluez 5 the API used here is deprecated, replaced by a DBus protocol. This may mean a dependency on glib or some other DBus handling library. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 07:56:04 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/barrier#1547
No description provided.