From 745d040b814cade77d847945a8e3f87d37ac09f3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 13 Feb 2017 08:43:27 +0100 Subject: [PATCH] Set TTL to the new value when updating cached service entry MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In the simplest case host may change TTL to some different value. It's the most important for the goodbye packets though. Consider situation when host (for which we have no no cached entries) restarts. First it sends goodbye with TTL 0 (we cache it), then seconds later it announces with standard TTL values (but we keep TTL 0). It results in wrong cache state and could cause dropping valid entries. Signed-off-by: Rafał Miłecki Acked-by: John Crispin --- cache.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cache.c b/cache.c index fa32465..6bf0d26 100644 --- a/cache.c +++ b/cache.c @@ -143,6 +143,7 @@ cache_service(struct interface *iface, char *entry, int hlen, int ttl) if (!strcmp(s->entry, entry)) { s->refresh = 50; s->time = monotonic_time(); + s->ttl = ttl; return s; } -- 2.11.0