* [PATCH wireguard] wireguard: prevent ipv6 addrconf via IFF_NO_ADDRCONF flag
@ 2026-02-08 17:05 Valentin Spreckels
2026-03-11 22:59 ` Jason A. Donenfeld
0 siblings, 1 reply; 5+ messages in thread
From: Valentin Spreckels @ 2026-02-08 17:05 UTC (permalink / raw)
To: Jason A. Donenfeld
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, wireguard, netdev, linux-kernel, Valentin Spreckels
Use the flag introduced in commit 8a321cf7becc6 ("net: add
IFF_NO_ADDRCONF and use it in bonding to prevent ipv6 addrconf")
instead of mangling the addr_gen_mode to prevent ipv6 addrconf.
Signed-off-by: Valentin Spreckels <valentin@spreckels.dev>
---
drivers/net/wireguard/device.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c
index 46a71ec36af87..4b29f2fa51d1d 100644
--- a/drivers/net/wireguard/device.c
+++ b/drivers/net/wireguard/device.c
@@ -31,7 +31,6 @@ static LIST_HEAD(device_list);
static int wg_open(struct net_device *dev)
{
struct in_device *dev_v4 = __in_dev_get_rtnl(dev);
- struct inet6_dev *dev_v6 = __in6_dev_get(dev);
struct wg_device *wg = netdev_priv(dev);
struct wg_peer *peer;
int ret;
@@ -44,8 +43,6 @@ static int wg_open(struct net_device *dev)
IN_DEV_CONF_SET(dev_v4, SEND_REDIRECTS, false);
IPV4_DEVCONF_ALL(dev_net(dev), SEND_REDIRECTS) = false;
}
- if (dev_v6)
- dev_v6->cnf.addr_gen_mode = IN6_ADDR_GEN_MODE_NONE;
mutex_lock(&wg->device_update_lock);
ret = wg_socket_init(wg, wg->incoming_port);
@@ -288,7 +285,7 @@ static void wg_setup(struct net_device *dev)
dev->needed_tailroom = noise_encrypted_len(MESSAGE_PADDING_MULTIPLE);
dev->type = ARPHRD_NONE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
- dev->priv_flags |= IFF_NO_QUEUE;
+ dev->priv_flags |= IFF_NO_QUEUE | IFF_NO_ADDRCONF;
dev->lltx = true;
dev->features |= WG_NETDEV_FEATURES;
dev->hw_features |= WG_NETDEV_FEATURES;
--
2.52.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH wireguard] wireguard: prevent ipv6 addrconf via IFF_NO_ADDRCONF flag
2026-02-08 17:05 [PATCH wireguard] wireguard: prevent ipv6 addrconf via IFF_NO_ADDRCONF flag Valentin Spreckels
@ 2026-03-11 22:59 ` Jason A. Donenfeld
2026-03-21 19:20 ` Valentin Spreckels
0 siblings, 1 reply; 5+ messages in thread
From: Jason A. Donenfeld @ 2026-03-11 22:59 UTC (permalink / raw)
To: Valentin Spreckels
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, wireguard, netdev, linux-kernel
Hi Valentin,
On Sun, Feb 08, 2026 at 06:05:45PM +0100, Valentin Spreckels wrote:
> Use the flag introduced in commit 8a321cf7becc6 ("net: add
> IFF_NO_ADDRCONF and use it in bonding to prevent ipv6 addrconf")
> instead of mangling the addr_gen_mode to prevent ipv6 addrconf.
Can you give some more context here? Why was IFF_NO_ADDRCONF added when
the IN6_ADDR_GEN_MODE_NONE method has been working fine? What's the
difference between these approaches? I don't doubt that your patch is
correct, but I would like to better understand this.
Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH wireguard] wireguard: prevent ipv6 addrconf via IFF_NO_ADDRCONF flag
2026-03-11 22:59 ` Jason A. Donenfeld
@ 2026-03-21 19:20 ` Valentin Spreckels
2026-05-03 19:18 ` Jason A. Donenfeld
0 siblings, 1 reply; 5+ messages in thread
From: Valentin Spreckels @ 2026-03-21 19:20 UTC (permalink / raw)
To: Jason A. Donenfeld
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, wireguard, netdev, linux-kernel
Hi Jason,
On 11/03/2026 23:59, Jason A. Donenfeld wrote:
> Hi Valentin,
>
> On Sun, Feb 08, 2026 at 06:05:45PM +0100, Valentin Spreckels wrote:
>> Use the flag introduced in commit 8a321cf7becc6 ("net: add
>> IFF_NO_ADDRCONF and use it in bonding to prevent ipv6 addrconf")
>> instead of mangling the addr_gen_mode to prevent ipv6 addrconf.
>
> Can you give some more context here? Why was IFF_NO_ADDRCONF added when
> the IN6_ADDR_GEN_MODE_NONE method has been working fine? What's the
> difference between these approaches? I don't doubt that your patch is
> correct, but I would like to better understand this.
Only wireguard configures addr_gen_mode inside the kernel, otherwise it
is only set by userspace; userspace is also able to overwrite the
IFF_NO_ADDRCONF set by wireguard.
Commit 8a321cf7becc ("net: add IFF_NO_ADDRCONF and use it in bonding to
prevent ipv6 addrconf") introduces the private interface flag
IFF_NO_ADDRCONF, which isn't accessible by userspace.
Thus use the IFF_NO_ADDRCONF flag in wireguard.
Does that answer your questions? If yes, I will submit a v2 with this as
commit message.
Best regards
Valentin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH wireguard] wireguard: prevent ipv6 addrconf via IFF_NO_ADDRCONF flag
2026-03-21 19:20 ` Valentin Spreckels
@ 2026-05-03 19:18 ` Jason A. Donenfeld
2026-05-05 15:05 ` Jason A. Donenfeld
0 siblings, 1 reply; 5+ messages in thread
From: Jason A. Donenfeld @ 2026-05-03 19:18 UTC (permalink / raw)
To: Valentin Spreckels
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, wireguard, netdev, linux-kernel
On Sat, Mar 21, 2026 at 08:20:53PM +0100, Valentin Spreckels wrote:
> Hi Jason,
>
> On 11/03/2026 23:59, Jason A. Donenfeld wrote:
> > Hi Valentin,
> >
> > On Sun, Feb 08, 2026 at 06:05:45PM +0100, Valentin Spreckels wrote:
> >> Use the flag introduced in commit 8a321cf7becc6 ("net: add
> >> IFF_NO_ADDRCONF and use it in bonding to prevent ipv6 addrconf")
> >> instead of mangling the addr_gen_mode to prevent ipv6 addrconf.
> >
> > Can you give some more context here? Why was IFF_NO_ADDRCONF added when
> > the IN6_ADDR_GEN_MODE_NONE method has been working fine? What's the
> > difference between these approaches? I don't doubt that your patch is
> > correct, but I would like to better understand this.
>
> Only wireguard configures addr_gen_mode inside the kernel, otherwise it
> is only set by userspace; userspace is also able to overwrite the
> IFF_NO_ADDRCONF set by wireguard.
>
> Commit 8a321cf7becc ("net: add IFF_NO_ADDRCONF and use it in bonding to
> prevent ipv6 addrconf") introduces the private interface flag
> IFF_NO_ADDRCONF, which isn't accessible by userspace.
>
> Thus use the IFF_NO_ADDRCONF flag in wireguard.
>
>
> Does that answer your questions? If yes, I will submit a v2 with this as
> commit message.
I applied this here:
https://git.zx2c4.com/wireguard-linux/commit/?id=88427bcbe5bd3711de387b1c1f6540ef6fc05a78
Sorry for the delay! Patch looks good as-is, once I looked into the
internal mechanism.
Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH wireguard] wireguard: prevent ipv6 addrconf via IFF_NO_ADDRCONF flag
2026-05-03 19:18 ` Jason A. Donenfeld
@ 2026-05-05 15:05 ` Jason A. Donenfeld
0 siblings, 0 replies; 5+ messages in thread
From: Jason A. Donenfeld @ 2026-05-05 15:05 UTC (permalink / raw)
To: Valentin Spreckels
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, wireguard, netdev, linux-kernel
On Sun, May 03, 2026 at 09:18:18PM +0200, Jason A. Donenfeld wrote:
> On Sat, Mar 21, 2026 at 08:20:53PM +0100, Valentin Spreckels wrote:
> > Hi Jason,
> >
> > On 11/03/2026 23:59, Jason A. Donenfeld wrote:
> > > Hi Valentin,
> > >
> > > On Sun, Feb 08, 2026 at 06:05:45PM +0100, Valentin Spreckels wrote:
> > >> Use the flag introduced in commit 8a321cf7becc6 ("net: add
> > >> IFF_NO_ADDRCONF and use it in bonding to prevent ipv6 addrconf")
> > >> instead of mangling the addr_gen_mode to prevent ipv6 addrconf.
> > >
> > > Can you give some more context here? Why was IFF_NO_ADDRCONF added when
> > > the IN6_ADDR_GEN_MODE_NONE method has been working fine? What's the
> > > difference between these approaches? I don't doubt that your patch is
> > > correct, but I would like to better understand this.
> >
> > Only wireguard configures addr_gen_mode inside the kernel, otherwise it
> > is only set by userspace; userspace is also able to overwrite the
> > IFF_NO_ADDRCONF set by wireguard.
> >
> > Commit 8a321cf7becc ("net: add IFF_NO_ADDRCONF and use it in bonding to
> > prevent ipv6 addrconf") introduces the private interface flag
> > IFF_NO_ADDRCONF, which isn't accessible by userspace.
> >
> > Thus use the IFF_NO_ADDRCONF flag in wireguard.
> >
> >
> > Does that answer your questions? If yes, I will submit a v2 with this as
> > commit message.
>
> I applied this here:
> https://git.zx2c4.com/wireguard-linux/commit/?id=88427bcbe5bd3711de387b1c1f6540ef6fc05a78
>
> Sorry for the delay! Patch looks good as-is, once I looked into the
> internal mechanism.
I'm backing this patch out for now. It seems to break the selftests:
[+] NS2: ping6 -c 10 -f -W 1 fd00::1
ping6: connect: Network unreachable
Try it yourself with:
$ make -C tools/testing/selftests/wireguard/qemu -j$(nproc)
I assume it's because of:
case NETDEV_UP:
case NETDEV_CHANGE:
if (idev && idev->cnf.disable_ipv6)
break;
if (dev->priv_flags & IFF_NO_ADDRCONF) {
[...]
break;
}
Feel free to submit a v2 if you think this is fixable or if the tests
themselves are wrong.
Jason
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-05 15:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-08 17:05 [PATCH wireguard] wireguard: prevent ipv6 addrconf via IFF_NO_ADDRCONF flag Valentin Spreckels
2026-03-11 22:59 ` Jason A. Donenfeld
2026-03-21 19:20 ` Valentin Spreckels
2026-05-03 19:18 ` Jason A. Donenfeld
2026-05-05 15:05 ` Jason A. Donenfeld
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.