Samuel Thibault, le lun. 08 juin 2026 21:54:13 +0200, a ecrit:
> [email protected], le lun. 08 juin 2026 12:45:35 -0700, a ecrit:
> 14:46:30.315375 connect(3, {sa_family=AF_INET6, sin6_port=htons(4101),
> sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "IPV6_REDACTED", &sin6_addr),
> sin6_scope_id=0}, 28) = -1 ETIMEDOUT (Connection timed out) <135.074947>
> 14:48:45.390569 close(3) = 0 <0.000183>
>
> So that is the culprit, it's waiting for two minutes rather than getting
> an immediate ECONNREFUSED. Do you happen to have a firewall that could
> be eating the packets?
>
> I'd rather not disable the TCP attempt since that's useful for
> ssh-forwarded connections. I guess we could at least reduce the timeout
> since on localhost the connection should be immediate.
Could you try to rebuild the brltty package with the attached patch?
Samuel
diff --git a/Programs/brlapi_client.c b/Programs/brlapi_client.c
index 3b36979cf..3116f17df 100644
--- a/Programs/brlapi_client.c
+++ b/Programs/brlapi_client.c
@@ -890,6 +890,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;