summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorAmgad Saleh <amgad.saleh@nokia.com>2019-05-23 20:27:03 -0500
committerSunny Kumar <sunkumar@redhat.com>2019-05-29 11:37:24 +0000
commit8c0bb45c9f002461d5c4a63e35ae215958405fb5 (patch)
tree40e73f2a64a5c435d6963ff811b22987f100fa87 /rpc
parent630b896166fe7d718958bcf57faad4985572ea05 (diff)
If bind-address is IPv6 return it successfully
>Change-Id: Ibd37b6ea82b781a1a266b95f7596874134f30079 >fixes: bz#1713730 >Signed-off-by: Amgad Saleh <amgad.saleh@nokia.com> fixes: bz#1715012 Change-Id: I9a9877b6c32a1ccbd119301a4225808ddaa02de4 Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-transport/socket/src/name.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c
index ca14402ed4a..14c11cb835f 100644
--- a/rpc/rpc-transport/socket/src/name.c
+++ b/rpc/rpc-transport/socket/src/name.c
@@ -362,6 +362,9 @@ af_inet_server_get_local_sockaddr(rpc_transport_t *this, struct sockaddr *addr,
dict_t *options = NULL;
int32_t ret = 0;
+ /* initializes addr_len */
+ *addr_len = 0;
+
options = this->options;
listen_port_data = dict_get(options, "transport.socket.listen-port");
@@ -413,11 +416,13 @@ af_inet_server_get_local_sockaddr(rpc_transport_t *this, struct sockaddr *addr,
}
}
- if (!(*addr_len) && res && res->ai_addr) {
- memcpy(addr, res->ai_addr, res->ai_addrlen);
- *addr_len = res->ai_addrlen;
- } else {
- ret = -1;
+ if (!(*addr_len)) {
+ if (res && res->ai_addr) {
+ memcpy(addr, res->ai_addr, res->ai_addrlen);
+ *addr_len = res->ai_addrlen;
+ } else {
+ ret = -1;
+ }
}
freeaddrinfo(res);
@@ -596,7 +601,7 @@ socket_server_get_local_sockaddr(rpc_transport_t *this, struct sockaddr *addr,
switch (addr->sa_family) {
case AF_INET_SDP:
addr->sa_family = AF_INET;
- /* Fall through */
+ /* Fall through */
case AF_INET:
case AF_INET6:
case AF_UNSPEC: