++ Bugfixes:
+ 2012-08-13: Simon Goldschmidt
+ * dns.c: fixed bug #36899 DNS TTL 0 is cached for a long time
+
2012-05-11: Simon Goldschmidt (patch by Marty)
* memp.c: fixed bug #36412: memp.c does not compile when
MEMP_OVERFLOW_CHECK > zero and MEMP_SEPARATE_POOLS == 1
case DNS_STATE_DONE: {
/* if the time to live is nul */
- if (--pEntry->ttl == 0) {
+ 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;
if (pEntry->found) {
(*pEntry->found)(pEntry->name, &pEntry->ipaddr, pEntry->arg);
}
+ if (pEntry->ttl == 0) {
+ /* RFC 883, page 29: "Zero values are
+ interpreted to mean that the RR can only be used for the
+ transaction in progress, and should not be cached."
+ -> flush this entry now */
+ goto flushentry;
+ }
/* deallocate memory and return */
goto memerr;
} else {
if (pEntry->found) {
(*pEntry->found)(pEntry->name, NULL, pEntry->arg);
}
+flushentry:
/* flush this entry */
pEntry->state = DNS_STATE_UNUSED;
pEntry->found = NULL;