diff -ur rsync-2.6.9.orig/clientserver.c rsync-2.6.9/clientserver.c --- rsync-2.6.9.orig/clientserver.c 2006-10-23 17:36:42.000000000 -0700 +++ rsync-2.6.9/clientserver.c 2008-04-02 15:09:32.000000000 -0700 @@ -103,8 +103,6 @@ if (fd == -1) exit_cleanup(RERR_SOCKETIO); - set_socket_options(fd, sockopts); - ret = start_inband_exchange(user, path, fd, fd, argc); return ret ? ret : client_run(fd, fd, -1, argc, argv); @@ -746,10 +744,6 @@ if (!am_server) { set_socket_options(f_in, "SO_KEEPALIVE"); - if (sockopts) - set_socket_options(f_in, sockopts); - else - set_socket_options(f_in, lp_socket_options()); set_nonblocking(f_in); } diff -ur rsync-2.6.9.orig/socket.c rsync-2.6.9/socket.c --- rsync-2.6.9.orig/socket.c 2006-10-31 11:21:57.000000000 -0800 +++ rsync-2.6.9/socket.c 2008-04-02 15:08:58.000000000 -0700 @@ -31,6 +31,7 @@ #include extern char *bind_address; +extern char *sockopts; extern int default_af_hint; #ifdef HAVE_SIGACTION @@ -261,6 +262,7 @@ s = -1; continue; } + set_socket_options(s, sockopts); if (connect(s, res->ai_addr, res->ai_addrlen) < 0) { close(s); s = -1; @@ -375,6 +377,10 @@ setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof one); + if (sockopts) + set_socket_options(s, sockopts); + else + set_socket_options(s, lp_socket_options()); #ifdef IPV6_V6ONLY if (resp->ai_family == AF_INET6) {