From: bert hubert Date: Tue, 11 Jun 2013 14:33:39 +0000 (+0200) Subject: add IPv6 support to dnstcpbench (for shame) X-Git-Tag: rec-3.6.0-rc1~680 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=682549f2f513007bc6bd324c0b086463a1d76a80;p=thirdparty%2Fpdns.git add IPv6 support to dnstcpbench (for shame) --- diff --git a/pdns/dnstcpbench.cc b/pdns/dnstcpbench.cc index ce0f7cd7b5..d61a9a204d 100644 --- a/pdns/dnstcpbench.cc +++ b/pdns/dnstcpbench.cc @@ -26,7 +26,7 @@ try string reply; if(!g_onlyTCP) { - Socket udpsock(InterNetwork, Datagram); + Socket udpsock((AddressFamily)dest.sin4.sin_family, Datagram); udpsock.sendTo(string((char*)&*packet.begin(), (char*)&*packet.end()), dest); ComboAddress origin; @@ -45,7 +45,7 @@ try g_truncates++; } - Socket sock(InterNetwork, Stream); + Socket sock((AddressFamily)dest.sin4.sin_family, Stream); int tmp=1; if(setsockopt(sock.getHandle(),SOL_SOCKET,SO_REUSEADDR,(char*)&tmp,sizeof tmp)<0) throw runtime_error("Unable to set socket reuse: "+string(strerror(errno))); @@ -103,6 +103,7 @@ catch(...) If a worker reaches the end of its queue, it stops */ AtomicCounter g_pos; + struct Query { Query(const std::string& qname_, uint16_t qtype_) : qname(qname_), qtype(qtype_) {} @@ -114,7 +115,7 @@ struct Query vector g_queries; ComboAddress g_dest; -void* worker(void*) +static void* worker(void*) { Query q; for(;;) { diff --git a/pdns/docs/dnstcpbench.1.txt b/pdns/docs/dnstcpbench.1.txt index a778d93658..8758e8ac93 100644 --- a/pdns/docs/dnstcpbench.1.txt +++ b/pdns/docs/dnstcpbench.1.txt @@ -27,6 +27,8 @@ performed by running: # echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle +The equivalent for IPv6 is not known. + OPTIONS ------- @@ -46,14 +48,14 @@ OPTIONS --help:: Provide a helpful message +Remote IP address can be IPv4 or IPv6. Remote port defaults to 53. + BUGS ---- Currently the timeout code does not actually perform non-blocking connects or writes. So a slow connect or slow writes will still cause low performance and delays. -Does not yet support IPv6 testing. - AUTHOR ------ Written by PowerDNS.COM BV, bert hubert,