On Wed, Jan 02, 2013 at 04:27:47PM +0000, Andrew Beverley wrote: > On Wed, 2013-01-02 at 13:15 +1300, Amos Jeffries wrote: > > On 2/01/2013 4:24 a.m., Andrew Beverley wrote: > > > On Tue, 2013-01-01 at 15:15 +0000, Andrew Beverley wrote: > > >> Therefore, could you please try the following (untested) patch? > > > Ah, Amos, I've just re-read the bug report and seen that you have closed > > > it with a FreeBSD workaround. I couldn't see your commit, but from what > > > I have read it looks like FreeBSD definitely expects a TOS value as an > > > int, so that should be the correct solution. > > > > I patched the function internally to store the 8-bit tos_t parameter > > into a local int before sending to setsockopt() on FreeBSD. That way we > > still save on 3 bytes in all the Squid objects using it. > > > > PS. I would still like to know if the problem occurs on other BSD > > variants to extend the patch #if condition for them. > > Again, no official documentation found, but I found other bug reports in > software packages for a variety of BSD operating systems, so I think it > should apply to any BSD derivative (including OSX). Doing a google of "setsockopt freebsd" and "setsockopt netbsd" point directly to their man pages (so it is documented). Both say basically the same thing, so I guess all the BSD derived OSes will use the same API. http://www.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 http://www.daemon-systems.org/man/setsockopt.2.html There is a paragraph that say: Most socket-level options utilize an int argument for optval. For setsockopt(), the argument should be non-zero to enable a boolean option, or zero if the option is to be disabled. SO_LINGER uses a struct linger argument, defined in <sys/socket.h>, which specifies the desired state of the option and the linger interval (see below). SO_SNDTIMEO and SO_RCVTIMEO use a struct timeval argument, defined in <sys/time.h>. John -- John Hay -- jhay@xxxxxxxxxxxxxxxxx / jhay@xxxxxxxxxxx