From: Amos Jeffries Date: Tue, 1 Jan 2013 03:55:32 +0000 (-0700) Subject: Bug 3731: FreeBSD requires 32-bit TOS options X-Git-Tag: SQUID_3_4_0_1~402 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=792e0eb28d6ea68daefbaf65fb7ae5c32d67ac7e;p=thirdparty%2Fsquid.git Bug 3731: FreeBSD requires 32-bit TOS options --- diff --git a/src/ip/Qos.cci b/src/ip/Qos.cci index 7551e66e20..2411fa9545 100644 --- a/src/ip/Qos.cci +++ b/src/ip/Qos.cci @@ -5,8 +5,15 @@ int Ip::Qos::setSockTos(const Comm::ConnectionPointer &conn, tos_t tos) { -#ifdef IP_TOS +#if defined(IP_TOS) + // Bug 3731: FreeBSD produces 'invalid option' + // unless we pass it a 32-bit variable storing 8-bits of data. +#if _SQUID_FREEBSD_ + int32_t bTos = tos; + int x = setsockopt(conn->fd, IPPROTO_IP, IP_TOS, &bTos, sizeof(bTos)); +#else int x = setsockopt(conn->fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos_t)); +#endif if (x < 0) debugs(50, 2, "Ip::Qos::setSockTos: setsockopt(IP_TOS) on " << conn << ": " << xstrerror()); return x;