vlan_get_tag(9)
π vlan_get_tag(9) β from the Kernel API Manual, bestie
okay so picture this: you're deep in kernel land, you've got an skb in your hands, and you just need to know its VLAN ID. that's literally this function. it's the "hey bestie what's your VLAN tag" of the networking stack, and yes it lives in the Kernel API Manual (that's the 9 on the end, iykyk).
β¨ NAME β¨
vlan_get_tag β get the VLAN ID from the skb π
like, that's it. that's the whole job. you hand it a packet, it hands you the tag.
πΈ SYNOPSIS πΈ
int vlan_get_tag (const struct sk_buff *skb , u16 *vlan_tci );
look at her. two args, one int coming back at you. no cap. π
π¦ ARGUMENTS π¦
skbβ the skbuff you're querying π this is the packet you're asking about, and it'sconstbecause we're just looking, not touching. respectfully.vlan_tciβ buffer to store the value π«Ά you pass in au16 *and the answer gets dropped in there. it's giving "you provide the bucket, we provide the water".
π₯ RETURN π₯
returns an error if the skb is not VLAN tagged π
so like, if your packet isn't tagged? error. that's the vibe check and your skb failed it. not me being dramatic, that's just what the manpage says, fr fr.
π SEE ALSO π
grab a snack, this list is long, but honestly it's all her cousins and they're all iconic in their own way:
- Kernel file
./include/linux/if_vlan.hβ the mothership, the source of truth, the whole family lives here π 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(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_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)
β note the underscores, bestie β there's a whole double-underscore squad in there and they are NOT the same as the regular ones. do not confuse them, that's a whole different function and you will be sad. π
that's the whole page, you ate it up, no crumbs. π
sign-off time: this little gem lives under ./include/linux, it's dated October 2026, and it goes by vlan_get_tag(9) β remember her name, she's main character energy. πβ¨
π¦ 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