support IPv6 addresses start with hex digit or colon (like ::1).

in manpages, warn that scoped IPv6 addresses are not supported.
This commit is contained in:
itojun 2000-06-10 07:04:13 +00:00
parent 70fc6bfcaf
commit 1ba6c2716a
3 changed files with 25 additions and 4 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: exports.5,v 1.16 2000/06/09 00:03:31 fvdl Exp $
.\" $NetBSD: exports.5,v 1.17 2000/06/10 07:04:13 itojun Exp $
.\"
.\" Copyright (c) 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -334,3 +334,9 @@ filesystem be specified on adjacent lines going down the tree.
You cannot specify a hostname that is also the name of a netgroup.
Specifying the full domain specification for a hostname can normally
circumvent the problem.
.Pp
Scoped IPv6 address should not be used in
.Nm Ns ,
since
.Xr mountd 8
does not take care of scoped IPv6 address at this moment.

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mountd.8,v 1.19 1998/10/07 14:51:36 christos Exp $
.\" $NetBSD: mountd.8,v 1.20 2000/06/10 07:04:14 itojun Exp $
.\"
.\" Copyright (c) 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -121,3 +121,6 @@ The
.Nm
utility first appeared in
.Bx 4.4 .
.Sh BUGS
.Nm
does not take care of scoped IPv6 address at this moment.

View File

@ -1,4 +1,4 @@
/* $NetBSD: mountd.c,v 1.65 2000/06/10 04:40:17 itojun Exp $ */
/* $NetBSD: mountd.c,v 1.66 2000/06/10 07:04:14 itojun Exp $ */
/*
* Copyright (c) 1989, 1993
@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95";
#else
__RCSID("$NetBSD: mountd.c,v 1.65 2000/06/10 04:40:17 itojun Exp $");
__RCSID("$NetBSD: mountd.c,v 1.66 2000/06/10 07:04:14 itojun Exp $");
#endif
#endif /* not lint */
@ -1416,10 +1416,14 @@ netpartcmp(struct sockaddr *s1, struct sockaddr *s2, int bitlen)
case AF_INET:
src = &((struct sockaddr_in *)s1)->sin_addr;
dst = &((struct sockaddr_in *)s2)->sin_addr;
if (bitlen > sizeof(((struct sockaddr_in *)s1)->sin_addr) * 8)
return 1;
break;
case AF_INET6:
src = &((struct sockaddr_in6 *)s1)->sin6_addr;
dst = &((struct sockaddr_in6 *)s2)->sin6_addr;
if (bitlen > sizeof(((struct sockaddr_in6 *)s1)->sin6_addr) * 8)
return 1;
break;
default:
return 1;
@ -2107,6 +2111,14 @@ get_net(cp, net, maskflg)
sa = (struct sockaddr *)&sin;
} else
sa = ai->ai_addr;
} else if (isxdigit(*cp) || *cp == ':') {
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_NUMERICHOST;
if (getaddrinfo(cp, NULL, &hints, &ai) == 0)
sa = ai->ai_addr;
else
return 1;
} else
return 1;