diff options
author | Matthew N. Dodd <mdodd@FreeBSD.org> | 2003-03-25 01:25:30 +0000 |
---|---|---|
committer | Matthew N. Dodd <mdodd@FreeBSD.org> | 2003-03-25 01:25:30 +0000 |
commit | 302f15f9e8ab2d8b614b27e4655e4383f99055ad (patch) | |
tree | 4e1a44216ae997c6c70dc1a5bb28cba598b7378a /sbin/mount_nfs | |
parent | a9cd061a2a23b94667f7fa962fc18512be223625 (diff) | |
download | src-302f15f9e8ab2d8b614b27e4655e4383f99055ad.tar.gz src-302f15f9e8ab2d8b614b27e4655e4383f99055ad.zip |
Add mount options 'noinet4' and 'noinet6' which prevent using those
address families.
This is useful for preventing NFS mounts from using IPv6 on hosts
that have both A and AAAA records for the same name.
Notes
Notes:
svn path=/head/; revision=112580
Diffstat (limited to 'sbin/mount_nfs')
-rw-r--r-- | sbin/mount_nfs/mount_nfs.8 | 4 | ||||
-rw-r--r-- | sbin/mount_nfs/mount_nfs.c | 16 |
2 files changed, 20 insertions, 0 deletions
diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8 index 56a2ba616c40..3fe82e5cdd6a 100644 --- a/sbin/mount_nfs/mount_nfs.8 +++ b/sbin/mount_nfs/mount_nfs.8 @@ -227,6 +227,10 @@ upper and lower bounds of the timeouts for ``directory'' attributes and for regular files, and 30 -> 60 seconds for directories. The algorithm to calculate the timeout is based on the age of the file. The older the file, the longer the cache is considered valid, subject to the limits above. +.It noinet4 +.It noinet6 +Disables AF_INET or AF_INET6 connections. Useful for hosts that have +both an A record and an AAAA record for the same name. .El .Pp .Bl -tag -width "dumbtimerXX" diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index 7bbfa7edb6ad..fd2e5f967031 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -98,6 +98,8 @@ static const char rcsid[] = #define ALTF_ACDIRMIN 0x20000 #define ALTF_ACDIRMAX 0x40000 #define ALTF_NOLOCKD 0x80000 +#define ALTF_NOINET4 0x100000 +#define ALTF_NOINET6 0x200000 struct mntopt mopts[] = { MOPT_STDOPTS, @@ -121,6 +123,8 @@ struct mntopt mopts[] = { { "acdirmin=", 0, ALTF_ACDIRMIN, 1 }, { "acdirmax=", 0, ALTF_ACDIRMAX, 1 }, { "lockd", 1, ALTF_NOLOCKD, 1 }, + { "inet4", 1, ALTF_NOINET4, 1 }, + { "inet6", 1, ALTF_NOINET6, 1 }, { NULL } }; @@ -172,6 +176,8 @@ struct nfhret { }; #define BGRND 1 #define ISBGRND 2 +#define OF_NOINET4 4 +#define OF_NOINET6 8 int retrycnt = -1; int opflags = 0; int nfsproto = IPPROTO_UDP; @@ -333,6 +339,10 @@ main(argc, argv) */ if (altflags & ALTF_BG) opflags |= BGRND; + if (altflags & ALTF_NOINET4) + opflags |= OF_NOINET4; + if (altflags & ALTF_NOINET6) + opflags |= OF_NOINET6; if (altflags & ALTF_MNTUDP) mnttcp_ok = 0; if (altflags & ALTF_TCP) { @@ -529,6 +539,12 @@ getnfsargs(spec, nfsargsp) */ remoteerr = 0; for (ai = ai_nfs; ai != NULL; ai = ai->ai_next) { + if ((ai->ai_family == AF_INET6) && + (opflags & OF_NOINET6)) + continue; + if ((ai->ai_family == AF_INET) && + (opflags & OF_NOINET4)) + continue; ret = nfs_tryproto(nfsargsp, ai, hostp, spec, &errstr); if (ret == TRYRET_SUCCESS) break; |