And a version aligned with phk's comment (off by default). On Fri, Sep 4, 2015 at 12:15 AM, Federico Schwindt <[email protected]> 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 <[email protected]> > 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 >> [email protected] >> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev >> > >
From 3dffcb4368430c795a36d728501a1c545bbb7995 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" <[email protected]> Date: Fri, 4 Sep 2015 00:44:11 +0100 Subject: [PATCH] Enable accept_filter handling code for Linux Default to off. --- bin/varnishd/cache/cache_acceptor.c | 2 -- include/tbl/params.h | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c index 9736ca9..a17351d 100644 --- a/bin/varnishd/cache/cache_acceptor.c +++ b/bin/varnishd/cache/cache_acceptor.c @@ -489,7 +489,6 @@ vca_acct(void *arg) assert (ls->sock > 0); // We know where stdin is AZ(listen(ls->sock, cache_param->listen_depth)); vca_tcp_opt_set(ls->sock, 1); -#ifdef HAVE_ACCEPT_FILTERS if (cache_param->accept_filter) { int i; i = VTCP_filter_http(ls->sock); @@ -498,7 +497,6 @@ vca_acct(void *arg) "Kernel filtering: sock=%d, ret=%d %s", ls->sock, i, strerror(errno)); } -#endif /* HAVE_ACCEPT_FILTERS */ } need_test = 1; diff --git a/include/tbl/params.h b/include/tbl/params.h index d3a2982..8b74412 100644 --- a/include/tbl/params.h +++ b/include/tbl/params.h @@ -30,13 +30,16 @@ /*lint -save -e525 -e539 */ -#ifdef HAVE_ACCEPT_FILTERS PARAM( /* name */ accept_filter, /* typ */ bool, /* min */ NULL, /* max */ NULL, +#if defined(HAVE_ACCEPT_FILTERS) /* default */ "on", +#else + /* default */ "off", +#endif /* HAVE_ACCEPT_FILTERS */ /* units */ "bool", /* flags */ MUST_RESTART, /* s-text */ @@ -44,7 +47,6 @@ PARAM( /* l-text */ NULL, /* func */ NULL ) -#endif /* HAVE_ACCEPT_FILTERS */ PARAM( /* name */ acceptor_sleep_decay, -- 2.5.1
_______________________________________________ varnish-dev mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
