From e505d47dc80f1eb302167c12618b170fcc0fd90c Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 1 Aug 2006 15:08:52 +0000 Subject: Fixes for inspsocket in ipv6 environment git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4615 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/dns.cpp | 2 +- src/inspsocket.cpp | 6 +++--- src/socket.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/dns.cpp b/src/dns.cpp index b294c71bf..177d76890 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -711,7 +711,7 @@ bool DNS::ReverseLookup(const std::string &ip, bool ins) if (ServerInstance && ServerInstance->stats) ServerInstance->stats->statsDns++; insp_inaddr binip; - if (insp_aton(ip.c_str(), &binip)) + if (insp_aton(ip.c_str(), &binip) < 0) { return false; } diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 054b8b910..20cde3a1a 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -99,7 +99,7 @@ InspSocket::InspSocket(const std::string &ahost, int aport, bool listening, unsi strlcpy(this->host,ahost.c_str(),MAXBUF); this->port = aport; - if (!insp_aton(host,&addy)) + if (insp_aton(host,&addy) < 0) { log(DEBUG,"Attempting to resolve %s",this->host); /* Its not an ip, spawn the resolver */ @@ -200,7 +200,7 @@ bool InspSocket::BindAddr() insp_sockaddr s; char resolved_addr[MAXBUF]; - if (!insp_aton(IP.c_str(),&n)) + if (insp_aton(IP.c_str(),&n) < 0) { /* If they gave a hostname, bind to the IP it resolves to */ log(DEBUG,"Resolving host %s",IP.c_str()); @@ -211,7 +211,7 @@ bool InspSocket::BindAddr() } } - if (insp_aton(IP.c_str(),&n)) + if (insp_aton(IP.c_str(),&n) == 0) { log(DEBUG,"Found an IP to bind to: %s",IP.c_str()); #ifdef IPV6 diff --git a/src/socket.cpp b/src/socket.cpp index 1b8455c65..e4c48dd0c 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -44,7 +44,7 @@ bool BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr server, int port if (*addr == '*') *addr = 0; - if (*addr && !insp_aton(addr,&addy)) + if (*addr && (insp_aton(addr,&addy) < 0)) { /* If they gave a hostname, bind to the IP it resolves to */ if (CleanAndResolve(resolved_addr, addr, true, 1)) @@ -278,5 +278,5 @@ const char* insp_ntoa(insp_inaddr n) int insp_aton(const char* a, insp_inaddr* n) { - return (inet_pton(AF_FAMILY, a, &n) < 0); + return inet_pton(AF_FAMILY, a, &n); } -- cgit v1.2.3