Pass the right socket address length to bind() in client connections with
IPv6 enabled. This fixes an issue reported by packet, where IPv4 conections don't work on FreeBSD when the client is built with IPv6 support and you have a local hostname set (with /hostname, -H or IRCHOST). Also ensure we clear the full size of the 'server' address structure - doesn't fix a known problem but is a defensive measure. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@181 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -520,7 +520,7 @@ int BX_connect_by_number(char *hostn, unsigned short *portnum, int service, int
|
||||
}
|
||||
#endif
|
||||
|
||||
memset(&server, 0, sizeof(struct sockaddr_in));
|
||||
memset(&server, 0, sizeof server);
|
||||
#ifndef WINNT
|
||||
|
||||
#ifdef IPV6
|
||||
@@ -554,7 +554,7 @@ int BX_connect_by_number(char *hostn, unsigned short *portnum, int service, int
|
||||
|
||||
if (LocalHostName && !getaddrinfo(LocalHostName, NULL, &hints, &res) && res)
|
||||
{
|
||||
if (bind(fd, (struct sockaddr *) res->ai_addr, sizeof(struct sockaddr_foobar)))
|
||||
if (bind(fd, (struct sockaddr *) res->ai_addr, res->ai_addrlen))
|
||||
return close(fd), -2;
|
||||
freeaddrinfo(res);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user