]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldp: clear station bit if any other capability is enabled
authorSteven Webster <steven.webster@windriver.com>
Tue, 20 Jun 2017 20:04:38 +0000 (16:04 -0400)
committerVincent Bernat <vincent@bernat.im>
Tue, 11 Jul 2017 17:16:47 +0000 (19:16 +0200)
The 801.1AB spec states that the station only capability should
not be set in conjunction with any other (capability) bits.

It is possible for the lldpd interface update routine to set the
station bit, while the lldpd chassis update routine may, at a later
time, set the router capability bit. In this case the station bit
is not cleared.

This commit clears the station bit if any other capability is set.

src/daemon/lldpd.c

index 8a564cba5fedd6d60f532b85265d5ef80033151a..97df38ed26e147a1c40b32d3ac5f2932609eadb4 100644 (file)
@@ -1159,6 +1159,8 @@ lldpd_update_localchassis(struct lldpd *cfg)
        if ((LOCAL_CHASSIS(cfg)->c_cap_available & LLDP_CAP_STATION) &&
                (LOCAL_CHASSIS(cfg)->c_cap_enabled == 0))
                LOCAL_CHASSIS(cfg)->c_cap_enabled = LLDP_CAP_STATION;
+       else if (LOCAL_CHASSIS(cfg)->c_cap_enabled != LLDP_CAP_STATION)
+               LOCAL_CHASSIS(cfg)->c_cap_enabled &= ~LLDP_CAP_STATION;
 
        /* Set chassis ID if needed. This is only done if chassis ID
           has not been set previously (with the MAC address of an