Subject: Re: net/ipv4: commit d0733d2e29b breaks rtorrent

From: Fabienne Ducroquet <[email-masked]>
Date: Wed, 22 Jun 2011 16:51:44 +0200

On Wed, Jun 22, 2011 at 03:24:53PM +0200, Reinhard Max wrote:
> On Wed, 22 Jun 2011 at 14:47, Marcus Meissner wrote:
> 
> >Can you show us the code surrounding the bind in rtorrent?

Since I'm not a developer of rtorrent I'm not sure what the right code 
to show is, so I leave that to the developer of libtorrent/rtorrent, he 
is CC'ed.

> ... or short of that, the output of "strace -e socket,bind" when
> starting rtorrent with the kernel patch not reverted?

Here it is :

socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP) = -1 EAFNOSUPPORT (Address family not supported by protocol)
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5
bind(5, {sa_family=AF_INET6, sin6_port=htons(6903), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 EINVAL (Invalid argument)

[ 95 lines with only the number in parentheses after htons changing ]

bind(5, {sa_family=AF_INET6, sin6_port=htons(6999), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 EINVAL (Invalid argument)
socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP) = -1 EAFNOSUPPORT (Address family not supported by protocol)
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5
bind(5, {sa_family=AF_INET6, sin6_port=htons(6881), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 EINVAL (Invalid argument)

[ 21 lines with only the number in parentheses after htons changing ]

bind(5, {sa_family=AF_INET6, sin6_port=htons(6903), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 EINVAL (Invalid argument)

If I understand correctly, it is trying to bind an IPv6 address to a socket 
expecting an IPv4 address, so it's a bug in libtorrent/rtorrent, but it was not 
visible before because an INADDR_ANY bind is not a problem for rtorrent?

Fabienne