diff options
author | Kevin Vigor <kvigor@fb.com> | 2016-12-15 13:41:14 -0800 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2017-03-12 11:28:45 -0400 |
commit | eac6dfc314abe4dc50c54bf6c6cc004dfd73d5ac (patch) | |
tree | 1e412015264da4ec678924e7b0e76b1d5dce7d05 /rpc/rpc-transport/rdma/src/name.c | |
parent | b3ac24cdd759fb4cd2946329860bcc004f736b23 (diff) |
transport: allow OS to assign us a port
Replace complex and slow port selection code with bind(0) which
already respects privileged ports.
Change-Id: I408a8528e58e1aafcd32eba6a8f1a759e0bf274e
BUG: 1405628
Reviewed-on-release-3.8-fb: http://review.gluster.org/16150
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: https://review.gluster.org/16178
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'rpc/rpc-transport/rdma/src/name.c')
-rw-r--r-- | rpc/rpc-transport/rdma/src/name.c | 5 |
1 files changed, 5 insertions, 0 deletions
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 |