From: Chuck Lever Date: Mon, 27 Sep 2010 14:09:10 +0000 (-0400) Subject: mountd: Support TI-RPC mountd listener X-Git-Tag: nfs-utils-1-2-3~10 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=b551b1fd0052de9b8c674b30c39d9f2a1e9d79cc;p=nfs-utils.git mountd: Support TI-RPC mountd listener If TI-RPC is available, use it to create mountd's svc listener. If not, use the old function, rpc_init(), to create mountd's listener. IPv6 can be supported if TI-RPC is available. In this case, /etc/netconfig is searched to determine which transports to advertise. Signed-off-by: Chuck Lever Signed-off-by: Steve Dickson --- diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c index 753fd37..a4fdcc8 100644 --- a/utils/mountd/mountd.c +++ b/utils/mountd/mountd.c @@ -86,6 +86,11 @@ static int version3(void) return nfs_version & NFSVERSBIT(3); } +static int version23(void) +{ + return nfs_version & (NFSVERSBIT(2) | NFSVERSBIT(3)); +} + static int version_any(void) { return nfs_version & NFSVERSBIT_ALL; @@ -95,11 +100,11 @@ static void unregister_services (void) { if (version2()) { - pmap_unset (MOUNTPROG, MOUNTVERS); - pmap_unset (MOUNTPROG, MOUNTVERS_POSIX); + nfs_svc_unregister(MOUNTPROG, MOUNTVERS); + nfs_svc_unregister(MOUNTPROG, MOUNTVERS_POSIX); } if (version3()) - pmap_unset (MOUNTPROG, MOUNTVERS_NFSV3); + nfs_svc_unregister(MOUNTPROG, MOUNTVERS_NFSV3); } static void @@ -687,6 +692,7 @@ main(int argc, char **argv) { char *export_file = _PATH_EXPORTS; char *state_dir = NFS_STATEDIR; + unsigned int listeners = 0; int foreground = 0; int port = 0; int descriptors = 0; @@ -830,14 +836,16 @@ main(int argc, char **argv) cache_open(); if (version2()) { - rpc_init("mountd", MOUNTPROG, MOUNTVERS, - mount_dispatch, port); - rpc_init("mountd", MOUNTPROG, MOUNTVERS_POSIX, - mount_dispatch, port); + listeners += nfs_svc_create("mountd", MOUNTPROG, + MOUNTVERS, mount_dispatch, port); + listeners += nfs_svc_create("mountd", MOUNTPROG, + MOUNTVERS_POSIX, mount_dispatch, port); } if (version3()) - rpc_init("mountd", MOUNTPROG, MOUNTVERS_NFSV3, - mount_dispatch, port); + listeners += nfs_svc_create("mountd", MOUNTPROG, + MOUNTVERS_NFSV3, mount_dispatch, port); + if (version23() && listeners == 0) + xlog(L_FATAL, "mountd: could not create listeners\n"); sa.sa_handler = killer; sigaction(SIGINT, &sa, NULL);