summaryrefslogtreecommitdiffstats
path: root/support/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'support/nfs')
-rw-r--r--support/nfs/Makefile3
-rw-r--r--support/nfs/rpcmisc.c12
2 files changed, 12 insertions, 3 deletions
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.");