]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldpd: fix timer initialization when checksum is 0
authorVincent Bernat <vincent@bernat.im>
Wed, 3 Dec 2014 21:05:34 +0000 (22:05 +0100)
committerVincent Bernat <vincent@bernat.im>
Wed, 3 Dec 2014 21:05:34 +0000 (22:05 +0100)
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

index 33cb90cad3a4688df84c3c23cd21abe7dbe7782a..4d2317a1ce8f5c02119716d8277c5c8dfbd8f337 100644 (file)
@@ -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",