From df07daea1421c80ecf308a6daf3ab3fa7d4cfd65 Mon Sep 17 00:00:00 2001 From: hjl Date: Thu, 9 Nov 2000 22:16:34 +0000 Subject: [PATCH] 2000-11-09 H.J. Lu * etc/redhat/nfs.init (start): Pass --no-tcp to mountd if TCP is not supported by kernel. * support/nfs/rpcmisc.c (rpc_init): Don't set _rpcfdtype to 0. * utils/mountd/mountd.c (longopts): Add "-n/--no-tcp". (main): Set to _rpcfdtype to SOCK_DGRAM for "-n/--no-tcp". * utils/mountd/mountd.man: Updated for "-n/--no-tcp". --- ChangeLog | 12 ++++++++++++ etc/redhat/nfs.init | 6 ++++++ support/nfs/rpcmisc.c | 2 +- utils/mountd/mountd.c | 6 +++++- utils/mountd/mountd.man | 3 +++ 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 633fb02..0022c1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2000-11-09 H.J. Lu + + * etc/redhat/nfs.init (start): Pass --no-tcp to mountd if + TCP is not supported by kernel. + + * support/nfs/rpcmisc.c (rpc_init): Don't set _rpcfdtype to 0. + + * utils/mountd/mountd.c (longopts): Add "-n/--no-tcp". + (main): Set to _rpcfdtype to SOCK_DGRAM for "-n/--no-tcp". + + * utils/mountd/mountd.man: Updated for "-n/--no-tcp". + 2000-10-24 Lon Hohberger * utils/statd/callback.c: Fix bug preventing callbacks to local lockd. diff --git a/etc/redhat/nfs.init b/etc/redhat/nfs.init index 5a40f4f..836d60d 100755 --- a/etc/redhat/nfs.init +++ b/etc/redhat/nfs.init @@ -50,6 +50,12 @@ case "$1" in RPCMOUNTDOPTS="--no-nfs-version 3" fi + # Let's see if we support NFS version 3. + /usr/sbin/rpcinfo -p localhost | grep nfs | grep tcp &>/dev/null + if [ $? -ne 0 ]; then + RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-tcp" + fi + echo -n "Starting NFS mountd: " daemon rpc.mountd $RPCMOUNTDOPTS echo diff --git a/support/nfs/rpcmisc.c b/support/nfs/rpcmisc.c index 457d642..4bb4ec8 100644 --- a/support/nfs/rpcmisc.c +++ b/support/nfs/rpcmisc.c @@ -50,9 +50,9 @@ rpc_init(char *name, int prog, int vers, void (*dispatch)(), int defport, asize = sizeof(saddr); sock = 0; - _rpcfdtype = 0; if (getsockname(0, (struct sockaddr *) &saddr, &asize) == 0) { int ssize = sizeof (int); + _rpcfdtype = 0; if (saddr.sin_family != AF_INET) xlog(L_FATAL, "init: stdin is bound to non-inet addr"); if (getsockopt(0, SOL_SOCKET, SO_TYPE, diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c index d79bf15..4df7083 100644 --- a/utils/mountd/mountd.c +++ b/utils/mountd/mountd.c @@ -36,6 +36,7 @@ static struct option longopts[] = { "no-nfs-version", 1, 0, 'N' }, { "version", 0, 0, 'v' }, { "port", 1, 0, 'p' }, + { "no-tcp", 0, 0, 'n' }, { NULL, 0, 0, 0 } }; @@ -419,6 +420,9 @@ main(int argc, char **argv) case 'N': nfs_version &= ~(1 << (atoi (optarg) - 1)); break; + case 'n': + _rpcfdtype = SOCK_DGRAM; + break; case 'V': nfs_version |= 1 << (atoi (optarg) - 1); break; @@ -499,6 +503,6 @@ usage(const char *prog, int n) "Usage: %s [-Fhnv] [-d kind] [-f exports-file] [-V version]\n" " [-N version] [--debug kind] [-p|--port port] [--help] [--version]\n" " [--exports-file=file] [--nfs-version version]\n" -" [--no-nfs-version version]\n", prog); +" [--no-nfs-version version] [--no-tcp]\n", prog); exit(n); } diff --git a/utils/mountd/mountd.man b/utils/mountd/mountd.man index 9dff681..c38d5e2 100644 --- a/utils/mountd/mountd.man +++ b/utils/mountd/mountd.man @@ -83,6 +83,9 @@ NFS kernel module was compiled without support for NFSv3, must be invoked with the option .B "\-\-no-nfs-version 3" . .TP +.B \-n " or " \-\-no-tcp +Don't advertise TCP for mount. +.TP .B \-P Ignored (compatibility with unfsd??). .TP -- 2.39.2