]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
interfaces: correctly detect link down interfaces
authorVincent Bernat <bernat@luffy.cx>
Sun, 30 Dec 2012 11:22:21 +0000 (12:22 +0100)
committerVincent Bernat <bernat@luffy.cx>
Sun, 30 Dec 2012 11:28:02 +0000 (12:28 +0100)
An interface can be administratively up and operationally down. Handle
this as a down interface.

src/daemon/interfaces-bsd.c
src/daemon/netlink.c

index d22153a2a6e0a792ca390f58622a4ced1968347e..c157aa2cbee7c184cff6d24a512ca06142286d12 100644 (file)
@@ -336,7 +336,7 @@ ifbsd_extract(struct lldpd *cfg,
        struct interfaces_device *device = NULL;
        if (!ifaddr->ifa_name) return;
        if (!ifaddr->ifa_addr) return;
-       if (!(ifaddr->ifa_flags & IFF_UP)) {
+       if (!((ifaddr->ifa_flags & IFF_UP) && (ifaddr->ifa_flags & IFF_RUNNING))) {
                log_debug("interfaces",
                    "skip %s: down", ifaddr->ifa_name);
                return;
index 12006f64f2b42d9e9b23c051d18e5ab3346da25e..439483ceb02dbdea1cc43e7dedcfca924d57831e 100644 (file)
@@ -131,7 +131,7 @@ netlink_parse_link(struct nlmsghdr *msg,
     ifi = NLMSG_DATA(msg);
     len = msg->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifinfomsg));
 
-    if (!(ifi->ifi_flags & IFF_UP)) {
+    if (!((ifi->ifi_flags & IFF_UP) && (ifi->ifi_flags & IFF_RUNNING))) {
         log_debug("netlink", "skip down interface at index %d",
           ifi->ifi_index);
         return -1;