From 6afb24c220d85d840e7eef382dbdaeac74452b25 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 11 May 2014 16:17:42 +0200 Subject: [PATCH] lldp: fix handling of LLDPDU expiration Expiration logic for LLDPDU was totally flawed after the change to support shutdown LLDPDU. Any LLDPDU would trigger infinite expiration. Fix that. --- src/daemon/event.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/daemon/event.c b/src/daemon/event.c index 45919371..8f312487 100644 --- a/src/daemon/event.c +++ b/src/daemon/event.c @@ -692,8 +692,10 @@ levent_schedule_cleanup(struct lldpd *cfg) struct lldpd_port *port; TAILQ_FOREACH(hardware, &cfg->g_hardware, h_entries) { TAILQ_FOREACH(port, &hardware->h_rports, p_entries) { - if (now + port->p_chassis->c_ttl >= port->p_lastupdate) { + if (now >= port->p_lastupdate + port->p_chassis->c_ttl) { tv.tv_sec = 0; + log_debug("event", "immediate cleanup on port %s (%ld, %d, %ld)", + hardware->h_ifname, now, port->p_chassis->c_ttl, port->p_lastupdate); break; } next = port->p_chassis->c_ttl - (now - port->p_lastupdate); -- 2.47.2