diff options
author | Steve Dickson <steved@redhat.com> | 2013-11-05 14:10:05 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2013-11-05 14:10:05 -0500 |
commit | a80482157632584ee03df58ed1eef3cefd95bbcb (patch) | |
tree | 17f9875fc50aceaa5468e7907f5c178e2c37845e /support/nfs/rpcmisc.c | |
parent | d4a408776d611cd62235232d65d488d02fca78e4 (diff) | |
download | nfs-utils-a80482157632584ee03df58ed1eef3cefd95bbcb.tar.gz nfs-utils-a80482157632584ee03df58ed1eef3cefd95bbcb.tar.xz nfs-utils-a80482157632584ee03df58ed1eef3cefd95bbcb.zip |
mountd: Use protocol bit fields to turn protocols off.
Convert the current code to used the NFSCTL_XXX macros
to turn off the TCP listener.
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support/nfs/rpcmisc.c')
-rw-r--r-- | support/nfs/rpcmisc.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/support/nfs/rpcmisc.c b/support/nfs/rpcmisc.c index b73187a..64c98ff 100644 --- a/support/nfs/rpcmisc.c +++ b/support/nfs/rpcmisc.c @@ -39,7 +39,7 @@ #define _RPCSVC_CLOSEDOWN 120 int _rpcpmstart = 0; -int _rpcfdtype = 0; +unsigned int _rpcprotobits = (NFSCTL_UDPBIT|NFSCTL_TCPBIT); int _rpcsvcdirty = 0; static void @@ -51,7 +51,7 @@ closedown(int sig) static int size; int i, openfd; - if (_rpcfdtype == SOCK_DGRAM) + if (NFSCTL_TCPISSET(_rpcprotobits) == 0) exit(0); if (size == 0) @@ -130,7 +130,16 @@ rpc_init(char *name, int prog, int vers, * listen will fail on a connected TCP socket(passed by rsh). */ if (!(fdtype == SOCK_STREAM && listen(0,5) == -1)) { - _rpcfdtype = fdtype; + switch(fdtype) { + case SOCK_DGRAM: + NFSCTL_UDPSET(_rpcprotobits); + break; + case SOCK_STREAM: + NFSCTL_TCPSET(_rpcprotobits); + break; + default: + xlog(L_FATAL, "getsockopt returns bad socket type: %d", fdtype); + } _rpcpmstart = 1; } } @@ -139,7 +148,7 @@ rpc_init(char *name, int prog, int vers, sock = RPC_ANYSOCK; } - if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_DGRAM)) { + if (NFSCTL_UDPISSET(_rpcprotobits)) { static SVCXPRT *last_transp = NULL; if (_rpcpmstart == 0) { @@ -167,7 +176,7 @@ rpc_init(char *name, int prog, int vers, last_transp = transp; } - if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_STREAM)) { + if (NFSCTL_TCPISSET(_rpcprotobits)) { static SVCXPRT *last_transp = NULL; if (_rpcpmstart == 0) { |