permit DNS names to address portion. they will be considered as RTF_HOST
if specified as destination (as there's no getnetbyname in IPv6).
This commit is contained in:
parent
fa0b03a3ac
commit
d24b68cd4f
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: route.c,v 1.57 2002/06/05 22:11:28 itojun Exp $ */
|
||||
/* $NetBSD: route.c,v 1.58 2002/06/10 21:18:53 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1989, 1991, 1993
|
||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1991, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: route.c,v 1.57 2002/06/05 22:11:28 itojun Exp $");
|
||||
__RCSID("$NetBSD: route.c,v 1.58 2002/06/10 21:18:53 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -1195,13 +1195,24 @@ getaddr(which, s, hpp)
|
||||
hints.ai_family = afamily; /*AF_INET6*/
|
||||
hints.ai_flags = AI_NUMERICHOST;
|
||||
hints.ai_socktype = SOCK_DGRAM; /*dummy*/
|
||||
if (getaddrinfo(s, "0", &hints, &res) != 0 ||
|
||||
res->ai_family != AF_INET6 ||
|
||||
res->ai_addrlen != sizeof(su->sin6)) {
|
||||
if (getaddrinfo(s, "0", &hints, &res) != 0) {
|
||||
hints.ai_flags = 0;
|
||||
if (getaddrinfo(s, "0", &hints, &res) != 0) {
|
||||
(void) fprintf(stderr, "%s: bad value\n", s);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (sizeof(su->sin6) != res->ai_addrlen) {
|
||||
(void) fprintf(stderr, "%s: bad value\n", s);
|
||||
exit(1);
|
||||
}
|
||||
if (res->ai_next) {
|
||||
(void) fprintf(stderr,
|
||||
"%s: resolved to multiple values\n", s);
|
||||
exit(1);
|
||||
}
|
||||
memcpy(&su->sin6, res->ai_addr, sizeof(su->sin6));
|
||||
freeaddrinfo(res);
|
||||
#ifdef __KAME__
|
||||
if ((IN6_IS_ADDR_LINKLOCAL(&su->sin6.sin6_addr) ||
|
||||
IN6_IS_ADDR_MC_LINKLOCAL(&su->sin6.sin6_addr)) &&
|
||||
@ -1211,10 +1222,12 @@ getaddr(which, s, hpp)
|
||||
su->sin6.sin6_scope_id = 0;
|
||||
}
|
||||
#endif
|
||||
freeaddrinfo(res);
|
||||
if (which == RTA_DST)
|
||||
return inet6_makenetandmask(&su->sin6);
|
||||
return 0;
|
||||
if (hints.ai_flags == AI_NUMERICHOST) {
|
||||
if (which == RTA_DST)
|
||||
return (inet6_makenetandmask(&su->sin6));
|
||||
return (0);
|
||||
} else
|
||||
return (1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user