nfs-utils: Introduce fallback bindresvport6() implementation
Subsystems (2)
PATCH 4/17 nfs-utils: Introduce fallback bindresvport6() implementation
The bindresvport() function, available in glibc, is used to select an ephemeral reserved port before connecting a socket. However, it is IPv4-specific. To support IPv6 sockets, we require a way to select an ephemeral reserved port for PF_INET6 sockets. Usually this facility is provided by bindresvport6().
Even though netinet/in.h on Linux has a prototype for bindresvport6(), it doesn't currently appear in any standard library on Linux, and there's no man page for it.
Thus we introduce our own implementation of bindresvport6() in the nfs-utils support library which is compiled in when autoconf doesn't find a version of bindresvport6() to use from the standard libraries.
---
configure.ac | 5 + support/misc/Makefile.am | 5 + support/misc/bindresvport.c | 144 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+), 0 deletions(-)
configure.ac +5 -0
@@ -294,6 +294,11 @@ AC_CHECK_FUNCS([alarm atexit dup2 fdatasync ftruncate getcwd \ realpath rmdir select socket strcasecmp strchr strdup \ strerror strrchr strtol strtoul sigprocmask]) +have_bindresvport6=none +if test "$enable_ipv6" = yes; then + AC_CHECK_FUNC(bindresvport6, [have_bindresvport6=lib]) +fi +AM_CONDITIONAL(CONFIG_BRP6, [test "$have_bindresvport6" = "none"]) dnl ************************************************************* dnl Check for data sizes
support/misc/Makefile.am +5 -0
@@ -3,4 +3,9 @@ noinst_LIBRARIES = libmisc.a libmisc_a_SOURCES = tcpwrapper.c from_local.c mountpoint.c +if CONFIG_BRP6 +libmisc_a_SOURCES += bindresvport.c +endif + + MAINTAINERCLEANFILES = Makefile.in
support/misc/bindresvport.c new file +144 -0
144 lines not on this page · raw message