From owner-svn-src-stable@FreeBSD.ORG Sat Feb 27 18:27:32 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3BA6106566B; Sat, 27 Feb 2010 18:27:32 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7B898FC15; Sat, 27 Feb 2010 18:27:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o1RIRWsx038261; Sat, 27 Feb 2010 18:27:32 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1RIRWCf038258; Sat, 27 Feb 2010 18:27:32 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201002271827.o1RIRWCf038258@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sat, 27 Feb 2010 18:27:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204422 - in stable/8/sbin: mount_nfs umount X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 18:27:33 -0000 Author: ume Date: Sat Feb 27 18:27:32 2010 New Revision: 204422 URL: http://svn.freebsd.org/changeset/base/204422 Log: MFC r203490: Introduce '[ipaddr]:path' notation. Since the existing implementation searches ':' backward, a path which includes ':' could not be mounted. You can now mount such path by enclosing an IP address by '[]'. Though we should change to search ':' forward, it will break 'ipv6addr:path' which is currently working. So, it still searches ':' backward, at least for now. Modified: stable/8/sbin/mount_nfs/mount_nfs.c stable/8/sbin/umount/umount.c Directory Properties: stable/8/sbin/mount_nfs/ (props changed) stable/8/sbin/umount/ (props changed) Modified: stable/8/sbin/mount_nfs/mount_nfs.c ============================================================================== --- stable/8/sbin/mount_nfs/mount_nfs.c Sat Feb 27 18:19:13 2010 (r204421) +++ stable/8/sbin/mount_nfs/mount_nfs.c Sat Feb 27 18:27:32 2010 (r204422) @@ -698,12 +698,17 @@ getnfsargs(char *spec, struct iovec **io { struct addrinfo hints, *ai_nfs, *ai; enum tryret ret; - int ecode, speclen, remoteerr; + int ecode, speclen, remoteerr, offset, have_bracket = 0; char *hostp, *delimp, *errstr; size_t len; static char nam[MNAMELEN + 1], pname[MAXHOSTNAMELEN + 5]; - if ((delimp = strrchr(spec, ':')) != NULL) { + if (*spec == '[' && (delimp = strchr(spec + 1, ']')) != NULL && + *(delimp + 1) == ':') { + hostp = spec + 1; + spec = delimp + 2; + have_bracket = 1; + } else if ((delimp = strrchr(spec, ':')) != NULL) { hostp = spec; spec = delimp + 1; } else if ((delimp = strrchr(spec, '@')) != NULL) { @@ -731,10 +736,15 @@ getnfsargs(char *spec, struct iovec **io /* Make both '@' and ':' notations equal */ if (*hostp != '\0') { len = strlen(hostp); - memmove(nam, hostp, len); - nam[len] = ':'; - memmove(nam + len + 1, spec, speclen); - nam[len + speclen + 1] = '\0'; + offset = 0; + if (have_bracket) + nam[offset++] = '['; + memmove(nam + offset, hostp, len); + if (have_bracket) + nam[len + offset++] = ']'; + nam[len + offset++] = ':'; + memmove(nam + len + offset, spec, speclen); + nam[len + speclen + offset] = '\0'; } /* Modified: stable/8/sbin/umount/umount.c ============================================================================== --- stable/8/sbin/umount/umount.c Sat Feb 27 18:19:13 2010 (r204421) +++ stable/8/sbin/umount/umount.c Sat Feb 27 18:27:32 2010 (r204422) @@ -325,14 +325,21 @@ umountfs(struct statfs *sfs) if ((nfsdirname = strdup(sfs->f_mntfromname)) == NULL) err(1, "strdup"); orignfsdirname = nfsdirname; - if ((delimp = strrchr(nfsdirname, ':')) != NULL) { - *delimp = '\0'; + if (*nfsdirname == '[' && + (delimp = strchr(nfsdirname + 1, ']')) != NULL && + *(delimp + 1) == ':') { + hostp = nfsdirname + 1; + nfsdirname = delimp + 2; + } else if ((delimp = strrchr(nfsdirname, ':')) != NULL) { hostp = nfsdirname; + nfsdirname = delimp + 1; + } + if (hostp != NULL) { + *delimp = '\0'; getaddrinfo(hostp, NULL, &hints, &ai); if (ai == NULL) { warnx("can't get net id for host"); } - nfsdirname = delimp + 1; } /*