summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport/socket
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2016-04-04 16:15:18 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-04-06 10:08:41 -0700
commit7370633b6404bbd3c8238b464bc413689dcccf93 (patch)
tree1fe1c6c8cd77a87866e4708906c21db719274972 /rpc/rpc-transport/socket
parent6e3b4eae1ae559d16721f765294ab30a270820d0 (diff)
rpc: assign port only if it is unreserved
Current order: assign port; check for port; if reserved { port--; continue to i; } bind(); basically, we are assigning port first then checking if it is reserved Fix: get unreserved port; assign port; bind(); from now, we get unreserved port first and then assign it Change-Id: I004580c5215e7c9cae3594af6405b20fcd9fa4ad BUG: 1323659 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Reviewed-on: http://review.gluster.org/13900 Tested-by: Prasanna Kumar Kalever <pkalever@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'rpc/rpc-transport/socket')
-rw-r--r--rpc/rpc-transport/socket/src/name.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c
index a8cf04d8ab7..725a8c18120 100644
--- a/rpc/rpc-transport/socket/src/name.c
+++ b/rpc/rpc-transport/socket/src/name.c
@@ -56,12 +56,14 @@ af_inet_bind_to_port_lt_ceiling (int fd, struct sockaddr *sockaddr,
while (port)
{
- _assign_port (sockaddr, port);
// ignore the reserved ports
if (ports[port] == _gf_true) {
port--;
continue;
}
+
+ _assign_port (sockaddr, port);
+
ret = bind (fd, sockaddr, sockaddr_len);
if (ret == 0)