"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/loop.c" between
dnsmasq-2.84.tar.xz and dnsmasq-2.85.tar.xz

About: Dnsmasq is a lightweight caching DNS forwarder and DHCP server.

loop.c  (dnsmasq-2.84.tar.xz):loop.c  (dnsmasq-2.85.tar.xz)
skipping to change at line 25 skipping to change at line 25
*/ */
#include "dnsmasq.h" #include "dnsmasq.h"
#ifdef HAVE_LOOP #ifdef HAVE_LOOP
static ssize_t loop_make_probe(u32 uid); static ssize_t loop_make_probe(u32 uid);
void loop_send_probes() void loop_send_probes()
{ {
struct server *serv; struct server *serv;
struct randfd_list *rfds = NULL;
if (!option_bool(OPT_LOOP_DETECT)) if (!option_bool(OPT_LOOP_DETECT))
return; return;
/* Loop through all upstream servers not for particular domains, and send a q uery to that server which is /* Loop through all upstream servers not for particular domains, and send a q uery to that server which is
identifiable, via the uid. If we see that query back again, then the serve r is looping, and we should not use it. */ identifiable, via the uid. If we see that query back again, then the serve r is looping, and we should not use it. */
for (serv = daemon->servers; serv; serv = serv->next) for (serv = daemon->servers; serv; serv = serv->next)
if (!(serv->flags & if (!(serv->flags &
(SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_RESOLV | SERV_NO_REBIN D | SERV_HAS_DOMAIN | SERV_FOR_NODOTS | SERV_LOOP))) (SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_RESOLV | SERV_NO_REBIN D | SERV_HAS_DOMAIN | SERV_FOR_NODOTS | SERV_LOOP)))
{ {
ssize_t len = loop_make_probe(serv->uid); ssize_t len = loop_make_probe(serv->uid);
int fd; int fd;
struct randfd *rfd = NULL;
if (serv->sfd) if ((fd = allocate_rfd(&rfds, serv)) == -1)
fd = serv->sfd->fd; continue;
else
{
if (!(rfd = allocate_rfd(serv->addr.sa.sa_family)))
continue;
fd = rfd->fd;
}
while (retry_send(sendto(fd, daemon->packet, len, 0, while (retry_send(sendto(fd, daemon->packet, len, 0,
&serv->addr.sa, sa_len(&serv->addr)))); &serv->addr.sa, sa_len(&serv->addr))));
free_rfd(rfd);
} }
free_rfds(&rfds);
} }
static ssize_t loop_make_probe(u32 uid) static ssize_t loop_make_probe(u32 uid)
{ {
struct dns_header *header = (struct dns_header *)daemon->packet; struct dns_header *header = (struct dns_header *)daemon->packet;
unsigned char *p = (unsigned char *)(header+1); unsigned char *p = (unsigned char *)(header+1);
/* packet buffer overwritten */ /* packet buffer overwritten */
daemon->srv_save = NULL; daemon->srv_save = NULL;
 End of changes. 5 change blocks. 
11 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)