vlan_insert_tag(9)
π 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, iykykvlan_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
skbon success π NULLon error β and yeah, in that case theskbis 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:
struct vlan_ethhdr(9)struct vlan_pcpu_stats(9)struct vlan_priority_tci_mapping(9)struct vlan_dev_priv(9)eth_type_vlan(9)__vlan_insert_inner_tag(9)__vlan_insert_tag(9)vlan_insert_inner_tag(9)vlan_insert_tag_set_proto(9)__vlan_hwaccel_clear_tag(9)__vlan_hwaccel_copy_tag(9)__vlan_hwaccel_put_tag(9)__vlan_get_tag(9)__vlan_hwaccel_get_tag(9)vlan_get_tag(9)vlan_get_protocol_offset_inline(9)vlan_get_protocol(9)vlan_remove_tag(9)skb_vlan_tagged(9)skb_vlan_tagged_multi(9)vlan_features_check(9)compare_vlan_header(9)
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
- 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