mirror of
https://github.com/znc/znc.git
synced 2026-06-27 21:41:25 +02:00
Fix a DNS bug in Csocket with non-blocking resolvers
After the first attempt to lookup an address, Csocket already created the socket used for communicating. Since at this point it wasn't yet known whether we will yield a IPv4 or IPv6 address, Csocket just always used IPv4. This would then later fail to connect() with 'Address family not supported by protocol'. This patch fixes this by creating the socket fd only when the DNS lookup completed successfully. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1556 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+6
-3
@@ -2051,11 +2051,14 @@ int Csock::DNSLookup( EDNSLType eDNSLType )
|
||||
iRet = GetAddrInfo( m_shostname, m_address );
|
||||
}
|
||||
|
||||
if( !CreateSocksFD() )
|
||||
iRet = ETIMEDOUT;
|
||||
|
||||
if ( iRet == 0 )
|
||||
{
|
||||
if( !CreateSocksFD() )
|
||||
{
|
||||
m_iDNSTryCount = 0;
|
||||
return ETIMEDOUT;
|
||||
}
|
||||
|
||||
if ( m_eConState != CST_OK )
|
||||
m_eConState = ( ( eDNSLType == DNS_VHOST ) ? CST_BINDVHOST : CST_CONNECT );
|
||||
m_iDNSTryCount = 0;
|
||||
|
||||
Reference in New Issue
Block a user