diff options
author | Jeff Layton <jlayton@redhat.com> | 2017-04-05 13:26:49 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2017-04-05 13:28:11 -0400 |
commit | fbd7623dd8d5e418e7cb369d4026d5368f7c46a6 (patch) | |
tree | 7178f88929c83c583ac38bf2958250062c90db87 /utils/nfsd/nfsd.c | |
parent | d53fe5fe72d2b8d645ad362840da42021363384d (diff) | |
download | nfs-utils-fbd7623dd8d5e418e7cb369d4026d5368f7c46a6.tar.gz nfs-utils-fbd7623dd8d5e418e7cb369d4026d5368f7c46a6.tar.xz nfs-utils-fbd7623dd8d5e418e7cb369d4026d5368f7c46a6.zip |
nfsd: don't enable a UDP socket by default
Most major NFS clients have supported TCP for at least a decade now,
and v4-only shops are becoming more prevalent. It seems reasonable that
serving over UDP should be something that is "opt-in".
I've always hesitated to do this in the past, but now that we have
nfs.conf, it seems like the time may be right to disable UDP in default
configurations. In particular, it would be good to try this in the more
bleeding edge distros (Fedora, Ubuntu, SuSE, etc...) and see how
problematic it is.
Change the default in rpc.nfsd to just open TCP ports by default. Add
new -u and -t options that allow users to explicitly override what's
in the config file, and update the usage message and manpage.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/nfsd/nfsd.c')
-rw-r--r-- | utils/nfsd/nfsd.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c index 1708521..cea850d 100644 --- a/utils/nfsd/nfsd.c +++ b/utils/nfsd/nfsd.c @@ -44,7 +44,9 @@ static struct option longopts[] = { "help", 0, 0, 'h' }, { "no-nfs-version", 1, 0, 'N' }, { "nfs-version", 1, 0, 'V' }, + { "tcp", 0, 0, 't' }, { "no-tcp", 0, 0, 'T' }, + { "udp", 0, 0, 'u' }, { "no-udp", 0, 0, 'U' }, { "port", 1, 0, 'P' }, { "port", 1, 0, 'p' }, @@ -69,7 +71,7 @@ main(int argc, char **argv) unsigned int minorversset = 0; unsigned int minormask = 0; unsigned int versbits = NFSCTL_VERDEFAULT; - unsigned int protobits = NFSCTL_ALLBITS; + unsigned int protobits = NFSCTL_PROTODEFAULT; int grace = -1; int lease = -1; @@ -145,7 +147,7 @@ main(int argc, char **argv) } } - while ((c = getopt_long(argc, argv, "dH:hN:V:p:P:sTUrG:L:", longopts, NULL)) != EOF) { + while ((c = getopt_long(argc, argv, "dH:hN:V:p:P:stTitUrG:L:", longopts, NULL)) != EOF) { switch(c) { case 'd': xlog_config(D_ALL, 1); @@ -233,9 +235,15 @@ main(int argc, char **argv) xlog_syslog(1); xlog_stderr(0); break; + case 't': + NFSCTL_TCPSET(protobits); + break; case 'T': NFSCTL_TCPUNSET(protobits); break; + case 'u': + NFSCTL_UDPSET(protobits); + break; case 'U': NFSCTL_UDPUNSET(protobits); break; @@ -383,9 +391,9 @@ usage(const char *prog) { fprintf(stderr, "Usage:\n" "%s [-d|--debug] [-H hostname] [-p|-P|--port port]\n" - " [-N|--no-nfs-version version] [-V|--nfs-version version]\n" - " [-s|--syslog] [-T|--no-tcp] [-U|--no-udp] [-r|--rdma=]\n" - " [-G|--grace-time secs] [-L|--leasetime secs] nrservs\n", + " [-N|--no-nfs-version version] [-V|--nfs-version version]\n" + " [-s|--syslog] [-t|--tcp] [-T|--no-tcp] [-u|--udp] [-U|--no-udp]\n" + " [-r|--rdma=] [-G|--grace-time secs] [-L|--leasetime secs] nrservs\n", prog); exit(2); } |