Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/mountd support IPv6 addresses start with hex digit ...



details:   https://anonhg.NetBSD.org/src/rev/36ab485b38d6
branches:  trunk
changeset: 487632:36ab485b38d6
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sat Jun 10 07:04:13 2000 +0000

description:
support IPv6 addresses start with hex digit or colon (like ::1).
in manpages, warn that scoped IPv6 addresses are not supported.

diffstat:

 usr.sbin/mountd/exports.5 |   8 +++++++-
 usr.sbin/mountd/mountd.8  |   5 ++++-
 usr.sbin/mountd/mountd.c  |  16 ++++++++++++++--
 3 files changed, 25 insertions(+), 4 deletions(-)

diffs (83 lines):

diff -r 369be0f3c215 -r 36ab485b38d6 usr.sbin/mountd/exports.5
--- a/usr.sbin/mountd/exports.5 Sat Jun 10 05:54:29 2000 +0000
+++ b/usr.sbin/mountd/exports.5 Sat Jun 10 07:04:13 2000 +0000
@@ -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 @@
 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.
diff -r 369be0f3c215 -r 36ab485b38d6 usr.sbin/mountd/mountd.8
--- a/usr.sbin/mountd/mountd.8  Sat Jun 10 05:54:29 2000 +0000
+++ b/usr.sbin/mountd/mountd.8  Sat Jun 10 07:04:13 2000 +0000
@@ -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 @@
 .Nm
 utility first appeared in
 .Bx 4.4 .
+.Sh BUGS
+.Nm
+does not take care of scoped IPv6 address at this moment.
diff -r 369be0f3c215 -r 36ab485b38d6 usr.sbin/mountd/mountd.c
--- a/usr.sbin/mountd/mountd.c  Sat Jun 10 05:54:29 2000 +0000
+++ b/usr.sbin/mountd/mountd.c  Sat Jun 10 07:04:13 2000 +0000
@@ -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 @@
 #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 @@
        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 @@
                        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;
 



Home | Main Index | Thread Index | Old Index