skb_steal_sock(9)
π skb_steal_sock(9) β from the Kernel API Manual, bestie π
Okay so picture this: it's giving "kernel networking" and you've got an sk_buff and you want the socket that's chilling inside it. This function is literally the little goblin that yoinks it out for you. The manual name is skb_steal_sock, and yeah, it's exactly as iconic as it sounds β¨
πΈ NAME πΈ
skb_steal_sock β steal a socket from an sk_buff π«Ά
β¨ SYNOPSIS β¨
struct sock * skb_steal_sock (struct sk_buff *skb , bool *refcounted ,
bool *prefetched );
Three args, one socket, zero regrets. Copy it exactly like that, no cap π
π¦ ARGUMENTS π¦
skbβ thesk_buffyou're stealing the socket from. This is the victim, bestie πrefcountedβ gets set totrueif the socket is reference-counted. So it's abool *, meaning you hand over the address and the function writes the answer in there for you π§prefetchedβ gets set totrueif the socket was assigned from bpf. That's it, that's the vibe β
π SEE ALSO π
- Kernel file
./include/net/request_sock.hβ go read it, iykyk π
lowkey reminder:refcountedandprefetchedare bothbool *, so pass pointers, not values. the function fills them in for you, and that's the whole point of them being there π
and that's the page, bestie π sourced from ./include/net, dated October 2026, still filed under skb_steal_sock(9) β mwah, go steal 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