summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorAmgad Saleh <amgad.saleh@nokia.com>2019-05-23 20:27:03 -0500
committerAmar Tumballi <amarts@redhat.com>2019-05-28 17:10:05 +0000
commitbfe58919c03ea746aa6c7800fe698b15ca8c6ecb (patch)
tree327ab9325e604b37936034d91acbdf5e609ad026 /rpc
parent4a5fb52eb1c5387a0fb8bfa1253e5227c7c255e8 (diff)
If bind-address is IPv6 return it successfully
Change-Id: Ibd37b6ea82b781a1a266b95f7596874134f30079 fixes: bz#1713730 Signed-off-by: Amgad Saleh <amgad.saleh@nokia.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 ca14402..14c11cb 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: