Support binding AF_INET6 sockets to reserved ports in get_socket(). Signed-off-by: Chuck Lever <[EMAIL PROTECTED]> ---
utils/mount/Makefile.am | 4 ++++ utils/mount/network.c | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletions(-) diff --git a/utils/mount/Makefile.am b/utils/mount/Makefile.am index 27a01de..03a02be 100644 --- a/utils/mount/Makefile.am +++ b/utils/mount/Makefile.am @@ -18,6 +18,10 @@ mount_nfs_SOURCES = mount.c error.c network.c fstab.c token.c parse_opt.c \ mount_nfs_LDADD = ../../support/nfs/libnfs.a \ ../../support/export/libexport.a +if CONFIG_IPV6 +mount_nfs_LDADD += ../../support/misc/libmisc.a +endif + MAINTAINERCLEANFILES = Makefile.in install-exec-hook: diff --git a/utils/mount/network.c b/utils/mount/network.c index da0eb1a..5720a4e 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -254,6 +254,24 @@ static int __nfs_gs_err_connect(const int socket, const struct sockaddr *saddr, return __nfs_gs_err_done(error); } +#ifdef IPV6_SUPPORTED +static int __nfs_bindresvport(const int socket, struct sockaddr *sap) +{ + switch (sap->sa_family) { + case AF_INET: + return bindresvport(socket, (struct sockaddr_in *)sap); + case AF_INET6: + return bindresvport6(socket, (struct sockaddr_in6 *)sap); + } + return EAFNOSUPPORT; +} +#else +static int __nfs_bindresvport(const int socket, struct sockaddr *sap) +{ + return bindresvport(socket, (struct sockaddr_in *)sap); +} +#endif + /* * Attempt to connect a socket, but time out after "timeout" seconds. * @@ -325,7 +343,7 @@ static int get_socket(struct sockaddr_in *saddr, unsigned int p_prot, laddr.sin_port = 0; laddr.sin_addr.s_addr = htonl(INADDR_ANY); if (resvp) { - if (bindresvport(so, &laddr) < 0) + if (__nfs_bindresvport(so, (struct sockaddr *)&laddr) < 0) return __nfs_gs_err_bindresvport(so, p_prot, errno); } else { if (bind(so, (struct sockaddr *)&laddr, namelen) < 0) - To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html