From 280f28da51533399692867a74443a390b2264ee9 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Wed, 3 Dec 2014 22:05:34 +0100 Subject: [PATCH] lldpd: fix timer initialization when checksum is 0 If the checksum computed over the port happens to be 0, the LLDPDU is never scheduled for emission on this port. We ensure that a computed checksum is never 0. If two different ports happen to have the same checksum, we consider it unlikely enough to bear with the fact that the timer will not be reset in this case. --- src/daemon/lldpd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/daemon/lldpd.c b/src/daemon/lldpd.c index 33cb90ca..4d2317a1 100644 --- a/src/daemon/lldpd.c +++ b/src/daemon/lldpd.c @@ -312,7 +312,10 @@ lldpd_reset_timer(struct lldpd *cfg) hardware->h_ifname); continue; } - cksum = frame_checksum(output, output_len, 0); + /* Port change is detected by computing a checksum. 0 means the + * checksum never was computed (new interface). */ + cksum = frame_checksum(output, output_len, 0); + cksum &= 1; free(output); if (cksum != hardware->h_lport_cksum) { log_debug("localchassis", -- 2.47.2