From 61920317feafc11ad6aac06ba82f96d72e5eb106 Mon Sep 17 00:00:00 2001 From: prozacx Date: Sat, 11 Feb 2006 09:44:31 +0000 Subject: [PATCH] Pulled in ipv6 bug fixes git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@637 726aef4b-f618-498e-8847-2d620e286838 --- Csocket.cpp | 12 +++++++++--- Csocket.h | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Csocket.cpp b/Csocket.cpp index e1341f77..1fcacbfb 100644 --- a/Csocket.cpp +++ b/Csocket.cpp @@ -69,10 +69,13 @@ int GetHostByName6( const CS_STRING & sHostName, in6_addr * paddr, u_int iNumRet iReturn = HOST_NOT_FOUND; #else hent = gethostbyname2( sHostName.c_str(), AF_INET6 ); - PERROR( "gethostbyname" ); if ( hent ) iReturn = 0; + else + { + PERROR( "gethostbyname2" ); + } #endif /* __linux__ */ @@ -110,10 +113,13 @@ int GetHostByName( const CS_STRING & sHostName, in_addr * paddr, u_int iNumRetri iReturn = HOST_NOT_FOUND; #else hent = gethostbyname( sHostName.c_str() ); - PERROR( "gethostbyname" ); if ( hent ) iReturn = 0; + else + { + PERROR( "gethostbyname" ); + } #endif /* __linux__ */ @@ -1862,7 +1868,7 @@ int Csock::DNSLookup( EDNSLType eDNSLType ) #ifdef HAVE_IPV6 else { - iRet = GetHostByName6( m_shostname, m_bindhost.GetAddr6(), 1 ); + iRet = GetHostByName6( m_shostname, m_address.GetAddr6(), 1 ); } #endif /* HAVE_IPV6 */ } diff --git a/Csocket.h b/Csocket.h index 077e8c23..f246f5df 100644 --- a/Csocket.h +++ b/Csocket.h @@ -95,7 +95,7 @@ #ifndef CS_DEBUG #ifdef __DEBUG__ -# define CS_DEBUG( f ) std::cerr << __FILE__ << ":" << __LINE__ << " " << f << endl +# define CS_DEBUG( f ) std::cerr << __FILE__ << ":" << __LINE__ << " " << f << std::endl #else # define CS_DEBUG(f) (void)0 #endif /* __DEBUG__ */ @@ -125,7 +125,7 @@ public: m_bIsIPv6 = false; memset( (struct sockaddr_in *)&m_saddr, '\0', sizeof( m_saddr ) ); #ifdef HAVE_IPV6 - memset( (struct sockaddr_in6 *)&m_saddr, '\0', sizeof( m_saddr6 ) ); + memset( (struct sockaddr_in6 *)&m_saddr6, '\0', sizeof( m_saddr6 ) ); #endif /* HAVE_IPV6 */ } virtual ~CSSockAddr() {}