diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-01-16 17:44:30 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-01-16 17:44:30 +0000 |
commit | 16699eab3c492e908eb5a1cea192bd6d7392350a (patch) | |
tree | e0a5546a66c71264d2928adfc0a823d6fc879072 /sbin/ifconfig | |
parent | c495ed86015923c81f1f98afef6d127ffa5efd0d (diff) |
Only recover the scope_id if it was not set. This way this code works
both with and without embedded scope.
OK bluhm@ florian@
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 3d8f6b3b9c2..6b02c60f94b 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.431 2020/12/30 18:57:28 benno Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.432 2021/01/16 17:44:29 claudio Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -3587,7 +3587,8 @@ void in6_fillscopeid(struct sockaddr_in6 *sin6) { #ifdef __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; |