summaryrefslogtreecommitdiff
path: root/src/dns.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-09-17 19:20:07 -0400
committerAdam <Adam@anope.org>2010-09-17 19:20:07 -0400
commit227909e2cf0039737dc52872651837fe5f1702b5 (patch)
treeb8a7072c7d938ea66d9710a48d717b3eb76343de /src/dns.cpp
parentf71fb6e8133da955a58b1cca00013ce20c0b65cc (diff)
Rejig of some of the socket stuff. Fixed marking sockets as nonblocking on Windows. Added in a LastError function to keep having to use strerror/GetLastError everywhere.
Diffstat (limited to 'src/dns.cpp')
-rw-r--r--src/dns.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index c613dc776..509bd877f 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -77,7 +77,7 @@ bool DNSPacket::AddQuestion(const Anope::string &name, const QueryType qt)
in6_addr ip;
if (!inet_pton(AF_INET6, working_name.c_str(), &ip))
{
- Log(LOG_DEBUG_2) << "Resolver: Received an invalid IP for PTR lookup (" << working_name << "): " << strerror(errno);
+ Log(LOG_DEBUG_2) << "Resolver: Received an invalid IP for PTR lookup (" << working_name << "): " << Anope::LastError();
return false;
}
@@ -102,14 +102,14 @@ bool DNSPacket::AddQuestion(const Anope::string &name, const QueryType qt)
in_addr ip;
if (!inet_pton(AF_INET, working_name.c_str(), &ip))
{
- Log(LOG_DEBUG_2) << "Resolver: Received an invalid IP for PTR lookup (" << working_name << "): " << strerror(errno);
+ Log(LOG_DEBUG_2) << "Resolver: Received an invalid IP for PTR lookup (" << working_name << "): " << Anope::LastError();
return false;
}
unsigned long reverse_ip = ((ip.s_addr & 0xFF) << 24) | ((ip.s_addr & 0xFF00) << 8) | ((ip.s_addr & 0xFF0000) >> 8) | ((ip.s_addr & 0xFF000000) >> 24);
char ipbuf[INET_ADDRSTRLEN];
if (!inet_ntop(AF_INET, &reverse_ip, ipbuf, sizeof(ipbuf)))
{
- Log(LOG_DEBUG_2) << "Resolver: Reformatted IP " << working_name << " back into an invalid IP: " << strerror(errno);
+ Log(LOG_DEBUG_2) << "Resolver: Reformatted IP " << working_name << " back into an invalid IP: " << Anope::LastError();
return false;
}
@@ -197,7 +197,7 @@ inline DNSRecord::DNSRecord()
this->created = Anope::CurTime;
}
-DNSSocket::DNSSocket(const Anope::string &nTargetHost, int nPort) : ClientSocket(nTargetHost, nPort, "", false, SOCK_DGRAM)
+DNSSocket::DNSSocket(const Anope::string &TargetHost, int Port) : ClientSocket(TargetHost, Port, "", false, SOCK_DGRAM)
{
this->server_addr.pton(AF_INET, TargetHost, Port);
}
@@ -370,8 +370,8 @@ bool DNSSocket::ProcessRead()
char ipbuf[INET_ADDRSTRLEN];
if (!inet_ntop(AF_INET, &ip, ipbuf, sizeof(ipbuf)))
{
- Log(LOG_DEBUG_2) << "Resolver: Received an invalid IP for DNS_QUERY_A: " << strerror(errno);
- request->OnError(DNS_ERROR_FORMAT_ERROR, "Received an invalid IP from the nameserver: " + stringify(strerror(errno)));
+ Log(LOG_DEBUG_2) << "Resolver: Received an invalid IP for DNS_QUERY_A: " << Anope::LastError();
+ request->OnError(DNS_ERROR_FORMAT_ERROR, "Received an invalid IP from the nameserver: " + Anope::LastError());
delete rr;
rr = NULL;
}
@@ -389,8 +389,8 @@ bool DNSSocket::ProcessRead()
char ipbuf[INET6_ADDRSTRLEN];
if (!inet_ntop(AF_INET6, &ip, ipbuf, sizeof(ipbuf)))
{
- Log(LOG_DEBUG_2) << "Resolver: Received an invalid IP for DNS_QUERY_A: " << strerror(errno);
- request->OnError(DNS_ERROR_FORMAT_ERROR, "Received an invalid IP from the nameserver: " + stringify(strerror(errno)));
+ Log(LOG_DEBUG_2) << "Resolver: Received an invalid IP for DNS_QUERY_A: " << Anope::LastError();
+ request->OnError(DNS_ERROR_FORMAT_ERROR, "Received an invalid IP from the nameserver: " + Anope::LastError());
delete rr;
rr = NULL;
}