]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
interfaces: don't use wireless extensions
authorVincent Bernat <vincent@bernat.ch>
Sun, 7 Apr 2024 10:37:22 +0000 (12:37 +0200)
committerVincent Bernat <vincent@bernat.ch>
Sun, 7 Apr 2024 10:41:14 +0000 (12:41 +0200)
Fix #579

README.md
src/daemon/interfaces-linux.c
src/daemon/netlink.c

index 6925a8ed7d2978ca64f70d6beb37e990bface987..0eba47911a51064862346773697cf06c036b8c19 100644 (file)
--- a/README.md
+++ b/README.md
@@ -252,10 +252,9 @@ More information:
 
 ## Compatibility with older kernels
 
-If you have a kernel older than Linux 2.6.39, you need to compile
-lldpd with `--enable-oldies` to enable some compatibility functions:
-otherwise, lldpd will only rely on Netlink to receive bridge, bond and
-VLAN information.
+If you have a kernel older than Linux 4.0, you need to compile lldpd with
+`--enable-oldies` to enable some compatibility functions: otherwise, lldpd will
+only rely on Netlink to receive wireless, bridge, bond and VLAN information.
 
 For bonding, you need 2.6.24 (in previous version, PACKET_ORIGDEV
 affected only non multicast packets). See:
index e764943a835fdb6d12122e68ccb1fa0de3f92a3a..099412a1276a6cda05c6bf16048566670ca1950f 100644 (file)
@@ -390,7 +390,7 @@ iflinux_get_permanent_mac(struct lldpd *cfg, struct interfaces_device_list *inte
 #ifdef ENABLE_DOT3
 #  define ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32 (SCHAR_MAX)
 #  define ETHTOOL_DECLARE_LINK_MODE_MASK(name) \
-    uint32_t name[ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32]
+         uint32_t name[ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32]
 
 struct ethtool_link_usettings {
        struct ethtool_link_settings base;
@@ -877,8 +877,12 @@ iflinux_add_driver(struct lldpd *cfg, struct interfaces_device_list *interfaces)
 static void
 iflinux_add_wireless(struct lldpd *cfg, struct interfaces_device_list *interfaces)
 {
+#ifdef ENABLE_OLDIES
        struct interfaces_device *iface;
        TAILQ_FOREACH (iface, interfaces, next) {
+               if (iface->type &
+                   (IFACE_VLAN_T | IFACE_BOND_T | IFACE_BRIDGE_T | IFACE_WIRELESS_T))
+                       continue;
                struct iwreq iwr = {};
                strlcpy(iwr.ifr_name, iface->name, IFNAMSIZ);
                if (ioctl(cfg->g_sock, SIOCGIWNAME, &iwr) >= 0) {
@@ -886,6 +890,7 @@ iflinux_add_wireless(struct lldpd *cfg, struct interfaces_device_list *interface
                        iface->type |= IFACE_WIRELESS_T | IFACE_PHYSICAL_T;
                }
        }
+#endif
 }
 
 /* Query each interface to see if it is a bridge */
index 32fee76382fe160d9bf969bcb87fefce7ec4ddf3..36c1cfd4908d39e37131fddcb29fe5c95dc7010f 100644 (file)
@@ -244,6 +244,10 @@ netlink_parse_linkinfo(struct interfaces_device *iff, struct rtattr *rta, int le
                                log_debug("netlink", "interface %s is a team",
                                    iff->name);
                                iff->type |= IFACE_BOND_T;
+                       } else if (!strcmp(kind, "wlan")) {
+                               log_debug("netlink", "interface %s is wireless",
+                                   iff->name);
+                               iff->type |= IFACE_WIRELESS_T | IFACE_PHYSICAL_T;
                        }
                }
        }