skb_clone(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ NAME

skb_clone β€” duplicate an sk_buff πŸ’…

hi bestie, welcome to the skb_clone(9) page, straight out of the Kernel API Manual ✨ yes, the whole thing is about making a twin of a socket buffer, and it's lowkey iconic how much drama one struct can hold 🌸


πŸŽ€ SYNOPSIS

struct sk_buff * skb_clone (struct sk_buff *skb , gfp_t gfp_mask );

that's the whole signature, no cap πŸ‘‘


πŸ’– ARGUMENTS

  • skb β€” the buffer you're cloning, aka the one getting a twin 🫢
  • gfp_mask β€” the allocation priority, like how hard you're willing to try to get memory 😭

πŸ”₯ DESCRIPTION

okay so, you want a duplicate of an sk_buff? say less πŸ’β€β™€οΈ The new one is not owned by a socket β€” it's out here living its own life, no socket holding its hand πŸ™ˆ

The way it works is genuinely so cute: both copies share the same packet data but not structure. So they're matching outfits on the data but they each have their own personality in the structure department πŸ’… slay.

The new buffer comes out with a reference count of 1 β€” brand new main character energy, zero baggage πŸ‘‘

And about failure? If the allocation fails, the function returns NULL. Otherwise you get the new buffer back. That's it. That's the whole vibe 🌈

⚠️ bestie, listen to me: if this function is called from an interrupt, gfp_mask must be GFP_ATOMIC. not "should", not "probably", must πŸ’€ don't be the one who finds out why.

πŸ‘‘ SEE ALSO

It's giving family reunion, fr fr β€” the kernel file is ./net/core/skbuff.c and here's everyone at the party πŸŽ‰:


and that's the page, bestie πŸ“ mwah πŸ’‹

little sign-off moment: this one comes from ./net/core, dated October 2026, and the page is skb_clone(9) β€” go forth and clone responsibly βœ¨πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from