Martin Kjeldsen said:> Hi,
>
> I've a problem with rsync 2.6.2 and the daemon. I've installed it
precisly
> as I did with 2.6.0 (I've tried before with 2.6.1 and was having the
same
> problems as now with 2.6.2).
>
> When I try to a rsync --daemon command the rsync offcourse finishes, but in
> the log file it says
>
> 2004/05/04 21:15:10 [22369] rsyncd version 2.6.2 starting, listening on
port
> 873
> 2004/05/04 21:15:10 [22369] rsync error: error in socket IO (code 10) at
> socket.c(466)
I've got the exact same problem here. For me at least,it appears that rsync
is
trying to bind to the same address twice. Below is an excerpt from
'strace rsync --daemon':
socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP) = 4
setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(4, SOL_IPV6, 26, [1], 4) = -1 ENOPROTOOPT (Protocol not
available)
bind(4, {sa_family=AF_INET6, sin6_port=htons(873), inet_pton(AF_INET6,
"::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5
setsockopt(5, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(5, {sa_family=AF_INET, sin_port=htons(873),
sin_addr=inet_addr("0.0.0.0")}, 16) = 0
listen(4, 5) = 0
listen(5, 5) = -1 EADDRINUSE (Address already in use)
close(4) = 0
close(5) = 0
I haven't really done any network programming, so I'm not exactly sure
what's going on
in this section of the code, but it looks like rsync tries to set a flag on the
IPV6
socket indicating that its only to be used for IPV6. In this case the IPV6
socket is for
the :: address, so when rsync starts to listen on that address, it also starts
listening
on 0.0.0.0. However, it has also opened a separate IPV4 socket for 0.0.0.0, and
when it
tries to listen on that socket, it gets back an error saying the address is in
use, and
like a good little program, closes everything up and shuts down. Even though
it's the one
using that address.
Looking at the code, the second call to setsockopt() is in an #ifdef'd
section which looks for
#IPV6_V6ONLY. I have no idea where this macro is defined--I couldn't find it
in config.h, which
is where I expected to find it. Of course socket.c doesn't include config.h
anyway, so I really
have no idea:) Also, it doesn't look to me like there's anything that
the code is doing wrong...
the problem is just that failing setsockopt() call which apparently is supposed
to alleviate the
problem on systems where you have to specify that an IPV6 address is only for
IPV6, and on those
that you don't, I would assume that it's not a problem.
Alright, now that I've found the problem, someone who knows how to fix it,
fix it:) Or tell me that
I'm wrong about the problem--that's fine too:)
Greg