ACCF_DNS(9)

πŸ’– ACCF_DNS πŸ’– β€” the accf_dns manual, but make it make sense

okay bestie, welcome to ACCF_DNS(9), straight outta the Kernel Developer's Manual ✨ this is the DNS accept filter and she is so much chiller than she sounds.


✨ NAME ✨

accf_dns β€” buffer incoming DNS requests until the whole first request is present πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

options INET
options ACCEPT_FILTER_DNS
kldload accf_dns

like, three whole lines. that's the whole vibe. πŸ’…


🌸 DESCRIPTION 🌸

Okay so picture this: you've got a socket, and it's gonna use accept() to receive incoming connections. This filter? You place it on that socket. That's her whole job. Placed on a socket. Slay. πŸ‘‘

Here's the tea though β€” it stops the application from receiving the connected descriptor via accept() until a whole DNS request is available on the socket. Not a partial one. Not half a request. The WHOLE thing. periodt.

How does she know when the whole thing's arrived? She reads the first two bytes of the request to figure out its size, then she just… waits. Sits there, patiently, like a good friend holding your coffee, until the required amount of data is available to be read. 🫢 So iconic.

Oh and also β€” the ACCEPT_FILTER_DNS kernel option is also a module, which means you can enable it at runtime via kldload(8) if the INET option has been compiled into the kernel. Double duty. Main character energy fr fr. πŸ”₯


πŸ“ EXAMPLES πŸ“

So if the accf_dns module is available in the kernel, this code right here will enable the DNS accept filter on a socket sok:

struct accept_filter_arg afa;

bzero(&afa, sizeof(afa));
strcpy(afa.af_name, "dnsready");
setsockopt(sok, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));

look at that. "dnsready". it's giving prepared. πŸ˜­πŸ’–


πŸ‘‘ SEE ALSO πŸ‘‘

go read the whole friend group, they're all linked πŸ’œ


🌈 HISTORY 🌈

The accept filter mechanism was introduced in FreeBSD 4.0. old money. vintage. we love a legacy icon. ⭐


🧚 AUTHORS 🧚

This manual page and the filter were written by David Malone. thank you for your service king πŸ«‘πŸ’


okay that's the whole page bestie, no notes πŸ’€

This was ACCF_DNS(9) from the Debian build, dated July 16, 2008 β€” yeah she's been around a minute, and she still ate. bye pookie, go buffer those DNS requests πŸ’…βœ¨

πŸ“¦ where this page comes from