]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Fix bug in CDP packet generation: CDP version was always 1.
authorVincent Bernat <bernat@luffy.cx>
Tue, 7 Jul 2009 09:42:35 +0000 (11:42 +0200)
committerVincent Bernat <bernat@luffy.cx>
Wed, 30 Sep 2009 12:21:20 +0000 (14:21 +0200)
"(a && b) || c" gives 0 or 1, not b or c. Replace with a?b:c.

src/cdp.c

index 3febcb193be3345edfb9de1d02a955e476a3bec5..95cb6c876bba91ac0a90fd3f794241e7156c72a8 100644 (file)
--- a/src/cdp.c
+++ b/src/cdp.c
@@ -76,7 +76,7 @@ cdp_send(struct lldpd *global, struct lldpd_chassis *chassis,
        /* CDP header */
        if (!(
              POKE_SAVE(pos_cdp) &&
-             POKE_UINT8(((version == 0) && 1) || version) &&
+             POKE_UINT8((version == 0)?1:version) &&
              POKE_UINT8(chassis->c_ttl) &&
              POKE_SAVE(pos_checksum) && /* Save checksum position */
              POKE_UINT16(0)))