rtorrent 0.9.7 does not start without kernel IPv6 support

Created on 8 Jun 2018  路  9Comments  路  Source: rakshasa/rtorrent

It looks like the --disable-ipv6 flag was removed at some point, so that's no longer an option for disabling IPv6 support.

When built without this flag and started with a default configuration, rtorrent will fail to start with:
rtorrent: Could not open/bind port for listening: Address family not supported by protocol.

strace:

socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP) = -1 EAFNOSUPPORT (Address family not supported by protocol)
socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 12
[...]
bind(12, {sa_family=AF_INET6, sin6_port=htons(6997), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = -1 EAFNOSUPPORT (Address family not supported by protocol)
bind(12, {sa_family=AF_INET6, sin6_port=htons(6998), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = -1 EAFNOSUPPORT (Address family not supported by protocol)
bind(12, {sa_family=AF_INET6, sin6_port=htons(6999), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = -1 EAFNOSUPPORT (Address family not supported by protocol)
close(12)                               = 0
socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP) = -1 EAFNOSUPPORT (Address family not supported by protocol)
socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 12
fcntl(12, F_SETFL, O_RDONLY|O_NONBLOCK) = 0
setsockopt(12, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(12, {sa_family=AF_INET6, sin6_port=htons(6881), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = -1 EAFNOSUPPORT (Address family not supported by protocol)
bind(12, {sa_family=AF_INET6, sin6_port=htons(6882), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = -1 EAFNOSUPPORT (Address family not supported by protocol)
[...]

While this is able to be worked around by using a configuration with a bind address of 0.0.0.0 (or similar), it would be nice if this setup worked by default.

Most helpful comment

I think those issues will be possible to resolve (once feature-bind is completed) using rtorrent.rc config options.

E.g. listen only to ipv4 and only allow incoming/outgoing ipv4 connections.

All 9 comments

When built without this flag and started with a default configuration, rtorrent will fail to start

Are we talking about a box that doesn't support IPv6?

@chros73 Yes, such as a Linux kernel that is missing IPv6 kernel support.

I'm not sure if this would effect other platforms or how common missing IPv6 is, but it feels like if a simple fix is possible, it would be worth doing.

I think those issues will be possible to resolve (once feature-bind is completed) using rtorrent.rc config options.

E.g. listen only to ipv4 and only allow incoming/outgoing ipv4 connections.

@Bigun As per the previous comments in this thread, you can add "bind 0.0.0.0" in your configuration to work around this.

FIX: put in your actual IP in your .rtorrent.rc file. example: your IP is 1.2.3.4 put in: bind = "1.2.3.4"

Tests:
If you disable ipv6 on your server, starting up rtorrent raises this error: _rtorrent: Could not open/bind port for listening: Address family not supported by protocol_

If you throw a "bind = 0.0.0.0" in your .rtorrent.rc - you get this success error lol: _rtorrent: Could not open/bind port for listening: Success_

If you throw your actual ip of your nic in "bind = 197.198.199.200" your .rtorrent.rc - it works and rtorrent starts.

Hello,

I could not use the "network.bind_address.set=" option with an actual NIC address, as I need rtorrent to bind (listen) on an interface which often changes its IP (VPN interface).

As stated by carodol, "network.bind_address.set=0.0.0.0" does not work.

I finally got it to work with :
network.scgi.open_port = 0.0.0.0:6000
though netstat still shows it as a tcp6 socket, it's still reachable with ipv4 connection.
tcp6 0 0 0.0.0.0:6000 :::* LISTEN 39145/rtorrent

You really shouldn't use tcp for scgi, use unix sockets.

And support for binding to interface will be added later.

network.scgi.open_port = 0.0.0.0:6000

You forgot adding the "bitcoin miners please pwn me" comment with that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mhertz picture mhertz  路  6Comments

vinz243 picture vinz243  路  4Comments

frankvw2017 picture frankvw2017  路  3Comments

Bystroushaak picture Bystroushaak  路  4Comments

mrvn picture mrvn  路  3Comments