wireguard: do not use sin6_scope_id if not needed
Subsystems (3)
PATCH 1/1 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 <[email protected]>
--- drivers/net/wireguard/netlink.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireguard/netlink.c +2 -0
@@ -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
Signature · 1 line
2.48.1