[PATCH wireguard-tools v3 3/3] ipc: linux: remove user-space netdevice filtering
Asbjørn Sloth Tønnesen
ast at fiberby.net
Fri Jan 30 19:10:55 UTC 2026
As devices are now filtered kernel-side, then we can remove
the code for filtering in user-space.
This breaks device listing for kernels earlier than Linux v4.6,
device-specific commands will continue to work.
As the minimum kernel version for wireguard-tools is unclear, it's
unclear if the user-space filtering can be removed yet.
Signed-off-by: Asbjørn Sloth Tønnesen <ast at fiberby.net>
---
src/ipc-linux.h | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/src/ipc-linux.h b/src/ipc-linux.h
index 61e2c1a..639fb00 100644
--- a/src/ipc-linux.h
+++ b/src/ipc-linux.h
@@ -29,25 +29,13 @@
struct interface {
const char *name;
- bool is_wireguard;
};
-static int parse_linkinfo(const struct nlattr *attr, void *data)
-{
- struct interface *interface = data;
-
- if (mnl_attr_get_type(attr) == IFLA_INFO_KIND && !strcmp(WG_GENL_NAME, mnl_attr_get_str(attr)))
- interface->is_wireguard = true;
- return MNL_CB_OK;
-}
-
static int parse_infomsg(const struct nlattr *attr, void *data)
{
struct interface *interface = data;
- if (mnl_attr_get_type(attr) == IFLA_LINKINFO)
- return mnl_attr_parse_nested(attr, parse_linkinfo, data);
- else if (mnl_attr_get_type(attr) == IFLA_IFNAME)
+ if (mnl_attr_get_type(attr) == IFLA_IFNAME)
interface->name = mnl_attr_get_str(attr);
return MNL_CB_OK;
}
@@ -61,7 +49,7 @@ static int read_devices_cb(const struct nlmsghdr *nlh, void *data)
ret = mnl_attr_parse(nlh, sizeof(struct ifinfomsg), parse_infomsg, &interface);
if (ret != MNL_CB_OK)
return ret;
- if (interface.name && interface.is_wireguard)
+ if (interface.name)
ret = string_list_add(list, interface.name);
if (ret < 0)
return ret;
--
2.51.0
More information about the WireGuard
mailing list