1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

Allow /SET dcc_own_ip to be non-local address.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3140 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2003-11-16 16:33:25 +00:00 committed by cras
parent f764a8665c
commit aa78361f24

View File

@ -245,16 +245,28 @@ GIOChannel *dcc_listen(GIOChannel *iface, IPADDR *ip, int *port)
GIOChannel *dcc_connect_ip(IPADDR *ip, int port) GIOChannel *dcc_connect_ip(IPADDR *ip, int port)
{ {
IPADDR *own_ip, temp_ip; IPADDR *own_ip, temp_ip;
const char *own_ip_str;
GIOChannel *handle;
if (*settings_get_str("dcc_own_ip") == '\0') { own_ip_str = settings_get_str("dcc_own_ip");
own_ip = IPADDR_IS_V6(ip) ? source_host_ip6 : source_host_ip4; own_ip = NULL;
} else { if (*own_ip_str != '\0') {
/* use the specified interface for connecting */ /* use the specified interface for connecting */
net_host2ip(settings_get_str("dcc_own_ip"), &temp_ip); net_host2ip(own_ip_str, &temp_ip);
if (IPADDR_IS_V6(ip) == IPADDR_IS_V6(&temp_ip))
own_ip = &temp_ip; own_ip = &temp_ip;
} }
return net_connect_ip(ip, port, own_ip); if (own_ip == NULL)
own_ip = IPADDR_IS_V6(ip) ? source_host_ip6 : source_host_ip4;
handle = net_connect_ip(ip, port, own_ip);
if (handle == NULL && errno == EADDRNOTAVAIL && own_ip != NULL) {
/* dcc_own_ip is external address */
own_ip = IPADDR_IS_V6(ip) ? source_host_ip6 : source_host_ip4;
handle = net_connect_ip(ip, port, own_ip);
}
return handle;
} }
/* Server connected - update server for DCC records that have /* Server connected - update server for DCC records that have