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:
@@ -1,7 +1,7 @@
|
|||||||
[Changes 1.2c01]
|
[Changes 1.2c01]
|
||||||
|
|
||||||
* Fix known problem with IPv6 on FreeBSD and enable IPv6 on all supporting
|
* Fix known problem with IPv6 on FreeBSD and enable IPv6 on all supporting
|
||||||
platforms. Thanks to brabes and snadge. (caf)
|
platforms. Thanks to brabes, snadge and packet. (caf)
|
||||||
|
|
||||||
* Improve connect() error handling. (caf)
|
* Improve connect() error handling. (caf)
|
||||||
|
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ int BX_connect_by_number(char *hostn, unsigned short *portnum, int service, int
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(&server, 0, sizeof(struct sockaddr_in));
|
memset(&server, 0, sizeof server);
|
||||||
#ifndef WINNT
|
#ifndef WINNT
|
||||||
|
|
||||||
#ifdef IPV6
|
#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 (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;
|
return close(fd), -2;
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user