Fix accept_filter for GNU/Linux
Federico Schwindt
fgsch at lodoss.net
Fri Sep 4 01:48:50 CEST 2015
And a version aligned with phk's comment (off by default).
On Fri, Sep 4, 2015 at 12:15 AM, Federico Schwindt <fgsch at lodoss.net> wrote:
> Hi,
>
> Actually the problem is somewhere else.
>
> The attached diff should fix it.
>
> Cheers.
>
> On Wed, Sep 2, 2015 at 10:23 PM, Rafael Zalamena <rafaelfz at taghos.com.br>
> wrote:
>
>> Hello,
>>
>> Varnish cache daemon is not doing 'accept_filter' for the GNU/Linux
>> version because of HAVE_ACCEPT_FILTER not being defined. Something along
>> the way broke it, so in order to fix it I have added TCP_DEFER_ACCEPT
>> detection code to configure.ac to define HAVE_ACCEPT_FILTER and
>> HAVE_TCP_DEFER_ACCEPT so we can have a fallback of accept_filter on Linux.
>>
>> Since I didn't see any different use of ACCEPT_FILTER and historicaly no
>> one used it diferently I kept TCP_DEFER_ACCEPT being a ACCEPT_FILTER
>> replacement to create a small diff.
>>
>> diff --git configure.ac configure.ac
>> index 6c4d5f2..4a50fd8 100644
>> --- configure.ac
>> +++ configure.ac
>> @@ -366,6 +366,19 @@ AC_CHECK_DECL([SO_ACCEPTFILTER],
>> ]
>> )
>>
>> +AC_CHECK_DECL([TCP_DEFER_ACCEPT],
>> + [
>> + AC_DEFINE(HAVE_ACCEPT_FILTERS,1,[Define to 1 if you have accept
>> filters]),
>> + AC_DEFINE(HAVE_TCP_DEFER_ACCEPT,1,[Define to 1 if you have TCP defer
>> accept])
>> + ],
>> + ,
>> + [
>> +#include <sys/socket.h>
>> +#include <netinet/in.h>
>> +#include <netinet/tcp.h>
>> + ]
>> +)
>> +
>> # Older Solaris versions define SO_{RCV,SND}TIMEO, but do not
>> # implement them.
>> #
>> diff --git lib/libvarnish/vtcp.c lib/libvarnish/vtcp.c
>> index 3992555..732c2ea 100644
>> --- lib/libvarnish/vtcp.c
>> +++ lib/libvarnish/vtcp.c
>> @@ -146,6 +146,7 @@ VTCP_hisname(int sock, char *abuf, unsigned alen,
>> char *pbuf, unsigned plen)
>> /*--------------------------------------------------------------------*/
>>
>> #ifdef HAVE_ACCEPT_FILTERS
>> +#ifndef HAVE_TCP_DEFER_ACCEPT
>>
>> int
>> VTCP_filter_http(int sock)
>> @@ -160,7 +161,7 @@ VTCP_filter_http(int sock)
>> return (retval);
>> }
>>
>> -#elif defined(__linux)
>> +#else /* HAVE_TCP_DEFER_ACCEPT */
>>
>> int
>> VTCP_filter_http(int sock)
>> @@ -173,6 +174,7 @@ VTCP_filter_http(int sock)
>> return (retval);
>> }
>>
>> +#endif
>> #else
>>
>> int
>>
>> _______________________________________________
>> varnish-dev mailing list
>> varnish-dev at varnish-cache.org
>> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20150904/60f1f8e8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Enable-accept_filter-handling-code-for-Linux.patch
Type: text/x-patch
Size: 1718 bytes
Desc: not available
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20150904/60f1f8e8/attachment.bin>
More information about the varnish-dev
mailing list