Handle the internal scope address representation of the KAME IPv6
stack for the node-local multicast address. Spotted by: Rainer Bredehorn <Bredehorn__at__gmx.de> MFC after: 1 week
This commit is contained in:
parent
93e26ff438
commit
324930d7f8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=229766
@ -1576,7 +1576,8 @@ ip6_str2scopeid(char *scope, struct sockaddr_in6 *sin6, u_int32_t *scopeid)
|
|||||||
if (*scope == '\0')
|
if (*scope == '\0')
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) {
|
if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6) ||
|
||||||
|
IN6_IS_ADDR_MC_NODELOCAL(a6)) {
|
||||||
/*
|
/*
|
||||||
* We currently assume a one-to-one mapping between links
|
* We currently assume a one-to-one mapping between links
|
||||||
* and interfaces, so we simply use interface indices for
|
* and interfaces, so we simply use interface indices for
|
||||||
|
@ -375,7 +375,8 @@ routename(struct sockaddr *sa)
|
|||||||
#ifdef __KAME__
|
#ifdef __KAME__
|
||||||
if (sa->sa_len == sizeof(struct sockaddr_in6) &&
|
if (sa->sa_len == sizeof(struct sockaddr_in6) &&
|
||||||
(IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) ||
|
(IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) ||
|
||||||
IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) &&
|
IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr) ||
|
||||||
|
IN6_IS_ADDR_MC_NODELOCAL(&sin6.sin6_addr)) &&
|
||||||
sin6.sin6_scope_id == 0) {
|
sin6.sin6_scope_id == 0) {
|
||||||
sin6.sin6_scope_id =
|
sin6.sin6_scope_id =
|
||||||
ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);
|
ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);
|
||||||
@ -500,7 +501,8 @@ netname(struct sockaddr *sa)
|
|||||||
#ifdef __KAME__
|
#ifdef __KAME__
|
||||||
if (sa->sa_len == sizeof(struct sockaddr_in6) &&
|
if (sa->sa_len == sizeof(struct sockaddr_in6) &&
|
||||||
(IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) ||
|
(IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) ||
|
||||||
IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) &&
|
IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr) ||
|
||||||
|
IN6_IS_ADDR_MC_NODELOCAL(&sin6.sin6_addr)) &&
|
||||||
sin6.sin6_scope_id == 0) {
|
sin6.sin6_scope_id == 0) {
|
||||||
sin6.sin6_scope_id =
|
sin6.sin6_scope_id =
|
||||||
ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);
|
ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);
|
||||||
@ -1002,7 +1004,8 @@ getaddr(int which, char *str, struct hostent **hpp)
|
|||||||
memcpy(&su->sin6, res->ai_addr, sizeof(su->sin6));
|
memcpy(&su->sin6, res->ai_addr, sizeof(su->sin6));
|
||||||
#ifdef __KAME__
|
#ifdef __KAME__
|
||||||
if ((IN6_IS_ADDR_LINKLOCAL(&su->sin6.sin6_addr) ||
|
if ((IN6_IS_ADDR_LINKLOCAL(&su->sin6.sin6_addr) ||
|
||||||
IN6_IS_ADDR_MC_LINKLOCAL(&su->sin6.sin6_addr)) &&
|
IN6_IS_ADDR_MC_LINKLOCAL(&su->sin6.sin6_addr) ||
|
||||||
|
IN6_IS_ADDR_MC_NODELOCAL(&su->sin6.sin6_addr)) &&
|
||||||
su->sin6.sin6_scope_id) {
|
su->sin6.sin6_scope_id) {
|
||||||
*(u_int16_t *)&su->sin6.sin6_addr.s6_addr[2] =
|
*(u_int16_t *)&su->sin6.sin6_addr.s6_addr[2] =
|
||||||
htons(su->sin6.sin6_scope_id);
|
htons(su->sin6.sin6_scope_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user