------------------------------------------------------------ revno: 12646 revision-id: squid3@treenet.co.nz-20131103083521-mds5qybjg9nl7bh4 parent: squid3@treenet.co.nz-20131103083224-8d0wtir5tiwdzqq6 fixes bug(s): http://bugs.squid-cache.org/show_bug.cgi?id=3887 committer: Amos Jeffries branch nick: 3.3 timestamp: Sun 2013-11-03 01:35:21 -0700 message: Bug 3887: tcp_outgoing_tos not working for IPv6 ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20131103083521-mds5qybjg9nl7bh4 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: 75f393ec79e552cd5c15ac659660739e9b2cd025 # timestamp: 2013-11-03 08:45:16 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20131103083224-\ # 8d0wtir5tiwdzqq6 # # Begin patch === modified file 'src/ip/Qos.cci' --- src/ip/Qos.cci 2013-01-09 00:12:02 +0000 +++ src/ip/Qos.cci 2013-11-03 08:35:21 +0000 @@ -5,20 +5,40 @@ int Ip::Qos::setSockTos(const Comm::ConnectionPointer &conn, tos_t tos) { -#if defined(IP_TOS) // Bug 3731: FreeBSD produces 'invalid option' // unless we pass it a 32-bit variable storing 8-bits of data. // NP: it is documented as 'int' for all systems, even those like Linux which accept 8-bit char // so we convert to a int before setting. int bTos = tos; - int x = setsockopt(conn->fd, IPPROTO_IP, IP_TOS, &bTos, sizeof(bTos)); - if (x < 0) - debugs(50, 2, "Ip::Qos::setSockTos: setsockopt(IP_TOS) on " << conn << ": " << xstrerror()); - return x; -#else - debugs(50, DBG_IMPORTANT, "WARNING: setsockopt(IP_TOS) not supported on this platform"); - return -1; -#endif + + if (conn->remote.IsIPv4()) { +#if defined(IP_TOS) + int x = setsockopt(conn->fd, IPPROTO_IP, IP_TOS, &bTos, sizeof(bTos)); + if (x < 0) + debugs(50, 2, "Ip::Qos::setSockTos: setsockopt(IP_TOS) on " << conn << ": " << xstrerror()); + else + conn->tos = tos; + return x; +#else + debugs(50, DBG_IMPORTANT, "WARNING: setsockopt(IP_TOS) not supported on this platform"); + return -1; +#endif + + } else { // if (conn->remote.IsIPv6()) { +#if defined(IPV6_TCLASS) + int x = setsockopt(conn->fd, IPPROTO_IPV6, IPV6_TCLASS, &bTos, sizeof(bTos)); + if (x < 0) + debugs(50, 2, "Ip::Qos::setSockTos: setsockopt(IPV6_TCLASS) on " << conn << ": " << xstrerror()); + else + conn->tos = tos; + return x; +#else + debugs(50, DBG_IMPORTANT, "WARNING: setsockopt(IPV6_TCLASS) not supported on this platform"); + return -1; +#endif + } + + /* CANNOT REACH HERE */ } int