Synergy-core: Mac client listens on ipv4 only but attempts to connect on ipv6

Created on 18 Mar 2021  路  1Comment  路  Source: symless/synergy-core

Operating Systems

Server: macOS big sur 11.2.2
Client: macOS big sur 11.2.2

Synergy Version

Server: 1.13.1 and prior
Client: 1.13.1, prior, and also master 2009409c146ca2049235686c70ff99220e4f0682

Steps to Reproduce

  1. Server has mdns hostname 'abeja.local', which is pingable on both ipv4 and ipv6
$ ping abeja.local
$ ping6 abeja.local
  1. client is able to connect using static IPv4 address for server
  2. client is _unable_ to connect using mDNS address abeja.local, fails with 'connection refused' on the IPv6 address
  3. it is observed that the server is ONLY listening on IPv4: tcp4 0 0 *.24800 *.* LISTEN

Expected: should connect
Actual: can't connect

Extra Info

thanks to PR #6178 synergy now attempts to connect on ipv6 addresses. However, on mac, it still only listens on ipv4.

Quick workaround

index 92274343..e20fd31c 100644
--- a/src/lib/arch/unix/ArchNetworkBSD.cpp
+++ b/src/lib/arch/unix/ArchNetworkBSD.cpp
@@ -682,7 +682,7 @@ ArchNetworkBSD::nameToAddr(const std::string& name)
     int ret;

     memset(&hints, 0, sizeof(hints));
-    hints.ai_family = AF_UNSPEC;
+    hints.ai_family = AF_INET;  // To require IPv4

     // done with static buffer
     ARCH->lockMutex(m_mutex);

I suggest that if connection fails with ANY and the address family is v6, the client should RETRY by resolving using AF_INET.

bug triage

Most helpful comment

SYNERGY-885

>All comments

SYNERGY-885

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jenelcohen picture jenelcohen  路  4Comments

johnny-mac picture johnny-mac  路  4Comments

xmstspider picture xmstspider  路  4Comments

ColinCreamer picture ColinCreamer  路  5Comments

martindale picture martindale  路  5Comments