]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldpd: decrease probability of collisions on port checksums
authorVincent Bernat <vincent@bernat.im>
Wed, 3 Dec 2014 23:56:51 +0000 (00:56 +0100)
committerVincent Bernat <vincent@bernat.im>
Wed, 3 Dec 2014 23:56:51 +0000 (00:56 +0100)
Instead of wasting a whole bit (getting 2**15 valid values), just waste
one special value (2**16-1 valid values).

src/daemon/lldpd.c

index dfbce73ca7c3e93c2fd81c7fd7bbd62ef2267d05..8de5187b4fa1a7112c06546bd0f383f2c89ccec0 100644 (file)
@@ -315,7 +315,7 @@ lldpd_reset_timer(struct lldpd *cfg)
                /* 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;
+               cksum  = cksum?cksum:1;
                free(output);
                if (cksum != hardware->h_lport_cksum) {
                        log_debug("localchassis",