diff --git a/src/core/net-nonblock.c b/src/core/net-nonblock.c index 50f48e42..2f207bdf 100644 --- a/src/core/net-nonblock.c +++ b/src/core/net-nonblock.c @@ -267,7 +267,7 @@ int net_connect_nonblock(const char *server, int port, const IPADDR *my_ip, rec->pipes[1] = g_io_channel_new(fd[1]); /* start nonblocking host name lookup */ - net_gethostbyname_nonblock(server, rec->pipes[1], 0, 0); + net_gethostbyname_nonblock(server, rec->pipes[1], AF_UNSPEC, 0); rec->tag = g_input_add(rec->pipes[0], G_INPUT_READ, (GInputFunction) simple_readpipe, rec); diff --git a/src/core/network.c b/src/core/network.c index ec7aed6e..a94c1ca2 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -142,7 +142,7 @@ GIOChannel *net_connect(const char *addr, int port, IPADDR *my_ip) g_return_val_if_fail(addr != NULL, NULL); // XXX : should we use the my_ip->family instead ? - if (net_gethostbyname(addr, &ip, 0) == -1) + if (net_gethostbyname(addr, &ip, AF_UNSPEC) == -1) return NULL; return net_connect_ip(&ip, port, my_ip); @@ -406,7 +406,7 @@ int net_gethostbyname(const char *addr, IPADDR *ip, int family) memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_socktype = SOCK_STREAM; #ifdef HAVE_IPV6 - hints.ai_family = (family == 0) ? AF_UNSPEC : family; + hints.ai_family = family; #else hints.ai_family = AF_INET; #endif diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index 37cd5b8b..f4948030 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -56,7 +56,7 @@ static void get_source_host_ip(void) /* FIXME: This will block! */ hostname = settings_get_str("hostname"); source_host_ok = *hostname != '\0' && - net_gethostbyname(hostname, &source_host_ip, 0) == 0; + net_gethostbyname(hostname, &source_host_ip, AF_UNSPEC) == 0; } static void conn_set_ip(SERVER_CONNECT_REC *conn, const char *own_host, @@ -66,7 +66,7 @@ static void conn_set_ip(SERVER_CONNECT_REC *conn, const char *own_host, if (*own_ip == NULL) { /* resolve the IP */ - if (net_gethostbyname(own_host, &ip, 0) == 0) + if (net_gethostbyname(own_host, &ip, AF_UNSPEC) == 0) save_ips(&ip, own_ip); } @@ -103,6 +103,7 @@ static void server_setup_fill(SERVER_CONNECT_REC *conn, conn->address = g_strdup(address); if (port > 0) conn->port = port; + conn->family = AF_UNSPEC; if (strchr(address, '/') != NULL) conn->unix_socket = TRUE; diff --git a/src/irc/proxy/listen.c b/src/irc/proxy/listen.c index 27c7a0f2..13f2ab51 100644 --- a/src/irc/proxy/listen.c +++ b/src/irc/proxy/listen.c @@ -593,7 +593,7 @@ static void add_listen(const char *ircnet, int port) /* bind to specific host/ip? */ my_ip = NULL; if (*settings_get_str("irssiproxy_bind") != '\0') { - if (net_gethostbyname(settings_get_str("irssiproxy_bind"), &ip, 0) != 0) { + if (net_gethostbyname(settings_get_str("irssiproxy_bind"), &ip, AF_UNSPEC) != 0) { printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Proxy: can not resolve '%s' - aborting", settings_get_str("irssiproxy_bind"));