summaryrefslogtreecommitdiffstats
path: root/sbin/umount
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2010-02-04 15:17:49 +0000
committerume <ume@FreeBSD.org>2010-02-04 15:17:49 +0000
commit4650055e248bb24fa28802c303a9d9af06e02256 (patch)
tree47de67c389eb6cb8f26bd61cf585c8bbb5343ed0 /sbin/umount
parentc0230e45d38c056190d62f120a08601dac6aa360 (diff)
downloadFreeBSD-src-4650055e248bb24fa28802c303a9d9af06e02256.zip
FreeBSD-src-4650055e248bb24fa28802c303a9d9af06e02256.tar.gz
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. MFC after: 2 weeks
Diffstat (limited to 'sbin/umount')
-rw-r--r--sbin/umount/umount.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c
index eb51f2a..c42b4bb 100644
--- a/sbin/umount/umount.c
+++ b/sbin/umount/umount.c
@@ -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;
}
/*
OpenPOWER on IntegriCloud