--- proxy-suite-1.9/ftp-proxy/ftp-client.c +++ proxy-suite-1.9/ftp-proxy/ftp-client.c Fri Jul 19 03:58:24 2002 @@ -64,6 +64,7 @@ #include #include #include +#include #include "com-config.h" #include "com-debug.h" @@ -1171,6 +1172,7 @@ struct sockaddr_in saddr; u_int16_t lprt, lowrng, res; int sock, incr, retry; + char *ifptr; /* ** should we bind a rand(port-range) or increment? @@ -1198,6 +1200,26 @@ } socket_opts(sock, SK_CONTROL); +#if defined(SO_BINDTODEVICE) + ifptr = config_str(NULL, "DestinationInterface", NULL); + if(NULL != ifptr && ifptr[0]) { + char ifname[IFNAMSIZ] = {'\0'}; + + misc_strncpy(ifname, ifptr, sizeof(ifname)); + if(0 == setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, + ifname, sizeof(ifname))) + { + syslog_write(T_DBG, + "Srv-Ctrl: socket bound to '%s'", + ifname); + } else { + syslog_write(T_WRN, + "Srv-Ctrl: can't boind to '%s'", + ifname); + } + } +#endif + /* ** check if we have to take care to a port range */