bpf_ksock_connect(9)
π« bpf_ksock_connect(9) β a Kernel API Manual moment π«
okay bestie, welcome to the bpf_ksock_connect(9) page, straight out of the Kernel API Manual β¨ this is the little kfunc that gets your BPF kernel socket actually talking to somebody β no cap π«Ά
πΈ NAME πΈ
bpf_ksock_connect β bestie, it connects a BPF kernel socket to a remote address π
β¨ SYNOPSIS β¨
__bpf_kfunc int bpf_ksock_connect (struct bpf_ksock *ks , const union bpf_ksock_addr *addr , u32 addr__sz );
like, that's the whole vibe right there β
π ARGUMENTS π
ksβ your BPF kernel socket context π the main character, honestly.addrβ a pointer to an IPv4 or IPv6 socket address π either one, she contains multitudes.addr__szβ the size of the address union π§ just so everyone knows how big the vibe is.
π¦ DESCRIPTION π¦
So what does she do? She connects the socket to the specified remote address and port π₯ that's it, that's the whole slay.
But β and this is the important part, so listen up π β this function may sleep while it's connecting the socket. Which means it can only be used in sleepable BPF programs (SYSCALL). Not the regular ones, bestie. Only the sleepable ones. The vibe check here is real π
π RETURN π
0on success π periodt.- negative errno on error π she'll let you know.
π SEE ALSO π
go read these next, iykyk π
- Kernel file
./net/core/bpf_ksock.c struct bpf_ksock(9)bpf_ksock_create(9)bpf_ksock_acquire(9)bpf_ksock_release(9)bpf_ksock_send(9)
anyway that's the page!! sourced from ./net/core, dated October 2026 β mwah, love u, go connect some sockets responsibly πβ¨π
π¦ 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