[<prev] [next>] [day] [month] [year] [list]
Message-ID: <aMf_ZORMji8eiHpH@omega.tcarey.uk>
Date: Mon, 15 Sep 2025 11:58:34 +0000
From: Torin Carey <torin@...rey.uk>
Cc: "Jason A. Donenfeld" <Jason@...c4.com>, wireguard@...ts.zx2c4.com, netdev@...r.kernel.org
Subject: [PATCH] wireguard: do not use sin6_scope_id if not needed
sin6_scope_id should only be used if the address is link-local and
otherwise ignored.
Currently send6 uses the sin6_scope_id for flowi6_oif without a check of
whether this is needed, so this can cause non-link local endpoints to
use an incorrect device.
Signed-off-by: Torin Carey <torin@...rey.uk>
---
drivers/net/wireguard/netlink.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireguard/netlink.c b/drivers/net/wireguard/netlink.c
index 67f962eb8b46..738041f72c2b 100644
--- a/drivers/net/wireguard/netlink.c
+++ b/drivers/net/wireguard/netlink.c
@@ -453,6 +453,8 @@ static int set_peer(struct wg_device *wg, struct nlattr **attrs)
wg_socket_set_peer_endpoint(peer, &endpoint);
} else if (len == sizeof(struct sockaddr_in6) && addr->sa_family == AF_INET6) {
endpoint.addr6 = *(struct sockaddr_in6 *)addr;
+ if (!__ipv6_addr_needs_scope_id(ipv6_addr_type(&endpoint.addr6.sin6_addr)))
+ endpoint.addr6.sin6_scope_id = 0;
wg_socket_set_peer_endpoint(peer, &endpoint);
}
}
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
--
2.48.1
Powered by blists - more mailing lists