public inbox for wireguard@lists.zx2c4.com
 help / color / mirror / Atom feed
From: "Asbjørn Sloth Tønnesen" <ast@fiberby.net>
To: "Jason A . Donenfeld" <Jason@zx2c4.com>
Cc: "Asbjørn Sloth Tønnesen" <ast@fiberby.net>, wireguard@lists.zx2c4.com
Subject: [PATCH wireguard-tools v3 3/3] ipc: linux: remove user-space netdevice filtering
Date: Fri, 30 Jan 2026 19:10:55 +0000	[thread overview]
Message-ID: <20260130191058.5123-4-ast@fiberby.net> (raw)
In-Reply-To: <20260130191058.5123-1-ast@fiberby.net>

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@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


  parent reply	other threads:[~2026-01-30 19:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30 19:10 [PATCH wireguard-tools v3 0/3] ipc: linux: kernel-side netdevice filtering Asbjørn Sloth Tønnesen
2026-01-30 19:10 ` [PATCH wireguard-tools v3 1/3] ipc: linux: filter netdevices kernel-side Asbjørn Sloth Tønnesen
2026-01-30 19:10 ` [PATCH wireguard-tools v3 2/3] ipc: linux: skip statistics on netdevice listing Asbjørn Sloth Tønnesen
2026-01-30 19:10 ` Asbjørn Sloth Tønnesen [this message]
2026-03-11 23:02 ` [PATCH wireguard-tools v3 0/3] ipc: linux: kernel-side netdevice filtering Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260130191058.5123-4-ast@fiberby.net \
    --to=ast@fiberby.net \
    --cc=Jason@zx2c4.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox