From: bert hubert Date: Sat, 22 Mar 2014 11:15:48 +0000 (+0100) Subject: No longer attempt to answer questions coming in from port 0, reply would not reach... X-Git-Tag: rec-3.6.0-rc1~114 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=81859ba591d7de51d45e48b4fe499b08e08c221b;p=thirdparty%2Fpdns.git No longer attempt to answer questions coming in from port 0, reply would not reach them anyhow. Thanks to Niels Bakker and sid3windr for insight & debugging. Closes #844. --- diff --git a/pdns/nameserver.cc b/pdns/nameserver.cc index 1ec2eab088..008844ee38 100644 --- a/pdns/nameserver.cc +++ b/pdns/nameserver.cc @@ -420,8 +420,12 @@ DNSPacket *UDPNameserver::receive(DNSPacket *prefilled) if(sock==-1) throw PDNSException("poll betrayed us! (should not happen)"); - DLOG(L<<"Received a packet " << len <<" bytes long from "<< remote.toString()< #include +#include #include #include #include "recursor_cache.hh" @@ -923,6 +924,14 @@ void handleNewUDPQuestion(int fd, FDMultiplexer::funcparam_t& var) g_stats.unauthorizedUDP++; return; } + BOOST_STATIC_ASSERT_MSG(offsetof(sockaddr_in, sin_port) == offsetof(sockaddr_in6, sin6_port), "IPv4 and IPv6 structs differ wrt port"); + if(!fromaddr.sin4.sin_port) { // also works for IPv6 + if(!g_quiet) + L<getTid()<<"] dropping UDP query from "<