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>
This commit is contained in:
parent
7dcb0a0e83
commit
146cc84e0d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109704
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user