diff -ur dircproxy-1.0.2.orig/src/cfgfile.c dircproxy-1.0.2/src/cfgfile.c --- dircproxy-1.0.2.orig/src/cfgfile.c Fri Dec 21 21:17:06 2001 +++ dircproxy-1.0.2/src/cfgfile.c Tue Jan 29 01:45:44 2002 @@ -121,6 +121,7 @@ def->log_events = DEFAULT_LOG_EVENTS; def->dcc_proxy_incoming = DEFAULT_DCC_PROXY_INCOMING; def->dcc_proxy_outgoing = DEFAULT_DCC_PROXY_OUTGOING; + def->dcc_proxy_use_saddr = DEFAULT_DCC_PROXY_USE_SADDR; def->dcc_proxy_ports = 0; def->dcc_proxy_ports_sz = 0; def->dcc_proxy_timeout = DEFAULT_DCC_PROXY_TIMEOUT; @@ -785,6 +786,11 @@ /* dcc_proxy_outgoing yes dcc_proxy_outgoing no */ _cfg_read_bool(&buf, &(class ? class : def)->dcc_proxy_outgoing); + + } else if (!strcasecmp(key, "dcc_proxy_use_saddr")) { + /* dcc_proxy_use_saddr yes + dcc_proxy_use_saddr no */ + _cfg_read_bool(&buf, &(class ? class : def)->dcc_proxy_use_saddr); } else if (!strcasecmp(key, "dcc_proxy_ports")) { /* dcc_proxy_ports any diff -ur dircproxy-1.0.2.orig/src/dircproxy.h dircproxy-1.0.2/src/dircproxy.h --- dircproxy-1.0.2.orig/src/dircproxy.h Fri Dec 21 21:15:55 2001 +++ dircproxy-1.0.2/src/dircproxy.h Tue Jan 29 01:47:08 2002 @@ -448,6 +448,13 @@ */ #define DEFAULT_DCC_PROXY_OUTGOING 1 +/* DEFAULT_DCC_PROXY_USE_SADDR + * Whether to use clients source address instead of the one given in the DCC request + * 1 = Yes + * 0 = No + */ +#define DEFAULT_DCC_PROXY_USE_SADDR 0 + /* DEFAULT_DCC_PROXY_PORTS * This MUST be left at 0, trust me */ diff -ur dircproxy-1.0.2.orig/src/irc_client.c dircproxy-1.0.2/src/irc_client.c --- dircproxy-1.0.2.orig/src/irc_client.c Fri Dec 21 21:15:55 2001 +++ dircproxy-1.0.2/src/irc_client.c Tue Jan 29 01:48:42 2002 @@ -520,7 +520,9 @@ /* Eww, host order, how the hell does this even work between machines of a different byte order? */ if (!t_port) { - r_addr.s_addr = strtoul(cmsg.params[2], (char **)NULL, 10); + r_addr.s_addr = p->conn_class->dcc_proxy_use_saddr + ? ntohl(p->client_addr.sin_addr.s_addr) + : strtoul(cmsg.params[2], (char **)NULL, 10); r_port = atoi(cmsg.params[3]); } else { r_addr.s_addr = INADDR_LOOPBACK; diff -ur dircproxy-1.0.2.orig/src/irc_net.h dircproxy-1.0.2/src/irc_net.h --- dircproxy-1.0.2.orig/src/irc_net.h Fri Dec 21 21:15:55 2001 +++ dircproxy-1.0.2/src/irc_net.h Tue Jan 29 01:44:21 2002 @@ -99,6 +99,7 @@ int dcc_proxy_incoming; int dcc_proxy_outgoing; + int dcc_proxy_use_saddr; int *dcc_proxy_ports; size_t dcc_proxy_ports_sz; long dcc_proxy_timeout;