summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport/rdma
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-09-07 13:14:40 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-07 11:55:40 -0700
commit37f01b2714bba57b28b9125c3652b8e35db6504a (patch)
treec425361af3e7d411faa57426c4e560a9487bf8e0 /rpc/rpc-transport/rdma
parent270dffa378a651369d6727fa38ae99934d953259 (diff)
rpc-transport/rdma: honour port argument sent in rdma_connect.v3.1.0qa17
Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1555 (rdma remote port defaults to 6997) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1555
Diffstat (limited to 'rpc/rpc-transport/rdma')
-rw-r--r--rpc/rpc-transport/rdma/src/name.c42
-rw-r--r--rpc/rpc-transport/rdma/src/name.h3
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c2
3 files changed, 26 insertions, 21 deletions
diff --git a/rpc/rpc-transport/rdma/src/name.c b/rpc/rpc-transport/rdma/src/name.c
index fa8ecdd15ee..68cf578fa66 100644
--- a/rpc/rpc-transport/rdma/src/name.c
+++ b/rpc/rpc-transport/rdma/src/name.c
@@ -179,13 +179,13 @@ client_fill_address_family (rpc_transport_t *this, struct sockaddr *sockaddr)
static int32_t
af_inet_client_get_remote_sockaddr (rpc_transport_t *this,
struct sockaddr *sockaddr,
- socklen_t *sockaddr_len)
+ socklen_t *sockaddr_len,
+ int16_t remote_port)
{
dict_t *options = this->options;
data_t *remote_host_data = NULL;
data_t *remote_port_data = NULL;
char *remote_host = NULL;
- uint16_t remote_port = 0;
struct addrinfo *addr_info = NULL;
int32_t ret = 0;
@@ -209,22 +209,24 @@ af_inet_client_get_remote_sockaddr (rpc_transport_t *this,
goto err;
}
- remote_port_data = dict_get (options, "remote-port");
- if (remote_port_data == NULL)
- {
- gf_log (this->name, GF_LOG_DEBUG,
- "option remote-port missing in volume %s. "
- "Defaulting to %d",
- this->name, GF_DEFAULT_RDMA_LISTEN_PORT);
+ if (remote_port == 0) {
+ remote_port_data = dict_get (options, "remote-port");
+ if (remote_port_data == NULL)
+ {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "option remote-port missing in volume %s. "
+ "Defaulting to %d",
+ this->name, GF_DEFAULT_RDMA_LISTEN_PORT);
- remote_port = GF_DEFAULT_RDMA_LISTEN_PORT;
- }
- else
- {
- remote_port = data_to_uint16 (remote_port_data);
+ remote_port = GF_DEFAULT_RDMA_LISTEN_PORT;
+ }
+ else
+ {
+ remote_port = data_to_uint16 (remote_port_data);
+ }
}
- if (remote_port == (uint16_t)-1)
+ if (remote_port == -1)
{
gf_log (this->name, GF_LOG_ERROR,
"option remote-port has invalid port in volume %s",
@@ -459,8 +461,9 @@ gf_rdma_client_bind (rpc_transport_t *this,
int32_t
gf_rdma_client_get_remote_sockaddr (rpc_transport_t *this,
- struct sockaddr *sockaddr,
- socklen_t *sockaddr_len)
+ struct sockaddr *sockaddr,
+ socklen_t *sockaddr_len,
+ int16_t remote_port)
{
int32_t ret = 0;
char is_inet_sdp = 0;
@@ -481,8 +484,9 @@ gf_rdma_client_get_remote_sockaddr (rpc_transport_t *this,
case AF_INET6:
case AF_UNSPEC:
ret = af_inet_client_get_remote_sockaddr (this,
- sockaddr,
- sockaddr_len);
+ sockaddr,
+ sockaddr_len,
+ remote_port);
if (is_inet_sdp) {
sockaddr->sa_family = AF_INET_SDP;
diff --git a/rpc/rpc-transport/rdma/src/name.h b/rpc/rpc-transport/rdma/src/name.h
index bd5e3ce6f88..681665d25ab 100644
--- a/rpc/rpc-transport/rdma/src/name.h
+++ b/rpc/rpc-transport/rdma/src/name.h
@@ -34,7 +34,8 @@ gf_rdma_client_bind (rpc_transport_t *this,
int32_t
gf_rdma_client_get_remote_sockaddr (rpc_transport_t *this,
struct sockaddr *sockaddr,
- socklen_t *sockaddr_len);
+ socklen_t *sockaddr_len,
+ int16_t remote_port);
int32_t
gf_rdma_server_get_local_sockaddr (rpc_transport_t *this,
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index ccc759e7985..cd42c6e94e4 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -4405,7 +4405,7 @@ rdma_connect (struct rpc_transport *this, int port)
ret = gf_rdma_client_get_remote_sockaddr (this,
(struct sockaddr *)&sockaddr,
- &sockaddr_len);
+ &sockaddr_len, port);
if (ret != 0) {
gf_log (this->name, GF_LOG_DEBUG,
"cannot get remote address to connect");