summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-03-25 16:07:59 -0400
committerSteve Dickson <steved@redhat.com>2013-03-25 16:07:59 -0400
commite79baddaa1d8cf24cce929e14f6f91ac0d5e15d0 (patch)
tree6a074a61513b033a21252d025725572a59c2f2aa
parentadabe938c17b22aec5e89c24e1856de9fffe9f0c (diff)
downloadnfs-utils-e79baddaa1d8cf24cce929e14f6f91ac0d5e15d0.zip
nfs-utils-e79baddaa1d8cf24cce929e14f6f91ac0d5e15d0.tar.gz
nfs-utils-e79baddaa1d8cf24cce929e14f6f91ac0d5e15d0.tar.xz
nfsd: Add support for the -V and --nfs-version optional arguments
Add command line options to enable those NFS versions that are currently disabled by default. We choose to use the options '-V' and '--nfs-version' for compatibility with rpc.mountd. Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--support/include/nfs/nfs.h1
-rw-r--r--utils/nfsd/nfsd.c26
-rw-r--r--utils/nfsd/nfsd.man9
3 files changed, 33 insertions, 3 deletions
diff --git a/support/include/nfs/nfs.h b/support/include/nfs/nfs.h
index 320880e..174c2dd 100644
--- a/support/include/nfs/nfs.h
+++ b/support/include/nfs/nfs.h
@@ -52,6 +52,7 @@ struct nfs_fh_old {
#define NFSCTL_UDPISSET(_cltbits) ((_cltbits) & NFSCTL_UDPBIT)
#define NFSCTL_TCPISSET(_cltbits) ((_cltbits) & NFSCTL_TCPBIT)
+#define NFSCTL_VERSET(_cltbits, _v) ((_cltbits) |= (1 << ((_v) - 1)))
#define NFSCTL_UDPSET(_cltbits) ((_cltbits) |= NFSCTL_UDPBIT)
#define NFSCTL_TCPSET(_cltbits) ((_cltbits) |= NFSCTL_TCPBIT)
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index 2a3f5cc..e87c0a9 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -38,6 +38,7 @@ static struct option longopts[] =
{ "host", 1, 0, 'H' },
{ "help", 0, 0, 'h' },
{ "no-nfs-version", 1, 0, 'N' },
+ { "nfs-version", 1, 0, 'V' },
{ "no-tcp", 0, 0, 'T' },
{ "no-udp", 0, 0, 'U' },
{ "port", 1, 0, 'P' },
@@ -119,7 +120,7 @@ main(int argc, char **argv)
xlog_syslog(0);
xlog_stderr(1);
- while ((c = getopt_long(argc, argv, "dH:hN:p:P:sTU", longopts, NULL)) != EOF) {
+ while ((c = getopt_long(argc, argv, "dH:hN:V:p:P:sTU", longopts, NULL)) != EOF) {
switch(c) {
case 'd':
xlog_config(D_ALL, 1);
@@ -175,6 +176,27 @@ main(int argc, char **argv)
exit(1);
}
break;
+ case 'V':
+ switch((c = strtol(optarg, &p, 0))) {
+ case 4:
+ if (*p == '.') {
+ int i = atoi(p+1);
+ if (i != 1) {
+ fprintf(stderr, "%s: unsupported minor version\n", optarg);
+ exit(1);
+ }
+ minorvers41 = 1;
+ break;
+ }
+ case 3:
+ case 2:
+ NFSCTL_VERSET(versbits, c);
+ break;
+ default:
+ fprintf(stderr, "%s: Unsupported version\n", optarg);
+ exit(1);
+ }
+ break;
case 's':
xlog_syslog(1);
xlog_stderr(0);
@@ -312,7 +334,7 @@ static void
usage(const char *prog)
{
fprintf(stderr, "Usage:\n"
- "%s [-d|--debug] [-H hostname] [-p|-P|--port port] [-N|--no-nfs-version version ] [-s|--syslog] [-T|--no-tcp] [-U|--no-udp] nrservs\n",
+ "%s [-d|--debug] [-H hostname] [-p|-P|--port port] [-N|--no-nfs-version version] [-V|--nfs-version version] [-s|--syslog] [-T|--no-tcp] [-U|--no-udp] nrservs\n",
prog);
exit(2);
}
diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
index 1cf9296..7de0867 100644
--- a/utils/nfsd/nfsd.man
+++ b/utils/nfsd/nfsd.man
@@ -47,7 +47,7 @@ This option can be used to request that
.B rpc.nfsd
does not offer certain versions of NFS. The current version of
.B rpc.nfsd
-can support both NFS version 2,3 and the newer version 4.
+can support NFS versions 2,3,4 and the newer version 4.1.
.TP
.B \-s " or " \-\-syslog
By default,
@@ -67,6 +67,13 @@ Disable
.B rpc.nfsd
from accepting UDP connections from clients.
.TP
+.B \-V " or " \-\-nfs-version vers
+This option can be used to request that
+.B rpc.nfsd
+offer certain versions of NFS. The current version of
+.B rpc.nfsd
+can support NFS versions 2,3,4 and the newer version 4.1.
+.TP
.I nproc
specify the number of NFS server threads. By default, just one
thread is started. However, for optimum performance several threads