From 389ec9d4649b3b1f5741b2bc04ca45cd15527166 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 7 Apr 2024 12:37:22 +0200 Subject: [PATCH] interfaces: don't use wireless extensions Fix #579 --- README.md | 7 +++---- src/daemon/interfaces-linux.c | 7 ++++++- src/daemon/netlink.c | 4 ++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6925a8ed..0eba4791 100644 --- 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: diff --git a/src/daemon/interfaces-linux.c b/src/daemon/interfaces-linux.c index e764943a..099412a1 100644 --- a/src/daemon/interfaces-linux.c +++ b/src/daemon/interfaces-linux.c @@ -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 */ diff --git a/src/daemon/netlink.c b/src/daemon/netlink.c index 32fee763..36c1cfd4 100644 --- a/src/daemon/netlink.c +++ b/src/daemon/netlink.c @@ -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; } } } -- 2.39.5