]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Ignore interfaces with no queue.
authorVincent Bernat <bernat@luffy.cx>
Sun, 11 Apr 2010 12:53:32 +0000 (14:53 +0200)
committerVincent Bernat <bernat@luffy.cx>
Sun, 25 Apr 2010 10:26:37 +0000 (12:26 +0200)
This filters out vnet* interfaces and some others. It seems that
physical (real or virtual) interfaces always have a queue. We might
also check qdisc. If "noop", this means that the interface is a
blackhole and should be ignored. However, we wait for an actual
interface to exhibit a behaviour where such a detection is needed.

CHANGELOG
src/interfaces.c

index 2755ce75220708a0773c580f5965263693140759..702579fa2a5fb0bbe1189e358ac82919edadc2a0 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,6 +9,10 @@ lldpd (0.5.1)
       thanks to a patch from Jorge Boncompte.
     + Add a new output (keyvalue) for lldpctl.
 
+  * Fixes:
+    + Ignore interface with no queue. It should filter out interfaces
+      like "vnet0" that would fail if we try to send something on them.
+
 lldpd (0.5.0)
 
   * Features:
index 5192ee1fd3102ebe99cb924ce2f3b01f7d457676..5dbf3671e3f155081a433661a65d6926be339817 100644 (file)
@@ -397,6 +397,7 @@ static int
 iface_minimal_checks(struct lldpd *cfg, struct ifaddrs *ifa)
 {
        struct sockaddr_ll *sdl;
+       struct ifreq ifr;
        int is_bridge = iface_is_bridge(cfg, ifa->ifa_name);
 
        if (!(LOCAL_CHASSIS(cfg)->c_cap_enabled & LLDP_CAP_BRIDGE) &&
@@ -426,6 +427,13 @@ iface_minimal_checks(struct lldpd *cfg, struct ifaddrs *ifa)
        if (!(ifa->ifa_flags & (IFF_MULTICAST|IFF_BROADCAST)))
                return 0;
 
+       /* Check queue len. If no queue, this usually means that this
+          is not a "real" interface. */
+       memset(&ifr, 0, sizeof(ifr));
+       strcpy(ifr.ifr_name, ifa->ifa_name);
+       if ((ioctl(cfg->g_sock, SIOCGIFTXQLEN, &ifr) < 0) || !ifr.ifr_qlen)
+               return 0;
+
        /* Don't handle bond and VLAN, nor bridge  */
        if ((iface_is_vlan(cfg, ifa->ifa_name)) ||
            (iface_is_bond(cfg, ifa->ifa_name)) ||