]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldp: fix handling of LLDPDU expiration
authorVincent Bernat <vincent@bernat.im>
Sun, 11 May 2014 14:17:42 +0000 (16:17 +0200)
committerVincent Bernat <vincent@bernat.im>
Sun, 11 May 2014 14:17:42 +0000 (16:17 +0200)
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

index 45919371fcb2a2acdfcdd699e8a5e045cb3aed5d..8f3124876b9ef36a63e1eddea7f80db9ab10ade3 100644 (file)
@@ -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);