From 0a8a44e0b575f43148b358661878639226131406 Mon Sep 17 00:00:00 2001 From: dillon Date: Wed, 22 Jan 2003 19:57:31 +0000 Subject: 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 --- sys/nfsclient/nfs_vfsops.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sys') 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); -- cgit v1.1