From: Otto Moerbeek Date: Thu, 14 Feb 2019 15:10:00 +0000 (+0100) Subject: Use dns_random() for generating the id of the notify message. X-Git-Tag: dnsdist-1.4.0-alpha1~54^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df136790a6984484937473f05fbfa73f23193958;p=pdns Use dns_random() for generating the id of the notify message. This does introduce a (conditional) dependency on libsodium. --- diff --git a/pdns/Makefile.am b/pdns/Makefile.am index 40030a515..f0acec88a 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -1058,7 +1058,8 @@ pdns_notify_SOURCES = \ rcpgenerator.cc rcpgenerator.hh \ sillyrecords.cc \ statbag.cc \ - unix_utility.cc + unix_utility.cc \ + dns_random.cc pdns_notify_LDFLAGS = \ $(AM_LDFLAGS) \ @@ -1069,6 +1070,10 @@ pdns_notify_LDADD = \ $(LIBCRYPTO_LIBS) \ $(BOOST_PROGRAM_OPTIONS_LIBS) +if LIBSODIUM +pdns_notify_LDADD += $(LIBSODIUM_LIBS) +endif + dnsscope_SOURCES = \ arguments.cc \ base32.cc \ diff --git a/pdns/notify.cc b/pdns/notify.cc index 92cb57ae7..2dc595bf0 100644 --- a/pdns/notify.cc +++ b/pdns/notify.cc @@ -24,6 +24,7 @@ #endif #include #include "dnsparser.hh" +#include "dns_random.hh" #include "iputils.hh" #include @@ -112,7 +113,7 @@ try } vector outpacket; DNSPacketWriter pw(outpacket, DNSName(argv[2]), QType::SOA, 1, Opcode::Notify); - pw.getHeader()->id = random(); + pw.getHeader()->id = dns_random(UINT16_MAX); if(send(sock, &outpacket[0], outpacket.size(), 0) < 0) { cerr<<"Unable to send notify to "<