Re: /bzr/squid3/trunk/ r9975: Auto-detect the amount of TPROXY support available.

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 16 Sep 2009 18:13:26 +1200

Henrik Nordstrom wrote:
> tis 2009-09-15 klockan 23:59 +1200 skrev Amos Jeffries:
>> + if ( (tmp_sock = socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP))
>>> = 0 &&
>> + setsockopt(tmp_sock, SOL_IP, IP_TRANSPARENT, (char
>> *)&tos, sizeof(int)) == 0 &&
>> + bind(tmp_sock, (struct sockaddr*)&tmp_ip6, sizeof(struct
>> sockaddr_in6)) == 0 ) {
>> +
>> + debugs(3, 3, "IPv6 TPROXY support detected. Using.");
>> + shutdown(tmp_sock, SHUT_RDWR);
>> + return true;
>
> Hmm... that shutdown should be a close(). If not you'll lose the
> filedescriptor.
>
> Applies to the other uses of shutdown() there as well I think.
> shutdown(SHUT_RDWR) is not a synonym for close().
>
> Regards
> Henrik
>

Thanks. Thought there was something unusual about shutdown(). I tried
fclose() by bad-habit earlier and gcc complained (Yeah, I know why).
shutdown() was what the socket() and bind() manual pages said so I
followed along that way instead of using close().

Fixed.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE6 or 3.0.STABLE19
   Current Beta Squid 3.1.0.13
Received on Wed Sep 16 2009 - 06:13:36 MDT

This archive was generated by hypermail 2.2.0 : Wed Sep 16 2009 - 12:00:05 MDT