diff --git a/osdep/Binder.hpp b/osdep/Binder.hpp index fe08f5195..614c6e725 100644 --- a/osdep/Binder.hpp +++ b/osdep/Binder.hpp @@ -87,11 +87,10 @@ namespace ZeroTier { class Binder { private: struct _Binding { - _Binding() : udpSock((PhySocket*)0), tcpListenSock((PhySocket*)0) + _Binding() : udpSock((PhySocket*)0) { } PhySocket* udpSock; - PhySocket* tcpListenSock; InetAddress address; char ifname[256] = {}; }; @@ -111,7 +110,6 @@ class Binder { Mutex::Lock _l(_lock); for (unsigned int b = 0, c = _bindingCount; b < c; ++b) { phy.close(_bindings[b].udpSock, false); - phy.close(_bindings[b].tcpListenSock, false); } _bindingCount = 0; } @@ -133,7 +131,7 @@ class Binder { template void refresh(Phy& phy, unsigned int* ports, unsigned int portCount, const std::vector explicitBind, INTERFACE_CHECKER& ifChecker) { std::map localIfAddrs; - PhySocket *udps, *tcps; + PhySocket *udps; Mutex::Lock _l(_lock); bool interfacesEnumerated = true; @@ -419,11 +417,8 @@ class Binder { } else { PhySocket* const udps = _bindings[b].udpSock; - PhySocket* const tcps = _bindings[b].tcpListenSock; _bindings[b].udpSock = (PhySocket*)0; - _bindings[b].tcpListenSock = (PhySocket*)0; phy.close(udps, false); - phy.close(tcps, false); } } @@ -437,24 +432,20 @@ class Binder { } if (bi == _bindingCount) { udps = phy.udpBind(reinterpret_cast(&(ii->first)), (void*)0, ZT_UDP_DESIRED_BUF_SIZE); - tcps = phy.tcpListen(reinterpret_cast(&(ii->first)), (void*)0); - if ((udps) && (tcps)) { + if (udps) { #ifdef __LINUX__ // Bind Linux sockets to their device so routes that we manage do not override physical routes (wish all platforms had this!) if (ii->second.length() > 0) { char tmp[256]; Utils::scopy(tmp, sizeof(tmp), ii->second.c_str()); int fd = (int)Phy::getDescriptor(udps); - if (fd >= 0) - setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, tmp, strlen(tmp)); - fd = (int)Phy::getDescriptor(tcps); - if (fd >= 0) + if (fd >= 0) { setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, tmp, strlen(tmp)); + } } #endif // __LINUX__ if (_bindingCount < ZT_BINDER_MAX_BINDINGS) { _bindings[_bindingCount].udpSock = udps; - _bindings[_bindingCount].tcpListenSock = tcps; _bindings[_bindingCount].address = ii->first; memcpy(_bindings[_bindingCount].ifname, (char*)ii->second.c_str(), (int)ii->second.length()); ++_bindingCount; @@ -462,7 +453,6 @@ class Binder { } else { phy.close(udps, false); - phy.close(tcps, false); } } } diff --git a/service/OneService.cpp b/service/OneService.cpp index b5e5c1924..c17f0ced0 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -2130,7 +2130,11 @@ public: } if(!_controlPlane.bind_to_port("0.0.0.0", _primaryPort)) { - fprintf(stderr, "Error binding control plane to port %d\n", _primaryPort); + fprintf(stderr, "Error binding control plane to 0.0.0.0:%d\n", _primaryPort); + exit(-1); + } + if(!_controlPlane.bind_to_port("::", _primaryPort)) { + fprintf(stderr, "Error binding control plane to :::%d\n", _primaryPort); exit(-1); }