mirror of
https://github.com/irssi/irssi.git
synced 2026-08-23 18:42:53 +02:00
Pass AF_UNSPEC to net_gethostbyname instead of 0
0 might be a valid family.
This commit is contained in:
parent
32c33357d3
commit
aeb3cd9dbf
4 changed files with 7 additions and 6 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue