__vlan_insert_tag(9)
β¨ __vlan_insert_tag β regular VLAN tag inserting π
okay bestie, so this one is a kernel API manual page (section 9, the kernel API one, iykyk) and honestly? it's giving "small function, big job" π let's get into it.
πΈ SYNOPSIS πΈ
int __vlan_insert_tag (struct sk_buff *skb , __be16 vlan_proto , u16
vlan_tci );
literally just one call, three things in, an int out. iconic behavior π«Ά
π ARGUMENTS π
skbβ the skbuff you're tagging, bestie. this is the one getting the glow-up β¨vlan_protoβ the VLAN encapsulation protocol. that's the__be16one, don't mix it up πvlan_tciβ the VLAN TCI to insert. it's au16, so keep it in its lane π
π DESCRIPTION π
So what does it do? It inserts the VLAN tag into skb as part of the payload π¦ β that part matters, ok?
And the key detail, no cap: it does not change skb->protocol, which is exactly why this function can be used during receive π₯ like, that's the whole point of the underscore-prefix version, iykyk.
β RETURN β
Returns an error if skb_cow_head fails. that's it, that's the deal π
Heads up bestie: if skb_cow_head fails, you get an error back β so check that return value, fr fr π
π¦ SEE ALSO π¦
The kernel file for all this lives at ./include/linux/if_vlan.h, and here's 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_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_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)
like, that's a whole squad π§π
okay that's the page!! this one comes to you from the kernel API manual, source path ./include/linux, dated October 2026 πΈ β and that's the whole __vlan_insert_tag(9) situation, mwah πβ¨
π¦ 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