diff options
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | rpc/rpc-transport/rdma/src/name.c | 5 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/name.c | 5 |
3 files changed, 21 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 28ff3e5a3f4..3d796a01128 100644 --- a/configure.ac +++ b/configure.ac @@ -301,6 +301,16 @@ else CFLAGS="${CFLAGS} -g -O2" fi +AC_ARG_ENABLE([privport_tracking], + AC_HELP_STRING([--disable-privport_tracking], + [Disable internal tracking of privileged ports.])) +TRACK_PRIVPORTS="yes" +if test x"$enable_privport_tracking" = x"no"; then + TRACK_PRIVPORTS="no" + AC_DEFINE(GF_DISABLE_PRIVPORT_TRACKING, 1, + [Disable internal tracking of privileged ports.]) +fi + case $host_os in darwin*) if ! test "`/usr/bin/sw_vers | grep ProductVersion: | cut -f 2 | cut -d. -f2`" -ge 7; then @@ -1544,6 +1554,7 @@ echo "Use syslog : $USE_SYSLOG" echo "XML output : $BUILD_XML_OUTPUT" echo "Encryption xlator : $BUILD_CRYPT_XLATOR" echo "Unit Tests : $BUILD_UNITTEST" +echo "Track priv ports : $TRACK_PRIVPORTS" echo "POSIX ACLs : $BUILD_POSIX_ACLS" echo "Data Classification : $BUILD_GFDB" echo "firewalld-config : $BUILD_FIREWALLD" diff --git a/rpc/rpc-transport/rdma/src/name.c b/rpc/rpc-transport/rdma/src/name.c index 5064427e01e..be7490abac1 100644 --- a/rpc/rpc-transport/rdma/src/name.c +++ b/rpc/rpc-transport/rdma/src/name.c @@ -54,6 +54,10 @@ af_inet_bind_to_port_lt_ceiling (struct rdma_cm_id *cm_id, struct sockaddr *sockaddr, socklen_t sockaddr_len, uint32_t ceiling) { +#if GF_DISABLE_PRIVPORT_TRACKING + _assign_port (sockaddr, 0); + return rdma_bind_addr (cm_id, sockaddr); +#else int32_t ret = -1; uint16_t port = ceiling - 1; unsigned char ports[GF_PORT_ARRAY_SIZE] = {0,}; @@ -100,6 +104,7 @@ loop: } return ret; +#endif /* GF_DISABLE_PRIVPORT_TRACKING */ } #if 0 diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c index acd1dc7b55e..e9de1a78813 100644 --- a/rpc/rpc-transport/socket/src/name.c +++ b/rpc/rpc-transport/socket/src/name.c @@ -42,6 +42,10 @@ static int32_t af_inet_bind_to_port_lt_ceiling (int fd, struct sockaddr *sockaddr, socklen_t sockaddr_len, uint32_t ceiling) { +#if GF_DISABLE_PRIVPORT_TRACKING + _assign_port (sockaddr, 0); + return bind (fd, sockaddr, sockaddr_len); +#else int32_t ret = -1; uint16_t port = ceiling - 1; unsigned char ports[GF_PORT_ARRAY_SIZE] = {0,}; @@ -88,6 +92,7 @@ loop: } return ret; +#endif /* GF_DISABLE_PRIVPORT_TRACKING */ } static int32_t |