From: Vincent Bernat Date: Sun, 11 May 2014 14:17:42 +0000 (+0200) Subject: lldp: fix handling of LLDPDU expiration X-Git-Tag: 0.7.9~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6afb24c220d85d840e7eef382dbdaeac74452b25;p=thirdparty%2Flldpd.git 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. --- 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);