skb_steal_sock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the sk_buff you're stealing the socket from. This is the victim, bestie 😭
  • refcounted β€” gets set to true if the socket is reference-counted. So it's a bool *, meaning you hand over the address and the function writes the answer in there for you 🧚
  • prefetched β€” gets set to true if 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: refcounted and prefetched are both bool *, 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