In Ubuntu 11.10 Oneiric Ocelot, with libtorrent13 0.12.7-6 and rtorrent
0.8.7-7ubuntu1, rtorrent no longer seems to set the TOS flag correctly
(throughput mode). This makes it difficult to set up good traffic shaping
rules.
The patch debian/patches/libtorrent-0.12.6-ipv6-07.patch in the package source
makes, amongst others, this change (in src/net/socket_fd.cc):
------------------------------------------------------------
bool
SocketFd::set_priority(priority_type p) {
check_valid();
int opt = p;
+#ifdef RAK_USE_INET6
+ if (m_ipv6_socket)
+ return setsockopt(m_fd, IPPROTO_IPV6, IPV6_TCLASS, &opt, sizeof(opt)) ==
0;
+ else
+#endif
return setsockopt(m_fd, IPPROTO_IP, IP_TOS, &opt, sizeof(opt)) == 0;
}
------------------------------------------------------------
By simply removing these five lines again, the TOS flag will be set correctly.
I only have a link-local ipv6 address, but apparently the ipv6 code is used
anyway. This paragraph from ipv6 (7) probably explains that:
IPv4 connections can be handled with the v6 API by using the v4-mapped-on-v6
address type; thus a program only needs to support this API type to support
both protocols. This is handled transparently by the address handling
functions in the C library.
It seems that the problem is that setting IPV6_TCLASS for an ipv4 connection
does not set the TOS flag correctly. I am, however, unsure what the proper
solution is here.