<p dir="ltr">Did you see my second diff? :)</p>
<div class="gmail_quote">On 4 Sep 2015 1:31 pm, "Rafael Zalamena" <<a href="mailto:rafaelfz@taghos.com.br">rafaelfz@taghos.com.br</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Em Fri, 4 Sep 2015 00:48:50 +0100<br>
Federico Schwindt <<a href="mailto:fgsch@lodoss.net">fgsch@lodoss.net</a>> escreveu:<br>
<br>
> And a version aligned with phk's comment (off by default).<br>
><br>
> On Fri, Sep 4, 2015 at 12:15 AM, Federico Schwindt <<a href="mailto:fgsch@lodoss.net">fgsch@lodoss.net</a>> wrote:<br>
><br>
> > Hi,<br>
> ><br>
> > Actually the problem is somewhere else.<br>
> ><br>
> > The attached diff should fix it.<br>
> ><br>
> > Cheers.<br>
> ><br>
<br>
With your diff varnish will spam log messages on systems without<br>
ACCEPT_FILTERS or TCP_DEFER_ACCEPT by default.<br>
<br>
I've modified my diff to kill some ifdefs and make accept_filter always<br>
avaliable, but this time disabled by default on system without<br>
ACCEPT_FILTERS or with TCP_DEFER_ACCEPT.<br>
<br>
With this:<br>
(1) anyone who wants to enable accept_filter on GNU/Linux should just<br>
call varnish with 'varnishd ... -p accept_filter=on';<br>
(2) anyone who enables accept_filter on a system without it will have a<br>
log spam about not having support for this feature;<br>
(3) we get to keep the old behavior for systems with ACCEPT_FILTERS;<br>
<br>
<br>
diff --git bin/varnishd/cache/cache_acceptor.c bin/varnishd/cache/cache_acceptor.c<br>
index 9736ca9..a17351d 100644<br>
--- bin/varnishd/cache/cache_acceptor.c<br>
+++ bin/varnishd/cache/cache_acceptor.c<br>
@@ -489,7 +489,6 @@ vca_acct(void *arg)<br>
assert (ls->sock > 0); // We know where stdin is<br>
AZ(listen(ls->sock, cache_param->listen_depth));<br>
vca_tcp_opt_set(ls->sock, 1);<br>
-#ifdef HAVE_ACCEPT_FILTERS<br>
if (cache_param->accept_filter) {<br>
int i;<br>
i = VTCP_filter_http(ls->sock);<br>
@@ -498,7 +497,6 @@ vca_acct(void *arg)<br>
"Kernel filtering: sock=%d, ret=%d %s",<br>
ls->sock, i, strerror(errno));<br>
}<br>
-#endif /* HAVE_ACCEPT_FILTERS */<br>
}<br>
<br>
need_test = 1;<br>
diff --git <a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> <a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
index 6c4d5f2..4a50fd8 100644<br>
--- <a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
+++ <a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
@@ -366,6 +366,19 @@ AC_CHECK_DECL([SO_ACCEPTFILTER],<br>
]<br>
)<br>
<br>
+AC_CHECK_DECL([TCP_DEFER_ACCEPT],<br>
+ [<br>
+ AC_DEFINE(HAVE_ACCEPT_FILTERS,1,[Define to 1 if you have accept filters]),<br>
+ AC_DEFINE(HAVE_TCP_DEFER_ACCEPT,1,[Define to 1 if you have TCP defer accept])<br>
+ ],<br>
+ ,<br>
+ [<br>
+#include <sys/socket.h><br>
+#include <netinet/in.h><br>
+#include <netinet/tcp.h><br>
+ ]<br>
+)<br>
+<br>
# Older Solaris versions define SO_{RCV,SND}TIMEO, but do not<br>
# implement them.<br>
#<br>
diff --git include/tbl/params.h include/tbl/params.h<br>
index d3a2982..6cbe3ba 100644<br>
--- include/tbl/params.h<br>
+++ include/tbl/params.h<br>
@@ -30,13 +30,16 @@<br>
<br>
/*lint -save -e525 -e539 */<br>
<br>
-#ifdef HAVE_ACCEPT_FILTERS<br>
PARAM(<br>
/* name */ accept_filter,<br>
/* typ */ bool,<br>
/* min */ NULL,<br>
/* max */ NULL,<br>
+#if defined(HAVE_ACCEPT_FILTERS) && !defined(HAVE_TCP_DEFER_ACCEPT)<br>
/* default */ "on",<br>
+#else<br>
+ /* default */ "off",<br>
+#endif /* HAVE_ACCEPT_FILTERS */<br>
/* units */ "bool",<br>
/* flags */ MUST_RESTART,<br>
/* s-text */<br>
@@ -44,7 +47,6 @@ PARAM(<br>
/* l-text */ NULL,<br>
/* func */ NULL<br>
)<br>
-#endif /* HAVE_ACCEPT_FILTERS */<br>
<br>
PARAM(<br>
/* name */ acceptor_sleep_decay,<br>
diff --git lib/libvarnish/vtcp.c lib/libvarnish/vtcp.c<br>
index 3992555..732c2ea 100644<br>
--- lib/libvarnish/vtcp.c<br>
+++ lib/libvarnish/vtcp.c<br>
@@ -146,6 +146,7 @@ VTCP_hisname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen)<br>
/*--------------------------------------------------------------------*/<br>
<br>
#ifdef HAVE_ACCEPT_FILTERS<br>
+#ifndef HAVE_TCP_DEFER_ACCEPT<br>
<br>
int<br>
VTCP_filter_http(int sock)<br>
@@ -160,7 +161,7 @@ VTCP_filter_http(int sock)<br>
return (retval);<br>
}<br>
<br>
-#elif defined(__linux)<br>
+#else /* HAVE_TCP_DEFER_ACCEPT */<br>
<br>
int<br>
VTCP_filter_http(int sock)<br>
@@ -173,6 +174,7 @@ VTCP_filter_http(int sock)<br>
return (retval);<br>
}<br>
<br>
+#endif<br>
#else<br>
<br>
int<br>
</blockquote></div>