From: Vincent Bernat Date: Wed, 3 Dec 2014 21:05:34 +0000 (+0100) Subject: lldpd: fix timer initialization when checksum is 0 X-Git-Tag: 0.7.13~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=280f28da51533399692867a74443a390b2264ee9;p=thirdparty%2Flldpd.git 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. --- 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",