From: Bert Hubert Date: Mon, 9 Jun 2008 09:19:52 +0000 (+0000) Subject: forgot to commit this one - use dns_random() in more places X-Git-Tag: rec-3.1.7.1~53 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=afbc704a547fa450756fcf62b67480acd242b194;p=pdns forgot to commit this one - use dns_random() in more places git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1188 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/resolver.cc b/pdns/resolver.cc index 9feed614f..cff098bca 100644 --- a/pdns/resolver.cc +++ b/pdns/resolver.cc @@ -1,6 +1,6 @@ /* PowerDNS Versatile Database Driven Nameserver - Copyright (C) 2002 - 2007 PowerDNS.COM BV + Copyright (C) 2002 - 2008 PowerDNS.COM BV This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as @@ -37,6 +37,7 @@ #include "dnswriter.hh" #include "dnsparser.hh" #include +#include "dns_random.hh" using namespace boost; @@ -65,7 +66,7 @@ void Resolver::makeSocket(int type) int tries=10; while(--tries) { - sin.sin_port = htons(10000+(random()%10000)); + sin.sin_port = htons(10000+(dns_random(10000))); if (bind(d_sock, (struct sockaddr *)&sin, sizeof(sin)) >= 0) break; @@ -153,7 +154,7 @@ void Resolver::sendResolve(const string &ip, const char *domain, int type) { vector packet; DNSPacketWriter pw(packet, domain, type); - pw.getHeader()->id = d_randomid = random(); + pw.getHeader()->id = d_randomid = dns_random(0xffff); d_domain=domain; d_type=type; @@ -300,7 +301,7 @@ int Resolver::axfr(const string &ip, const char *domain) vector packet; DNSPacketWriter pw(packet, domain, QType::AXFR); - pw.getHeader()->id = d_randomid = random(); + pw.getHeader()->id = d_randomid = dns_random(0xffff); uint16_t replen=htons(packet.size()); Utility::iovec iov[2];