skb_copy(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

skb_copy β€” create private copy of an sk_buff. And yes bestie, this is the skb_copy(9) page from the Kernel API Manual, so buckle up πŸ«ΆπŸ’….


✨ SYNOPSIS ✨

struct sk_buff * skb_copy (const struct sk_buff *skb , gfp_t gfp_mask );

πŸŽ€ ARGUMENTS πŸŽ€

  • skb β€” buffer to copy. This is the sk_buff you're asking to duplicate, periodt.
  • gfp_mask β€” allocation priority. It's the whole "how hard can we try to get memory" vibe for the copy.

πŸ’– DESCRIPTION πŸ’–

Okay so skb_copy makes a copy of both an sk_buff and its data. This is used when the caller wishes to modify the data and needs a private copy of the data to alter. It returns NULL on failure or the pointer to the buffer on success. The returned buffer has a reference count of 1, no cap.

As a by-product, this function converts non-linear sk_buff to linear one, so that sk_buff becomes completely private and caller is allowed to modify all the data of returned buffer. That's the main-character move here: the returned buffer is fully yours to edit, top to bottom.

Important: this means that this function is not recommended for use in circumstances when only header is going to be modified. Use pskb_copy instead. Like, if you're only touching the header, don't make skb_copy do all that extra work β€” choose pskb_copy. πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file: ./net/core/skbuff.c


okay that's the whole page, bestie πŸ’– signed off with source/version ./net/core and date October 2026, page skb_copy(9) β€” mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from