diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 909782efb..ee4d1f19b 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -3017,16 +3017,16 @@ void CClient::Run() // open socket { NETADDR BindAddr; - if(g_Config.m_Bindaddr[0] && net_host_lookup(g_Config.m_Bindaddr, &BindAddr, NETTYPE_ALL) == 0) - { - // got bindaddr - BindAddr.type = NETTYPE_ALL; - } - else + if(g_Config.m_Bindaddr[0] == '\0') { mem_zero(&BindAddr, sizeof(BindAddr)); - BindAddr.type = NETTYPE_ALL; } + else if(net_host_lookup(g_Config.m_Bindaddr, &BindAddr, NETTYPE_ALL) != 0) + { + dbg_msg("client", "The configured bindaddr '%s' cannot be resolved", g_Config.m_Bindaddr); + return; + } + BindAddr.type = NETTYPE_ALL; for(unsigned int i = 0; i < std::size(m_aNetClient); i++) { int &PortRef = i == CONN_MAIN ? g_Config.m_ClPort : i == CONN_DUMMY ? g_Config.m_ClDummyPort : g_Config.m_ClContactPort; diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 766cd9236..8f3159143 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -2568,12 +2568,16 @@ int CServer::Run() // start server NETADDR BindAddr; - int NetType = Config()->m_SvIpv4Only ? NETTYPE_IPV4 : NETTYPE_ALL; - - if(!Config()->m_Bindaddr[0] || net_host_lookup(Config()->m_Bindaddr, &BindAddr, NetType) != 0) + if(g_Config.m_Bindaddr[0] == '\0') + { mem_zero(&BindAddr, sizeof(BindAddr)); - - BindAddr.type = NetType; + } + else if(net_host_lookup(g_Config.m_Bindaddr, &BindAddr, NETTYPE_ALL) != 0) + { + dbg_msg("server", "The configured bindaddr '%s' cannot be resolved", g_Config.m_Bindaddr); + return -1; + } + BindAddr.type = Config()->m_SvIpv4Only ? NETTYPE_IPV4 : NETTYPE_ALL; int Port = Config()->m_SvPort; for(BindAddr.port = Port != 0 ? Port : 8303; !m_NetServer.Open(BindAddr, &m_ServerBan, Config()->m_SvMaxClients, Config()->m_SvMaxClientsPerIP); BindAddr.port++) diff --git a/src/engine/shared/econ.cpp b/src/engine/shared/econ.cpp index 795520a9b..7a00362cf 100644 --- a/src/engine/shared/econ.cpp +++ b/src/engine/shared/econ.cpp @@ -64,18 +64,18 @@ void CEcon::Init(CConfig *pConfig, IConsole *pConsole, CNetBan *pNetBan) return; NETADDR BindAddr; - if(g_Config.m_EcBindaddr[0] && net_host_lookup(g_Config.m_EcBindaddr, &BindAddr, NETTYPE_ALL) == 0) - { - // got bindaddr - BindAddr.type = NETTYPE_ALL; - BindAddr.port = g_Config.m_EcPort; - } - else + if(g_Config.m_EcBindaddr[0] == '\0') { mem_zero(&BindAddr, sizeof(BindAddr)); - BindAddr.type = NETTYPE_ALL; - BindAddr.port = g_Config.m_EcPort; } + else if(net_host_lookup(g_Config.m_EcBindaddr, &BindAddr, NETTYPE_ALL) != 0) + { + char aBuf[256]; + str_format(aBuf, sizeof(aBuf), "The configured bindaddr '%s' cannot be resolved.", g_Config.m_Bindaddr); + Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "econ", aBuf); + } + BindAddr.type = NETTYPE_ALL; + BindAddr.port = g_Config.m_EcPort; if(m_NetConsole.Open(BindAddr, pNetBan)) {