STRUCT BATADV_PRIV(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐ŸŒธ struct batadv_priv(9) ๐ŸŒธ

okay so this is struct batadv_priv from the Kernel API Manual, and bestie, it is literally the main character of batman-adv โ€” it's the per mesh interface data. one of these lives inside every mesh interface and holds, like, everything. it's giving "everything bagel" but for kernel networking. ๐Ÿฅฏโœจ


โœจ NAME โœจ

struct batadv_priv โ€” per mesh interface data ๐Ÿ’–


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

struct batadv_priv {
    enum batadv_mesh_state mesh_state;
    struct net_device *mesh_iface;
    int mtu_set_by_user;
    u64 __percpu *bat_counters;
    u8 aggregated_ogms;
    u8 bonding;
    u8 fragmentation;
  #ifdef CONFIG_BATMAN_ADV_BLA;
    u8 bridge_loop_avoidance;
  #endif;
  #ifdef CONFIG_BATMAN_ADV_DAT;
    u8 distributed_arp_table;
  #endif;
  #ifdef CONFIG_BATMAN_ADV_MCAST;
    u8 multicast_mode;
    u32 multicast_fanout;
  #endif;
    int packet_size_max;
    atomic_t frag_seqno;
    u32 orig_interval;
    u8 hop_penalty;
  #ifdef CONFIG_BATMAN_ADV_DEBUG;
    u32 log_level;
  #endif;
    u32 isolation_mark;
    u32 isolation_mark_mask;
    atomic_t bcast_seqno;
    atomic_t bcast_queue_left;
    atomic_t batman_queue_left;
    struct hlist_head forw_bat_list;
    struct hlist_head forw_bcast_list;
    struct hlist_head tp_sender_list;
    struct hlist_head tp_receiver_list;
    struct batadv_hashtable *orig_hash;
    spinlock_t forw_bat_list_lock;
    spinlock_t forw_bcast_list_lock;
    spinlock_t tp_list_lock;
    atomic_t tp_num;
    unsigned int hardif_generation;
    struct delayed_work orig_work;
    struct batadv_hard_iface *primary_if;
    struct batadv_algo_ops *algo_ops;
    struct hlist_head meshif_vlan_list;
    spinlock_t meshif_vlan_list_lock;
  #ifdef CONFIG_BATMAN_ADV_BLA;
    struct batadv_priv_bla bla;
  #endif;
    struct batadv_priv_gw gw;
    struct batadv_priv_tt tt;
    struct batadv_priv_tvlv tvlv;
  #ifdef CONFIG_BATMAN_ADV_DAT;
    struct batadv_priv_dat dat;
  #endif;
  #ifdef CONFIG_BATMAN_ADV_MCAST;
    struct batadv_priv_mcast mcast;
  #endif;
  #ifdef CONFIG_BATMAN_ADV_BATMAN_V;
    struct batadv_priv_bat_v bat_v;
  #endif;
 };

not me counting the #ifdef blocksโ€ฆ every one of those is a build-time vibe check, and if the config isn't set the field just โœจdoesn't existโœจ. no cap. ๐Ÿ’…


๐ŸŽ€ Members ๐ŸŽ€

okay bestie, field-by-field, no skipping, we're doing all of them ๐Ÿซถ

  • mesh_state โ€” the current status of the mesh, which can be inactive / active / deactivatingโ€ฆ wait, deactivating. it's in transition, it's going through a phase, respect it. ๐Ÿ˜ญ
  • mesh_iface โ€” the net device that holds this whole struct as its private data. it's the home. the landlord. ๐Ÿ 
  • mtu_set_by_user โ€” the MTU was set once by a user, and this is protected by rtnl_lock. one-time thing, tracked forever, iconic. ๐Ÿ”’
  • bat_counters โ€” the mesh internal traffic statistic counters (go peek at batadv_counters). it's per-CPU (__percpu), so everyone gets their own little abacus. ๐Ÿงฎ
  • aggregated_ogms โ€” a bool indicating whether OGM aggregation is enabled. is it on? is it off? this u8 knows. ๐Ÿฆ‹
  • bonding โ€” a bool indicating whether traffic bonding is enabled. the friend group of packets, holding hands. ๐Ÿซถ
  • fragmentation โ€” a bool indicating whether traffic fragmentation is enabled. breaking big things into little pieces so they fit, we've all been there. ๐Ÿ’”
  • bridge_loop_avoidance โ€” a bool indicating whether bridge loop avoidance is enabled. only exists when CONFIG_BATMAN_ADV_BLA is set, obviously. ๐Ÿ”
  • distributed_arp_table โ€” a bool indicating whether the distributed ARP table is enabled. gated behind CONFIG_BATMAN_ADV_DAT. ๐Ÿ“‡
  • multicast_mode โ€” enable or disable multicast optimizations on this node's sender/originating side. note it: sender/originating side, that's the whole flavor. ๐Ÿ“ก
  • multicast_fanout โ€” the maximum number of packet copies to generate for a multicast-to-unicast conversion. it's a u32, it's a limit, don't exceed it. ๐Ÿ”ฅ
  • packet_size_max โ€” the max packet size that can be transmitted via multiple fragmented skbs, or via a single frame if fragmentation is disabled. read that twice, it's a conditional and it matters. ๐Ÿ“ฆ
  • frag_seqno โ€” an incremental counter used to identify chains of egress fragments. atomic, because of course. ๐Ÿ”ข
  • orig_interval โ€” the OGM broadcast interval, in milliseconds. ms! not seconds! โฑ๏ธ
  • hop_penalty โ€” the penalty applied to an OGM's tq-field on every single hop. every. hop. ๐Ÿ“‰
  • log_level โ€” the configured log level (see batadv_dbg_level). only present with CONFIG_BATMAN_ADV_DEBUG. ๐Ÿ›
  • isolation_mark โ€” the skb->mark value used to match packets for AP isolation. mark it, isolate it, slay. ๐Ÿท๏ธ
  • isolation_mark_mask โ€” the bitmask identifying which bits in skb->mark are used for that isolation mark. bitmasks are lowkey gorgeous ngl. ๐ŸŽญ
  • bcast_seqno โ€” the last sent broadcast packet sequence number. atomic. ๐Ÿ“ข
  • bcast_queue_left โ€” how many buffered broadcast packet slots are still remaining. it's a countdown, live your life accordingly. โณ
  • batman_queue_left โ€” how many OGM packet slots are still remaining. also a countdown. also atomic. ๐Ÿ‘‘
  • forw_bat_list โ€” the list of aggregated OGMs that will be forwarded. the to-do list for OGM girlies. ๐Ÿ“‹
  • forw_bcast_list โ€” the list of broadcast packets that will be rebroadcasted. yes, rebroadcasted. ๐Ÿ”
  • tp_sender_list โ€” the list of tp sender sessions. ๐Ÿ’Œ
  • tp_receiver_list โ€” the list of tp receiver sessions. ๐Ÿ“ฌ
  • orig_hash โ€” the hash table containing mesh participants (orig nodes). everyone's in here, it's the group chat member list. ๐Ÿ‘ฏ
  • forw_bat_list_lock โ€” the lock protecting forw_bat_list. do not touch the list without it, fr fr. ๐Ÿ”
  • forw_bcast_list_lock โ€” the lock protecting forw_bcast_list. same energy. ๐Ÿ”
  • tp_list_lock โ€” a spinlock protecting tp_sender_list + tp_receiver_list. one lock, two lists, efficiency icon. ๐Ÿ’…
  • tp_num โ€” the number of currently active tp sessions. atomic counter, keeping score. ๐Ÿงพ
  • hardif_generation โ€” a generation counter added to netlink hardif dumps. an unsigned int. makes the dumps make sense. ๐ŸŒˆ
  • orig_work โ€” the work queue callback item used for orig node purging. struct delayed_work, so it's, like, eventually. ๐Ÿงน
  • primary_if โ€” one of the hard-interfaces assigned to this mesh interface becomes the primary interface. one of them gets promoted. main character energy. ๐Ÿ‘‘
  • algo_ops โ€” the routing algorithm used by this mesh interface. struct batadv_algo_ops *, the blueprint of how we route. ๐Ÿ—บ๏ธ
  • meshif_vlan_list โ€” a list of meshif_vlan structs, one per VLAN created on top of the mesh interface represented by this object. one per VLAN, periodt. ๐Ÿงš
  • meshif_vlan_list_lock โ€” the lock protecting meshif_vlan_list. yes, it also needs one. ๐Ÿ”’
  • bla โ€” bridge loop avoidance data. struct batadv_priv_bla, only when CONFIG_BATMAN_ADV_BLA is on. ๐ŸŒ‰
  • gw โ€” gateway data. struct batadv_priv_gw. always here. ๐Ÿšช
  • tt โ€” translation table data. struct batadv_priv_tt. ๐Ÿ—‚๏ธ
  • tvlv โ€” type-version-length-value data. struct batadv_priv_tvlv. all four of those things. ๐Ÿ“ฆ
  • dat โ€” distributed arp table data. struct batadv_priv_dat, gated behind CONFIG_BATMAN_ADV_DAT. ๐Ÿ“‡
  • mcast โ€” multicast data. struct batadv_priv_mcast, needs CONFIG_BATMAN_ADV_MCAST. ๐Ÿ“ก
  • bat_v โ€” B.A.T.M.A.N. V per mesh-interface private data. struct batadv_priv_bat_v, behind CONFIG_BATMAN_ADV_BATMAN_V. ๐Ÿฆ‡
โš ๏ธ quick reminder bestie: any field wrapped in an #ifdef is only there when that config option is enabled. compile it out and the field just isn't in the struct. no ghost members. ๐Ÿ’€

๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

the whole extended universe, and we are not leaving anyone out ๐Ÿ’œ

  • Kernel file ./net/batman-adv/types.h
  • batadv_dat_addr_t(9)
  • enum batadv_dhcp_recipient(9)
  • BATADV_TT_REMOTE_MASK(9)
  • BATADV_TT_SYNC_MASK(9)
  • struct batadv_ogm_buf(9)
  • struct batadv_hard_iface_bat_iv(9)
  • enum batadv_v_hard_iface_flags(9)
  • struct batadv_hard_iface_bat_v(9)
  • enum batadv_hard_iface_wifi_flags(9)
  • struct batadv_wifi_net_device_state(9)
  • struct batadv_hard_iface(9)
  • struct batadv_orig_ifinfo_bat_iv(9)
  • struct batadv_orig_ifinfo(9)
  • struct batadv_frag_table_entry(9)
  • struct batadv_frag_list_entry(9)
  • struct batadv_vlan_tt(9)
  • struct batadv_orig_node_vlan(9)
  • struct batadv_orig_bat_iv(9)
  • struct batadv_orig_node(9)
  • enum batadv_orig_capabilities(9)
  • struct batadv_gw_node(9)
  • struct batadv_hardif_neigh_node_bat_v(9)
  • struct batadv_hardif_neigh_node(9)
  • struct batadv_neigh_node(9)
  • struct batadv_neigh_ifinfo_bat_iv(9)
  • struct batadv_neigh_ifinfo_bat_v(9)
  • struct batadv_neigh_ifinfo(9)
  • struct batadv_bcast_duplist_entry(9)
  • enum batadv_counters(9)
  • struct batadv_priv_tt(9)
  • struct batadv_priv_bla(9)
  • struct batadv_priv_gw(9)
  • struct batadv_priv_tvlv(9)
  • struct batadv_priv_dat(9)
  • struct batadv_mcast_querier_state(9)
  • struct batadv_mcast_mla_flags(9)
  • struct batadv_priv_mcast(9)
  • struct batadv_tp_unacked(9)
  • struct batadv_tp_vars_common(9)
  • struct batadv_tp_sender_cc(9)
  • struct batadv_tp_sender(9)
  • struct batadv_tp_receiver(9)
  • struct batadv_meshif_vlan(9)
  • struct batadv_priv_bat_v(9)
  • enum batadv_bla_backbone_gw_state(9)
  • struct batadv_bla_backbone_gw(9)
  • struct batadv_bla_claim(9)
  • struct batadv_tt_common_entry(9)
  • struct batadv_tt_local_entry(9)
  • struct batadv_tt_global_entry(9)
  • struct batadv_tt_orig_list_entry(9)
  • struct batadv_tt_change_node(9)
  • struct batadv_tt_req_node(9)
  • struct batadv_tt_roam_node(9)
  • struct batadv_skb_cb(9)
  • struct batadv_forw_packet(9)
  • struct batadv_algo_iface_ops(9)
  • struct batadv_algo_neigh_ops(9)
  • struct batadv_algo_orig_ops(9)
  • struct batadv_algo_gw_ops(9)
  • struct batadv_algo_ops(9)
  • struct batadv_dat_entry(9)
  • struct batadv_hw_addr(9)
  • struct batadv_dat_candidate(9)
  • struct batadv_tvlv_container(9)
  • struct batadv_tvlv_handler(9)
  • enum batadv_tvlv_handler_flags(9)

and that's the whole page bestie, you ate it, go be a mesh interface icon ๐Ÿฆ‹๐Ÿ’–

this one comes from ./net/batman-adv, dated October 2026, and yeah โ€” the footer says struct batadv_priv(9), which is us, we're the footer now, periodt. ๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from