STRUCT NET_BRIDGE_VLAN(9)
π NAME π
struct net_bridge_vlan β the per-vlan entry, bestie. one struct, doing double duty β¨
(also hiii, this is from the Kernel API Manual, section 9, and it's giving kernel-internals realness π«Ά)
πΈ SYNOPSIS πΈ
struct net_bridge_vlan {
struct rhash_head vnode;
struct rhash_head tnode;
u16 vid;
u16 flags;
u16 priv_flags;
u8 state;
struct pcpu_sw_netstats __percpu *stats;
union {
struct net_bridge *br;
struct net_bridge_port *port;
};
union {
refcount_t refcnt;
struct net_bridge_vlan *brvlan;
};
struct br_tunnel_info tinfo;
union {
struct net_bridge_mcast br_mcast_ctx;
struct net_bridge_mcast_port port_mcast_ctx;
};
u16 msti;
struct list_head vlist;
struct rcu_head rcu;
};
okay look at all those anonymous unions β she's got range π
π Members π
so here's the cast of characters, one by one, no skips, fr fr:
vnodeβ rhashtable member. iconic little hash-table citizen π₯tnodeβ rhashtable member. yes there are two of them, she contains multitudes πvidβ the VLAN id. the whole point, honestly πflagsβ bridge vlan flags πpriv_flagsβ private (in-kernel) bridge vlan flags π these are the ones that stay behind the curtainstateβ STP state (e.g. blocking, learning, forwarding). yes she has moods π¦statsβ per-cpu VLAN statistics. numbers go brrr per-cpu π{unnamed_union}β anonymous. no name, all vibes β¨brβ if theMASTERflag is set, this points to abridgestructportβ if theMASTERflag is unset, this points to aportstruct
{unnamed_union}β anonymous again πrefcntβ if theMASTERflag is set, this is bumped for each port referencing it. every port said "mine" and she keeps count π«Άbrvlanβ if theMASTERflag is unset, this points to the global per-VLAN context for this VLAN entry
tinfoβ bridge tunnel info. tunnel girlie πΈ{unnamed_union}β third anonymous union, she's committed to the bit πbr_mcast_ctxβ if theMASTERflag is set, this is the global vlan multicast contextport_mcast_ctxβ if theMASTERflag is unset, this is the per-port/vlan multicast context
mstiβ if theMASTERflag is set, this holds the VLANs MST instance βvlistβ sorted list of VLAN entries. she's organized, unlike my sleep schedule πrcuβ used for entry destruction. the goodbye field π
π¦ Description π¦
okay so the lore: this structure is shared between two whole situations β the global per-VLAN entries living in the bridge rhashtable, and the local per-port per-VLAN entries living in the port's rhashtable. one struct, two households, very main character energy π
and here's the crucial part, do not miss it: those union entries should be interpreted depending on the entry flags that are set. like, the flags are the vibe check β they decide which half of the union you're even looking at. read the flags first, bestie, always π₯
π SEE ALSO π
- Kernel file
./net/bridge/br_private.h struct net_bridge_vlan_group(9)
ngl the whole thing hinges on the MASTER flag. respect the flag and you'll be fine π
and that's the page!! this one came from the kernel tree at ./net/bridge, dated October 2026, and it's struct net_bridge_vlan(9) β go read br_private.h if you wanna see her in the wild πβ¨π«Ά
π¦ 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