diff options
author | Raghavendra G <raghavendra@gluster.com> | 2010-09-07 13:14:40 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-07 11:55:40 -0700 |
commit | 37f01b2714bba57b28b9125c3652b8e35db6504a (patch) | |
tree | c425361af3e7d411faa57426c4e560a9487bf8e0 /rpc/rpc-transport/rdma/src/name.c | |
parent | 270dffa378a651369d6727fa38ae99934d953259 (diff) |
rpc-transport/rdma: honour port argument sent in rdma_connect.
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/src/name.c')
-rw-r--r-- | rpc/rpc-transport/rdma/src/name.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/rpc/rpc-transport/rdma/src/name.c b/rpc/rpc-transport/rdma/src/name.c index fa8ecdd15..68cf578fa 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; |