Signed-off-by: Corentin Chary <corentin.chary@xxxxxxxxx> --- transport/socket/src/name.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/transport/socket/src/name.c b/transport/socket/src/name.c index bb41c1c..ce9a723 100644 --- a/transport/socket/src/name.c +++ b/transport/socket/src/name.c @@ -19,6 +19,7 @@ #include <sys/types.h> #include <sys/socket.h> +#include <netinet/in.h> #include <errno.h> #include <netdb.h> #include <string.h> @@ -368,7 +369,21 @@ af_inet_server_get_local_sockaddr (transport_t *this, if (listen_host_data) { listen_host = data_to_str (listen_host_data); - } + } else { + if (addr->sa_family == AF_INET6) { + struct sockaddr_in6 *in = (struct sockaddr_in6 *) addr; + in->sin6_addr = in6addr_any; + in->sin6_port = htons(listen_port); + *addr_len = sizeof(struct sockaddr_in6); + return 0; + } else if (addr->sa_family == AF_INET) { + struct sockaddr_in *in = (struct sockaddr_in *) addr; + in->sin_addr.s_addr = htonl(INADDR_ANY); + in->sin_port = htons(listen_port); + *addr_len = sizeof(struct sockaddr_in); + return 0; + } + } memset (service, 0, sizeof (service)); sprintf (service, "%d", listen_port); -- 1.6.4.4