diff options
author | hjl <hjl> | 2002-09-12 21:06:16 +0000 |
---|---|---|
committer | hjl <hjl> | 2002-09-12 21:06:16 +0000 |
commit | 87fe487c6f5abe9f40f2f036c3cf6c7f02fa0385 (patch) | |
tree | 15f6af17471f0fc489e236de98cf53fac64bf090 /support | |
parent | 55ce21003ee0fb12fe5ef70909cdc8ce00b803e4 (diff) | |
download | nfs-utils-87fe487c6f5abe9f40f2f036c3cf6c7f02fa0385.tar.gz nfs-utils-87fe487c6f5abe9f40f2f036c3cf6c7f02fa0385.tar.xz nfs-utils-87fe487c6f5abe9f40f2f036c3cf6c7f02fa0385.zip |
2002-09-12 H.J. Lu <hjl@lucon.org>
* configure.in: Check svctcp_socket and svcudp_socket.
* configure: Regenerated.
* support/include/config.h.in (HAVE_SVCTCP_SOCKET): New.
(HAVE_SVCUDP_SOCKET): New.
* support/include/nfslib.h (svctcp_socket): New.
(svcudp_socket): New.
* support/nfs/Makefile (OBJS): Add svc_socket.o.
* support/nfs/svc_socket.c: New.
* support/nfs/rpcmisc.c (rpc_init): Call svctcp_socket and
svcudp_socket if port is unspecified.
* utils/nfsd/nfsd.c (main): Call getservbyname for port.
* utils/rquotad/rquota_svc.c: Include <nfslib.h>.
(killer): New. Signal handler to unregister.
(main): Use killer. Call svcudp_socket to get the default
socket.
Diffstat (limited to 'support')
-rw-r--r-- | support/include/config.h.in | 8 | ||||
-rw-r--r-- | support/include/nfslib.h | 3 | ||||
-rw-r--r-- | support/nfs/Makefile | 3 | ||||
-rw-r--r-- | support/nfs/rpcmisc.c | 12 |
4 files changed, 23 insertions, 3 deletions
diff --git a/support/include/config.h.in b/support/include/config.h.in index f8c1497..6d12cc6 100644 --- a/support/include/config.h.in +++ b/support/include/config.h.in @@ -9,6 +9,14 @@ */ #undef HAVE_INNETGR +/* Define this if you have svctcp_socket + */ +#undef HAVE_SVCTCP_SOCKET + +/* Define this if you have svcudp_socket + */ +#undef HAVE_SVCUDP_SOCKET + /* Define this if you want NFSv3 support compiled in */ #undef NFS3_SUPPORTED diff --git a/support/include/nfslib.h b/support/include/nfslib.h index 6bcc859..b95c782 100644 --- a/support/include/nfslib.h +++ b/support/include/nfslib.h @@ -125,4 +125,7 @@ struct nfs_fh_len * getfh_size(struct sockaddr *addr, const char *, int size); /* lockd. */ int lockdsvc(); +extern int svctcp_socket (u_long __number, int __reuse); +extern int svcudp_socket (u_long __number, int __reuse); + #endif /* NFSLIB_H */ diff --git a/support/nfs/Makefile b/support/nfs/Makefile index ed1e1ff..12a44e8 100644 --- a/support/nfs/Makefile +++ b/support/nfs/Makefile @@ -5,7 +5,8 @@ LIBNAME = libnfs.a OBJS = exports.o rmtab.o xio.o \ rpcmisc.o rpcdispatch.o xlog.o xmalloc.o wildmat.o \ - nfssvc.o nfsclient.o nfsexport.o getfh.o nfsctl.o lockdsvc.o + nfssvc.o nfsclient.o nfsexport.o getfh.o nfsctl.o \ + lockdsvc.o svc_socket.o include $(TOP)rules.mk diff --git a/support/nfs/rpcmisc.c b/support/nfs/rpcmisc.c index 6eb24a2..832de5f 100644 --- a/support/nfs/rpcmisc.c +++ b/support/nfs/rpcmisc.c @@ -73,11 +73,15 @@ rpc_init(char *name, int prog, int vers, void (*dispatch)(), int defport) transp = last_transp; goto udp_transport; } - if ((sock = makesock(defport, IPPROTO_UDP)) < 0) { + if (defport == 0) + sock = RPC_ANYSOCK; + else if ((sock = makesock(defport, IPPROTO_UDP)) < 0) { xlog(L_FATAL, "%s: cannot make a UDP socket\n", name); } } + if (sock == RPC_ANYSOCK) + sock = svcudp_socket (prog, 1); transp = svcudp_create(sock); if (transp == NULL) { xlog(L_FATAL, "cannot create udp service."); @@ -99,11 +103,15 @@ rpc_init(char *name, int prog, int vers, void (*dispatch)(), int defport) transp = last_transp; goto tcp_transport; } - if ((sock = makesock(defport, IPPROTO_TCP)) < 0) { + if (defport == 0) + sock = RPC_ANYSOCK; + else if ((sock = makesock(defport, IPPROTO_TCP)) < 0) { xlog(L_FATAL, "%s: cannot make a TCP socket\n", name); } } + if (sock == RPC_ANYSOCK) + sock = svctcp_socket (prog, 1); transp = svctcp_create(sock, 0, 0); if (transp == NULL) { xlog(L_FATAL, "cannot create tcp service."); |