rpc: change client insecure port ceiling from 65535 to 49151

current port allocation to various processes (clumsy):

 1023 - 1       -> client ports range if bind secure is turned on
49151 - 1024    -> fall back to this, if in above case ports exhaust
65535 - 1024    -> client port range if bind insecure is on
49152 - 65535   -> brick port range

now, we have segregated port ranges 0 - 65535 to below 3 ranges

 1023 - 1       -> client ports range if bind secure is turned on
49151 - 1024    -> client port range if bind insecure is on
                   (fall back to this, if in above case ports exhaust)
49152 - 65535   -> brick port range

so now we have a clean segregation of port mapping

Change-Id: Ie3b4e7703e0bbeabbe0adbdd6c60d9ef78ef7c65
BUG: 1335776
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Reviewed-on: http://review.gluster.org/14326
Tested-by: Prasanna Kumar Kalever <pkalever@redhat.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
This commit is contained in:
Prasanna Kumar Kalever 2016-05-13 13:17:16 +05:30 committed by Raghavendra G
parent 6a6b953d4f
commit 58615482ed
2 changed files with 17 additions and 11 deletions

View File

@ -448,8 +448,8 @@ gf_rdma_client_bind (rpc_transport_t *this, struct sockaddr *sockaddr,
case AF_INET6:
if (!this->bind_insecure) {
ret = af_inet_bind_to_port_lt_ceiling (cm_id, sockaddr,
*sockaddr_len,
GF_CLIENT_PORT_CEILING);
*sockaddr_len,
GF_CLIENT_PORT_CEILING);
if (ret == -1) {
gf_msg (this->name, GF_LOG_WARNING, errno,
RDMA_MSG_PORT_BIND_FAILED,
@ -458,13 +458,14 @@ gf_rdma_client_bind (rpc_transport_t *this, struct sockaddr *sockaddr,
}
} else {
ret = af_inet_bind_to_port_lt_ceiling (cm_id, sockaddr,
*sockaddr_len,
GF_PORT_MAX);
*sockaddr_len,
GF_IANA_PRIV_PORTS_START);
if (ret == -1) {
gf_msg (this->name, GF_LOG_WARNING, errno,
RDMA_MSG_PORT_BIND_FAILED,
"cannot bind rdma_cm_id to port "
"less than %d", GF_PORT_MAX);
"less than %d",
GF_IANA_PRIV_PORTS_START);
}
}
break;

View File

@ -459,20 +459,25 @@ client_bind (rpc_transport_t *this,
case AF_INET6:
if (!this->bind_insecure) {
ret = af_inet_bind_to_port_lt_ceiling (sock, sockaddr,
*sockaddr_len, GF_CLIENT_PORT_CEILING);
*sockaddr_len,
GF_CLIENT_PORT_CEILING);
if (ret == -1) {
gf_log (this->name, GF_LOG_DEBUG,
"cannot bind inet socket (%d) to port less than %d (%s)",
sock, GF_CLIENT_PORT_CEILING, strerror (errno));
"cannot bind inet socket (%d) "
"to port less than %d (%s)",
sock, GF_CLIENT_PORT_CEILING,
strerror (errno));
ret = 0;
}
} else {
ret = af_inet_bind_to_port_lt_ceiling (sock, sockaddr,
*sockaddr_len, GF_PORT_MAX);
*sockaddr_len,
GF_IANA_PRIV_PORTS_START);
if (ret == -1) {
gf_log (this->name, GF_LOG_DEBUG,
"failed while binding to less than %d (%s)",
GF_PORT_MAX, strerror (errno));
"failed while binding to less than "
"%d (%s)", GF_IANA_PRIV_PORTS_START,
strerror (errno));
ret = 0;
}
}