From 8db957dfbfb17f662973cfa431107b34a95b9c46 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Tue, 17 Dec 2013 15:47:10 +0000 Subject: [PATCH 1/5] Fix endless loop with some bogu-nxdomain. Another F_CONFIG botch. --- CHANGELOG | 3 +++ src/rfc1035.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 39dbe17..cbb9420 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,9 @@ version 2.69 on the BSD platform. Thanks to Matthias Andree for valuable research on how to implement this. + Fix infinite loop associated with some --bogus-nxdomain + configs. Thanks forgobogo for the bug report. + version 2.68 Use random addresses for DHCPv6 temporary address diff --git a/src/rfc1035.c b/src/rfc1035.c index 9fdba05..c120d55 100644 --- a/src/rfc1035.c +++ b/src/rfc1035.c @@ -1283,7 +1283,7 @@ int check_for_bogus_wildcard(struct dns_header *header, size_t qlen, char *name, /* Found a bogus address. Insert that info here, since there no SOA record to get the ttl from in the normal processing */ cache_start_insert(); - cache_insert(name, NULL, now, ttl, F_IPV4 | F_FORWARD | F_NEG | F_NXDOMAIN | F_CONFIG); + cache_insert(name, NULL, now, ttl, F_IPV4 | F_FORWARD | F_NEG | F_NXDOMAIN); cache_end_insert(); return 1; From 76ff440ebe76ff516bf44ee1e110d1836783de0a Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Tue, 17 Dec 2013 16:29:14 +0000 Subject: [PATCH 2/5] Ignore ",," in dhcp-host, rather than treating it as ",0," --- src/option.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/option.c b/src/option.c index 06031d8..8716208 100644 --- a/src/option.c +++ b/src/option.c @@ -2732,7 +2732,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma else { char *cp, *lastp = NULL, last = 0; - int fac = 1; + int fac = 1, isdig = 0; if (strlen(a[j]) > 1) { @@ -2763,9 +2763,11 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma } for (cp = a[j]; *cp; cp++) - if (!isdigit((unsigned char)*cp) && *cp != ' ') + if (isdigit((unsigned char)*cp)) + isdig = 1; + else if (*cp != ' ') break; - + if (*cp) { if (lastp) @@ -2787,7 +2789,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma new->domain = strip_hostname(new->hostname); } } - else + else if (isdig) { new->lease_time = atoi(a[j]) * fac; /* Leases of a minute or less confuse From 875b8160f6a972a427969738667bc80d424fe6ed Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Tue, 17 Dec 2013 17:40:32 +0000 Subject: [PATCH 3/5] Remove unused code. --- src/dnsmasq.h | 2 +- src/slaac.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/dnsmasq.h b/src/dnsmasq.h index 8bd3ddf..724efde 100644 --- a/src/dnsmasq.h +++ b/src/dnsmasq.h @@ -561,7 +561,7 @@ struct dhcp_lease { struct in6_addr addr6; int iaid; struct slaac_address { - struct in6_addr addr, local; + struct in6_addr addr; time_t ping_time; int backoff; /* zero -> confirmed */ struct slaac_address *next; diff --git a/src/slaac.c b/src/slaac.c index 43c2c38..7eb4236 100644 --- a/src/slaac.c +++ b/src/slaac.c @@ -93,7 +93,6 @@ void slaac_add_addrs(struct dhcp_lease *lease, time_t now, int force) slaac->ping_time = now; slaac->backoff = 1; slaac->addr = addr; - slaac->local = context->local6; /* Do RA's to prod it */ ra_start_unsolicted(now, context); } From 74e6b5201187b8955e347de270b0ae9fff963e69 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Tue, 17 Dec 2013 21:33:53 +0000 Subject: [PATCH 4/5] Typo in contributor name. Sorry. --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index cbb9420..785eea4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,7 +5,7 @@ version 2.69 valuable research on how to implement this. Fix infinite loop associated with some --bogus-nxdomain - configs. Thanks forgobogo for the bug report. + configs. Thanks fogobogo for the bug report. version 2.68 From 00238fb019988c6e35e1dd411c0118bf56d18d25 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Wed, 18 Dec 2013 13:24:12 +0000 Subject: [PATCH 5/5] indentation fix. --- src/dhcp-common.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dhcp-common.c b/src/dhcp-common.c index a92d728..3f9979e 100644 --- a/src/dhcp-common.c +++ b/src/dhcp-common.c @@ -399,13 +399,13 @@ void dhcp_update_configs(struct dhcp_config *configs) if (cache_find_by_name(crec, config->hostname, 0, cacheflags)) { /* use primary (first) address */ - while (crec && !(crec->flags & F_REVERSE)) - crec = cache_find_by_name(crec, config->hostname, 0, cacheflags); - if (!crec) - continue; /* should be never */ - inet_ntop(prot, &crec->addr.addr, daemon->addrbuff, ADDRSTRLEN); - my_syslog(MS_DHCP | LOG_WARNING, _("%s has more than one address in hostsfile, using %s for DHCP"), - config->hostname, daemon->addrbuff); + while (crec && !(crec->flags & F_REVERSE)) + crec = cache_find_by_name(crec, config->hostname, 0, cacheflags); + if (!crec) + continue; /* should be never */ + inet_ntop(prot, &crec->addr.addr, daemon->addrbuff, ADDRSTRLEN); + my_syslog(MS_DHCP | LOG_WARNING, _("%s has more than one address in hostsfile, using %s for DHCP"), + config->hostname, daemon->addrbuff); } if (prot == AF_INET &&