diff options
author | dillon <dillon@FreeBSD.org> | 2003-01-22 19:57:31 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2003-01-22 19:57:31 +0000 |
commit | 0a8a44e0b575f43148b358661878639226131406 (patch) | |
tree | 10ab5196d4659686e27cd36887ce384314492172 | |
parent | 0c1d7b9b17b41fa7c46c82af2b01360183166b61 (diff) | |
download | FreeBSD-src-0a8a44e0b575f43148b358661878639226131406.zip FreeBSD-src-0a8a44e0b575f43148b358661878639226131406.tar.gz |
Provide a sysctl to allow defaulting of the connectionless (-c) feature
to mount_nfs. The sysctl defaults to 1 (paranoid mode). Setting it to 0
will allow an NFS client to receive replies on a different IP then they
were sent to by default.
Submitted by: Sean Eric Fagan <sef@kithrup.com>
-rw-r--r-- | sys/nfsclient/nfs_vfsops.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 037dfc6..5d43af2 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -85,6 +85,9 @@ struct nfsstats nfsstats; SYSCTL_NODE(_vfs, OID_AUTO, nfs, CTLFLAG_RW, 0, "NFS filesystem"); SYSCTL_STRUCT(_vfs_nfs, NFS_NFSSTATS, nfsstats, CTLFLAG_RD, &nfsstats, nfsstats, "S,nfsstats"); +static int nfs_ip_paranoia = 1; +SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_ip_paranoia, CTLFLAG_RW, + &nfs_ip_paranoia, 0, ""); #ifdef NFS_DEBUG int nfs_debug; SYSCTL_INT(_vfs_nfs, OID_AUTO, debug, CTLFLAG_RW, &nfs_debug, 0, ""); @@ -772,6 +775,18 @@ nfs_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, nfs_decode_args(nmp, &args); return (0); } + + /* + * Make the nfs_ip_paranoia sysctl serve as the default connection + * or no-connection mode for those protocols that support + * no-connection mode (the flag will be cleared later for protocols + * that do not support no-connection mode). This will allow a client + * to receive replies from a different IP then the request was + * sent to. Note: default value for nfs_ip_paranoia is 1 (paranoid), + * not 0. + */ + if (nfs_ip_paranoia == 0) + args.flags |= NFSMNT_NOCONN; if (args.fhsize < 0 || args.fhsize > NFSX_V3FHMAX) return (EINVAL); error = copyin((caddr_t)args.fh, (caddr_t)nfh, args.fhsize); |