diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2021-01-21 22:46:19 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2021-01-21 22:46:19 +0000 |
commit | 5800354c99e1823004c45b04266066de5fa060d6 (patch) | |
tree | f0e2a14293efae1bfc1217bf9df6ff5514c11985 /xserver | |
parent | 6152bf2e59a90d46f84b8ad2f45009ff910b3d0a (diff) |
Safer workaround for the "kame hack": only override sin6_scope_id if zero
The assumption is that if sin6_scope_id is set, then the interface index
is no longer embedded in the address.
ok claudio@ matthieu@
Diffstat (limited to 'xserver')
-rw-r--r-- | xserver/os/access.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/xserver/os/access.c b/xserver/os/access.c index 97246160c..24a2ff7b6 100644 --- a/xserver/os/access.c +++ b/xserver/os/access.c @@ -582,7 +582,7 @@ static void in6_fillscopeid(struct sockaddr_in6 *sin6) { #if defined(__KAME__) - if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && sin6->sin6_scope_id == 0) { sin6->sin6_scope_id = ntohs(*(u_int16_t *) &sin6->sin6_addr.s6_addr[2]); sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0; |