mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-26 03:16:18 +00:00
Fixed bug #36899 DNS TTL 0 is cached for a long time
This commit is contained in:
parent
a070751061
commit
556a2126b5
@ -80,6 +80,9 @@ HISTORY
|
||||
|
||||
++ 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
|
||||
|
@ -694,7 +694,7 @@ dns_check_entry(u8_t i)
|
||||
|
||||
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;
|
||||
@ -816,6 +816,13 @@ dns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t
|
||||
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 {
|
||||
@ -838,6 +845,7 @@ responseerr:
|
||||
if (pEntry->found) {
|
||||
(*pEntry->found)(pEntry->name, NULL, pEntry->arg);
|
||||
}
|
||||
flushentry:
|
||||
/* flush this entry */
|
||||
pEntry->state = DNS_STATE_UNUSED;
|
||||
pEntry->found = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user