[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #36899] DNS TTL 0 is cached for a long time
From: |
Måns Andersson |
Subject: |
[lwip-devel] [bug #36899] DNS TTL 0 is cached for a long time |
Date: |
Fri, 20 Jul 2012 10:44:54 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11 |
URL:
<http://savannah.nongnu.org/bugs/?36899>
Summary: DNS TTL 0 is cached for a long time
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: mansandersson
Submitted on: Fri 20 Jul 2012 10:44:53 AM GMT
Category: None
Severity: 3 - Normal
Item Group: Faulty Behaviour
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release:
lwIP version: 1.4.0
_______________________________________________________
Details:
I'm using lwip 1.4.0 with an opendns.com dns server. When OpenDNS can't
resolve
a host they return an ip address pointing to one of their own servers together
with a TTL of 0. When this happens lwip caches it for DNS_MAX_TTL seconds
rather than throwing it away. I suggest we change the code the following way:
dns.c:695 (dns_check_entry() state DNS_STATE_DONE)
case DNS_STATE_DONE: {
/* if the time to live is nul */
if (--pEntry->ttl == 0) {
LWIP_DEBUGF(DNS_DEBUG, ("dns_check_entry: \"%s\": flush\n",
pEntry->name));
/* flush this entry */
pEntry->state = DNS_STATE_UNUSED;
pEntry->found = NULL;
}
break;
}
to
case DNS_STATE_DONE: {
/* if the time to live is nul */
if (pEntry->ttl == 0 || --pEntry->ttl == 0) {
LWIP_DEBUGF(DNS_DEBUG, ("dns_check_entry: \"%s\": flush\n",
pEntry->name));
/* flush this entry */
pEntry->state = DNS_STATE_UNUSED;
pEntry->found = NULL;
}
break;
}
By doing this we make sure that the u32 ttl variable does not tip over (ie.
--0
== INT_MAX when we have an unsigned variable) and that we throw away any cache
that has reached 0 in some way.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?36899>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-devel] [bug #36899] DNS TTL 0 is cached for a long time,
Måns Andersson <=