diff --git a/src/config.cpp b/src/config.cpp index 0fcc4bf..fa36478 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -487,6 +487,17 @@ void Config::expand() ifaces.emplace_back(SockAddr::any(AF_INET)); } + auto& ifmap = IfaceMap::instance(); + + for(auto& ep : ifaces) { + if(!ep.addr.isMCast()) {} + else if(!ep.iface.empty()) { + ifaces.emplace_back(ifmap.address_of(ep.iface)); + } else { + ifaces.emplace_back(SockAddr::any(ep.addr.family())); + } + } + if(auto_beacon) { // use interface list add ipv4 broadcast addresses to beaconDestinations. // 0.0.0.0 -> adds all bcasts diff --git a/src/server.cpp b/src/server.cpp index bfaec86..4352b8a 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -433,6 +433,10 @@ Server::Pvt::Pvt(const Config &conf) #endif } + if(tcpifaces.empty()) { + log_err_printf(serversetup, "Server Unreachable. Interface address list includes not TCP interfaces.%s", "\n"); + } + for(const auto& addr : effective.ignoreAddrs) { SockAddr temp(addr.c_str()); ignoreList.push_back(temp); diff --git a/src/serverconn.cpp b/src/serverconn.cpp index 9ff6fb3..6820d39 100644 --- a/src/serverconn.cpp +++ b/src/serverconn.cpp @@ -386,11 +386,14 @@ ServIface::ServIface(const SockAddr &addr, server::Server::Pvt *server, bool fal server->acceptor_loop.assertInLoop(); auto orig_port = bind_addr.port(); +#ifdef __linux__ if(server->canIPv6 && bind_addr.family()==AF_INET && bind_addr.isAny()) { - // promote to IPv6 with IPv4 support + // Linux IP stack disallows binding both 0.0.0.0 and [::] for the same port. + // so promote to IPv6 when possible bind_addr = SockAddr::any(AF_INET6, bind_addr.port()); log_debug_printf(connsetup, "Promote 0.0.0.0 -> [::]%s", "\n"); } +#endif sock = evsocket(bind_addr.family(), SOCK_STREAM, 0);