diff options
author | hrs <hrs@FreeBSD.org> | 2012-11-18 16:06:51 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2012-11-18 16:06:51 +0000 |
commit | ec229e5ea6e188406460b3cee0a7a0d34e6bc594 (patch) | |
tree | 299465fa6efb2d51a90bf61e4711bb1f02a2b62a /sys/netinet6 | |
parent | fb4bab611cb46e64084e1050aa3606772ffe9b87 (diff) | |
download | FreeBSD-src-ec229e5ea6e188406460b3cee0a7a0d34e6bc594.zip FreeBSD-src-ec229e5ea6e188406460b3cee0a7a0d34e6bc594.tar.gz |
Check if an extracted zoneid is equal to the non-zero sin6_scope_id only when
it is link-local or MC interface-local.
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/scope6.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c index 1cfe103..edfb1e6 100644 --- a/sys/netinet6/scope6.c +++ b/sys/netinet6/scope6.c @@ -369,12 +369,6 @@ sa6_recoverscope(struct sockaddr_in6 *sin6) char ip6buf[INET6_ADDRSTRLEN]; u_int32_t zoneid; - if (sin6->sin6_scope_id != 0) { - log(LOG_NOTICE, - "sa6_recoverscope: assumption failure (non 0 ID): %s%%%d\n", - ip6_sprintf(ip6buf, &sin6->sin6_addr), sin6->sin6_scope_id); - /* XXX: proceed anyway... */ - } if (IN6_IS_SCOPE_LINKLOCAL(&sin6->sin6_addr) || IN6_IS_ADDR_MC_INTFACELOCAL(&sin6->sin6_addr)) { /* @@ -387,6 +381,14 @@ sa6_recoverscope(struct sockaddr_in6 *sin6) return (ENXIO); if (!ifnet_byindex(zoneid)) return (ENXIO); + if (sin6->sin6_scope_id != 0 && + zoneid != sin6->sin6_scope_id) { + log(LOG_NOTICE, + "%s: embedded scope mismatch: %s%%%d. " + "sin6_scope_id was overridden.", __func__, + ip6_sprintf(ip6buf, &sin6->sin6_addr), + sin6->sin6_scope_id); + } sin6->sin6_addr.s6_addr16[1] = 0; sin6->sin6_scope_id = zoneid; } |