STRUCT NET_BRIDGE_VLAN(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 curtain
  • state β€” 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 the MASTER flag is set, this points to a bridge struct
    • port β€” if the MASTER flag is unset, this points to a port struct
  • {unnamed_union} β€” anonymous again πŸ’€
    • refcnt β€” if the MASTER flag is set, this is bumped for each port referencing it. every port said "mine" and she keeps count 🫢
    • brvlan β€” if the MASTER flag 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 the MASTER flag is set, this is the global vlan multicast context
    • port_mcast_ctx β€” if the MASTER flag is unset, this is the per-port/vlan multicast context
  • msti β€” if the MASTER flag 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