vlan_insert_tag(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– vlan_insert_tag(9) β€” the Kernel API Manual, bestie edition πŸ’–

okay so this is a page from the Kernel API Manual and it's literally about vlan_insert_tag, which does regular VLAN tag inserting. yes that's the whole name. she's straightforward, she's iconic, she's a kernel function πŸŽ€


✨ SYNOPSIS ✨

struct sk_buff * vlan_insert_tag (struct sk_buff *skb , __be16
vlan_proto , u16 vlan_tci );

like, look at her. three args. no notes. πŸ’…


🌸 ARGUMENTS 🌸

  • skb β€” the skbuff you're tagging, aka the main character of this whole operation 🫢
  • vlan_proto β€” the VLAN encapsulation protocol. the vibe of the tag, iykyk
  • vlan_tci β€” the VLAN TCI you want to insert. yes it's a real thing, yes you need it

πŸ¦‹ DESCRIPTION πŸ¦‹

So what does she do? She inserts the VLAN tag into skb as part of the payload, and returns a VLAN tagged skb back to you. Slay. ✨

Heads up bestie: this might change skb->head. not a drill. πŸ’€

Following the skb_unshare example, in case of error, the calling function doesn't have to worry about freeing the original skb β€” she handles that whole situation for you, no cap. honestly? queen behaviour. πŸ‘‘

Also super important: she does not change skb->protocol, which is exactly why this function can be used during receive. that's the whole reason she's built like that, periodt. 🌈


⭐ RETURN ⭐

  • modified skb on success πŸŽ‰
  • NULL on error β€” and yeah, in that case the skb is freed 😭 (she took care of it, remember?)

πŸ’œ SEE ALSO πŸ’œ

Kernel file ./include/linux/if_vlan.h β€” go read it, it's giving essential lore πŸ“–

and the whole friend group:


okay that's the whole page bestie, ily, go tag some skbs responsibly πŸ§šπŸ’–

and for the record, this one came out of ./include/linux in October 2026 β€” so it's basically a vintage. treasure it. πŸ“πŸ’…

πŸ“¦ where this page comes from