sk_attach_filter(9)
π sk_attach_filter(9) π
okay so bestie, welcome to the Kernel API Manual β this one's a lil function called sk_attach_filter, and honestly? it's giving "let the user hand you a filter and hope for the best" energy. let's get into it π
β¨ NAME β¨
sk_attach_filter β attach a socket filter π¦
πΈ SYNOPSIS πΈ
int sk_attach_filter (struct sock_fprog *fprog , struct sock *sk );
π ARGUMENTS π
fprogβ the filter program, aka the actual code the user wants to run. this is the main character πskβ the socket to use. this is where the filter's gonna live π₯
β DESCRIPTION β
so here's the vibe: you're attaching the user's filter code to the socket. no cap, that's literally the whole job π
but before we commit to anything, we run some sanity checks on the filter β just to make sure it doesn't explode on us later π like, we're being responsible besties here. nobody wants a filter that goes feral three hours in.
if something goes wrong, or if there just isn't enough memory for the filter, you get a negative errno code back. that's the "nope, didn't work" signal, and it's negative, so watch for it π
on success, the return is zero. slay. π
π«Ά SEE ALSO π«Ά
Kernel file ./net/core/filter.csk_filter_trim_cap(9)bpf_convert_filter(9)bpf_check_classic(9)sk_filter_release_rcu(9)sk_filter_release(9)bpf_prog_create(9)bpf_prog_create_from_user(9)xdp redirect(9)bpf_skb_meta_pointer(9)bpf_dynptr_from_skb_meta(9)bpf_xdp_pull_data(9)bpf_icmp_send(9)
okay that's the whole page, ily, go attach some filters responsibly π§π
signed, sealed, delivered from ./net/core β October 2026 edition β
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms