Package: release.debian.org
Severity: normal
Tags: trixie
X-Debbugs-Cc: [email protected]
Control: affects -1 + src:brltty
User: [email protected]
Usertags: pu

Hello,

I have uploaded brltty 6.7-3.1+deb13u4 for trixie.

[ Reason ]
It was reported in Bug#1087173 that in some network configuration cases
(ipv6 packets getting dropped instead of ipv6 being disabled), the mere
presence of the xbrlapi package makes X sessions startup get stuck for
two minutes. The underlying issue is that xbrlapi tries to connect to
an existing brltty through localhost, but in that configuration case,
the connect() call waits for 2m before timing out instead of immediately
returning ECONNREFUSED.

[ Impact ]
Some people report this long login delay. They have to remove the
xbrlapi package to avoid the issue.

[ Tests ]
This was tested manually.

[ Risks ]
The code is very simple.

[ Checklist ]
  [X] *all* changes are documented in the d/changelog
  [X] I reviewed all changes and I approve them
  [X] attach debdiff against the package in (old)stable
  [X] the issue is verified as fixed in unstable

[ Changes ]
The change simply configures the timeout to 0.1s, the idea being that
connection to localhost should be very immediate if a brltty server is
indeed runnnig.
diff -Nru brltty-6.7/debian/changelog brltty-6.7/debian/changelog
--- brltty-6.7/debian/changelog 2026-01-21 19:00:18.000000000 +0100
+++ brltty-6.7/debian/changelog 2026-09-19 14:27:54.000000000 +0200
@@ -1,3 +1,10 @@
+brltty (6.7-3.1+deb13u4) trixie; urgency=medium
+
+  * patches/git-localhost-timeout: Make connections to localhost timeout after
+    0.1s (Closes: Bug#1087173)
+
+ -- Samuel Thibault <[email protected]>  Sat, 19 Sep 2026 14:27:54 +0200
+
 brltty (6.7-3.1+deb13u3) trixie; urgency=medium
 
   * patches/systemd-vtnr: Fix getting vtnr from systemd.
diff -Nru brltty-6.7/debian/patches/git-localhost-timeout 
brltty-6.7/debian/patches/git-localhost-timeout
--- brltty-6.7/debian/patches/git-localhost-timeout     1970-01-01 
01:00:00.000000000 +0100
+++ brltty-6.7/debian/patches/git-localhost-timeout     2026-09-19 
14:27:04.000000000 +0200
@@ -0,0 +1,36 @@
+commit cc58966ee2133520b224f6be61d87843989cb1d4
+Author: Samuel Thibault <[email protected]>
+Date:   Sat Sep 12 11:47:07 2026 +0200
+
+    brlapi: Make connections to localhost timeout after 0.1s
+    
+    We have seen system configurations where connecting to IPv6 ::1 would just
+    hang instead of reporting ECONNREFUSED when brltty is not running, probably
+    due to various misconfigured firewalls and whatnot. That is a broken system
+    configuration, but better avoid the issue from brlapi by just expecting the
+    connection to be fast on localhost.
+
+diff --git a/Programs/brlapi_client.c b/Programs/brlapi_client.c
+index 4b8d6187e..91d80e640 100644
+--- a/Programs/brlapi_client.c
++++ b/Programs/brlapi_client.c
+@@ -929,6 +929,19 @@ static int tryHost(brlapi_handle_t *handle, const char 
*hostAndPort) {
+       }
+ #endif /* !__MINGW32__ && !HAVE_POLL */
+ 
++      const struct in6_addr ip6_localhost = IN6ADDR_LOOPBACK_INIT;
++
++      if ((cur->ai_family == AF_INET
++          && (ntohl(((struct sockaddr_in *)cur->ai_addr)->sin_addr.s_addr) & 
IN_CLASSA_NET)
++            == (INADDR_LOOPBACK & IN_CLASSA_NET))
++        || (cur->ai_family == AF_INET6
++          && !memcmp(cur->ai_addr, &ip6_localhost, sizeof(ip6_localhost)))) {
++      /* Local connection, it should be fast, otherwise it means we have a
++       * firewall blocking us, and then better not wait unnecessarily. */
++      struct timeval tv = { .tv_usec = 100000 };
++      setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
++      }
++
+       if (connect(sockfd, cur->ai_addr, cur->ai_addrlen)<0) {
+         closeSocketDescriptor(sockfd);
+         continue;
diff -Nru brltty-6.7/debian/patches/series brltty-6.7/debian/patches/series
--- brltty-6.7/debian/patches/series    2026-01-21 19:00:18.000000000 +0100
+++ brltty-6.7/debian/patches/series    2026-09-19 14:27:29.000000000 +0200
@@ -8,3 +8,4 @@
 noverbose-bluetooth
 noverbose-usbfs
 systemd-vtnr
+git-localhost-timeout

Reply via email to