Don't forget to set sin_scope. From Ryota Ozaki
This commit is contained in:
parent
b6c41919a3
commit
fb571d36af
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ndp.c,v 1.45 2015/08/03 09:51:40 ozaki-r Exp $ */
|
||||
/* $NetBSD: ndp.c,v 1.46 2015/12/14 18:24:06 christos Exp $ */
|
||||
/* $KAME: ndp.c,v 1.121 2005/07/13 11:30:13 keiichi Exp $ */
|
||||
|
||||
/*
|
||||
@ -303,6 +303,15 @@ main(int argc, char **argv)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void
|
||||
makeaddr(struct sockaddr_in6 *mysin, const void *resp)
|
||||
{
|
||||
const struct sockaddr_in6 *res = resp;
|
||||
mysin->sin6_addr = res->sin6_addr;
|
||||
mysin->sin6_scope_id = res->sin6_scope_id;
|
||||
inet6_putscopeid(mysin, INET6_IS_ADDR_LINKLOCAL);
|
||||
}
|
||||
|
||||
static void
|
||||
getsocket(void)
|
||||
{
|
||||
@ -362,8 +371,7 @@ set(int argc, char **argv)
|
||||
warnx("%s: %s", host, gai_strerror(gai_error));
|
||||
return 1;
|
||||
}
|
||||
mysin->sin6_addr = ((struct sockaddr_in6 *)(void *)res->ai_addr)->sin6_addr;
|
||||
inet6_putscopeid(mysin, INET6_IS_ADDR_LINKLOCAL);
|
||||
makeaddr(mysin, res->ai_addr);
|
||||
ea = (u_char *)LLADDR(&sdl_m);
|
||||
if (ndp_ether_aton(eaddr, ea) == 0)
|
||||
sdl_m.sdl_alen = 6;
|
||||
@ -429,8 +437,7 @@ get(char *host)
|
||||
warnx("%s: %s", host, gai_strerror(gai_error));
|
||||
return;
|
||||
}
|
||||
mysin->sin6_addr = ((struct sockaddr_in6 *)(void *)res->ai_addr)->sin6_addr;
|
||||
inet6_putscopeid(mysin, INET6_IS_ADDR_LINKLOCAL);
|
||||
makeaddr(mysin, res->ai_addr);
|
||||
dump(&mysin->sin6_addr, 0);
|
||||
if (found_entry == 0) {
|
||||
(void)getnameinfo((struct sockaddr *)(void *)mysin,
|
||||
@ -463,8 +470,7 @@ delete(char *host)
|
||||
warnx("%s: %s", host, gai_strerror(gai_error));
|
||||
return 1;
|
||||
}
|
||||
mysin->sin6_addr = ((struct sockaddr_in6 *)(void *)res->ai_addr)->sin6_addr;
|
||||
inet6_putscopeid(mysin, INET6_IS_ADDR_LINKLOCAL);
|
||||
makeaddr(mysin, res->ai_addr);
|
||||
if (rtmsg(RTM_GET) < 0)
|
||||
errx(1, "RTM_GET(%s) failed", host);
|
||||
mysin = (struct sockaddr_in6 *)(void *)(rtm + 1);
|
||||
|
Loading…
Reference in New Issue
Block a user