# NetBSD + nginx-0.8.53 + accept filters - not working

**URL:** <https://www.ruby-forum.com/t/netbsd-nginx-0-8-53-accept-filters-not-working/210475>\
**Category:** NGINX\
**Created:** [August 9, 2011, 11:48am UTC](https://www.ruby-forum.com/t/netbsd-nginx-0-8-53-accept-filters-not-working/210475 "2011-08-09T11:48:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [August 9, 2011, 11:48am UTC](https://www.ruby-forum.com/t/netbsd-nginx-0-8-53-accept-filters-not-working/210475/1 "2011-08-09T11:48:47Z")

</div>

Hello,

Giving nginx a spin on NetBSD, I noticed:  
accept filters “accept\_filter=httpready” are not supported on this  
platform, ignored in /usr/pkg/etc/nginx/nginx.conf:40

But NetBSD does support them:  
accf\_http (9) - buffer incoming connections until a certain complete  
HTTP requests arrive

# grep -i accf /usr/src/sys/arch/amd64/conf/NETBSD\_WEBSERVER

pseudo-device accf\_data # “dataready” accept filter  
pseudo-device accf\_http # “httpready” accept filter

Since I’m using packages (pkgin), I could not test nginx 1.x (which is  
in pkgsrc); Maybe this has been fixed in the mean time ?

Regards,

Hugo

Posted at Nginx Forum:

> **[NetBSD + nginx-0.8.53 + accept filters - not working](https://forum.nginx.org/read.php?2,213567,213567#msg-213567)**
>
> Hello, Giving nginx a spin on NetBSD, I noticed: accept filters "accept\_filter=httpready" are not supported on this platform, ignored in /usr/pkg/etc/nginx/nginx.conf:40 But NetBSD does support them: accf\_http (9) - buffer incoming...

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 9, 2011, 1:07pm UTC](https://www.ruby-forum.com/t/netbsd-nginx-0-8-53-accept-filters-not-working/210475/2 "2011-08-09T13:07:57Z")

</div>

Hello!

On Tue, Aug 09, 2011 at 05:48:06AM -0400, hugo wrote:

> Giving nginx a spin on NetBSD, I noticed:  
> accept filters “accept\_filter=httpready” are not supported on this  
> platform, ignored in /usr/pkg/etc/nginx/nginx.conf:40
> 
> But NetBSD does support them:  
> accf\_http (9) - buffer incoming connections until a certain complete  
> HTTP requests arrive

Ah, ok, it looks like accept filters are available in NetBSD 5.0+.

[…]

> Since I’m using packages (pkgin), I could not test nginx 1.x (which is  
> in pkgsrc); Maybe this has been fixed in the mean time ?

You may try

```
./configure --with-cc-opt="-D NGX_HAVE_DEFERRED_ACCEPT"

```

to see if it works.

If it is, we probably want to fix configure to detect it  
automatically.

Maxim D.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 9, 2011, 1:12pm UTC](https://www.ruby-forum.com/t/netbsd-nginx-0-8-53-accept-filters-not-working/210475/3 "2011-08-09T13:12:17Z")

</div>

Hello!

On Tue, Aug 09, 2011 at 03:07:14PM +0400, Maxim D. wrote:

[…]

> > Since I’m using packages (pkgin), I could not test nginx 1.x (which is  
> > in pkgsrc); Maybe this has been fixed in the mean time ?
> 
> You may try
> 
> ```
> ./configure --with-cc-opt="-D NGX_HAVE_DEFERRED_ACCEPT"
> 
> ```

Oops, should be

```
./configure --with-cc-opt="-D NGX_HAVE_DEFERRED_ACCEPT=1"

```

(note “=1”)

> to see if it works.
> 
> If it is, we probably want to fix configure to detect it  
> automatically.

Maxim D.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 9, 2011, 3:45pm UTC](https://www.ruby-forum.com/t/netbsd-nginx-0-8-53-accept-filters-not-working/210475/4 "2011-08-09T15:45:37Z")

</div>

Had a brief chat with the maintainer; He’s of the opinion that this  
should be dealt with upstream, using the same logic in use for FreeBSD:  
“if SO\_ACCEPTFILTER exists, use it by default.”

Regards,

Hugo

Posted at Nginx Forum:

> **[Re: NetBSD + nginx-0.8.53 + accept filters - not working](https://forum.nginx.org/read.php?2,213567,213578#msg-213578)**
>
> Hello, Giving nginx a spin on NetBSD, I noticed: accept filters "accept\_filter=httpready" are not supported on this platform, ignored in /usr/pkg/etc/nginx/nginx.conf:40 But NetBSD does support them: accf\_http (9) - buffer incoming...

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 9, 2011, 4:06pm UTC](https://www.ruby-forum.com/t/netbsd-nginx-0-8-53-accept-filters-not-working/210475/5 "2011-08-09T16:06:38Z")

</div>

Hello!

On Tue, Aug 09, 2011 at 09:44:53AM -0400, hugo wrote:

> Had a brief chat with the maintainer; He’s of the opinion that this  
> should be dealt with upstream, using the same logic in use for FreeBSD:  
> “if SO\_ACCEPTFILTER exists, use it by default.”

As I already stated earlier:

…

> > > to see if it works.
> > > 
> > > If it is, we probably want to fix configure to detect it  
> > > automatically.

Do you see it works? I.e. not only doesn’t produce errors while  
parsing configuration, but actually works ok and uses accept  
filters?

Maxim D.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 9, 2011, 3:04pm UTC](https://www.ruby-forum.com/t/netbsd-nginx-0-8-53-accept-filters-not-working/210475/6 "2011-08-09T15:04:16Z")

</div>

nginx-1.0.4 Lightweight HTTP server and mail proxy server

I fixed the Makefile in /usr/pkgsrc/www/nginx and added CONFIGURE\_ARGS+=  
–with-cc-opt=“-D NGX\_HAVE\_DEFERRED\_ACCEPT=1”

Restarting nginx produced no errors with the accept\_filter=httpready  
line after recompilation.

I’ve notified the nginx pkgsrc maintainer too.

Thanks for the line!

Hugo

Posted at Nginx Forum:

> **[Re: NetBSD + nginx-0.8.53 + accept filters - not working](https://forum.nginx.org/read.php?2,213567,213574#msg-213574)**
>
> Hello, Giving nginx a spin on NetBSD, I noticed: accept filters "accept\_filter=httpready" are not supported on this platform, ignored in /usr/pkg/etc/nginx/nginx.conf:40 But NetBSD does support them: accf\_http (9) - buffer incoming...

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 9, 2011, 5:04pm UTC](https://www.ruby-forum.com/t/netbsd-nginx-0-8-53-accept-filters-not-working/210475/7 "2011-08-09T17:04:09Z")

</div>

Hello!

On Tue, Aug 09, 2011 at 10:22:34AM -0400, hugo wrote:

> From the manpage:
> 
> RETURN VALUES  
> A 0 is returned if the call succeeds, -1 if it fails.

Do you actually see accept filter works, i.e. holding connection in  
incomplete queue till http request comes?

Not sure, but likely NetBSD’s netstat should show this as well as  
FreeBSD’s one with “netstat -Lan”:

$ netstat -Lan  
Current listen queue sizes (qlen/incqlen/maxqlen)  
Proto Listen Local Address  
…  
tcp4 0/1/128 \*.8080  
…

Note “1” in incqlen: this is telnet connection opened without http  
request sent.

Maxim D.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 9, 2011, 4:23pm UTC](https://www.ruby-forum.com/t/netbsd-nginx-0-8-53-accept-filters-not-working/210475/8 "2011-08-09T16:23:20Z")

</div>

Maxim,

According to  
[fxr.watson.org: identifier "SO\_ACCEPTFILTER"](http://fxr.watson.org/fxr/ident?im=bigexcerpts;i=SO_ACCEPTFILTER),  
SO\_ACCEPTFILTER is defined as 0x1000, and I see this:

23235 1 nginx CALL  
setsockopt(7,0xffff,0x1000,0x7f7fffffd410,0x100)  
23235 1 nginx RET setsockopt 0

From the manpage:

RETURN VALUES  
A 0 is returned if the call succeeds, -1 if it fails.

Regards,

Hugo

Posted at Nginx Forum:

> **[Re: NetBSD + nginx-0.8.53 + accept filters - not working](https://forum.nginx.org/read.php?2,213567,213582#msg-213582)**
>
> Hello, Giving nginx a spin on NetBSD, I noticed: accept filters "accept\_filter=httpready" are not supported on this platform, ignored in /usr/pkg/etc/nginx/nginx.conf:40 But NetBSD does support them: accf\_http (9) - buffer incoming...
