STRUCT BATADV_PRIV(9)
๐ธ 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 byrtnl_lock. one-time thing, tracked forever, iconic. ๐bat_countersโ the mesh internal traffic statistic counters (go peek atbatadv_counters). it's per-CPU (__percpu), so everyone gets their own little abacus. ๐งฎaggregated_ogmsโ aboolindicating whether OGM aggregation is enabled. is it on? is it off? thisu8knows. ๐ฆbondingโ aboolindicating whether traffic bonding is enabled. the friend group of packets, holding hands. ๐ซถfragmentationโ aboolindicating whether traffic fragmentation is enabled. breaking big things into little pieces so they fit, we've all been there. ๐bridge_loop_avoidanceโ aboolindicating whether bridge loop avoidance is enabled. only exists whenCONFIG_BATMAN_ADV_BLAis set, obviously. ๐distributed_arp_tableโ aboolindicating whether the distributed ARP table is enabled. gated behindCONFIG_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 au32, 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 (seebatadv_dbg_level). only present withCONFIG_BATMAN_ADV_DEBUG. ๐isolation_markโ theskb->markvalue used to match packets for AP isolation. mark it, isolate it, slay. ๐ท๏ธisolation_mark_maskโ the bitmask identifying which bits inskb->markare 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 protectingforw_bat_list. do not touch the list without it, fr fr. ๐forw_bcast_list_lockโ the lock protectingforw_bcast_list. same energy. ๐tp_list_lockโ a spinlock protectingtp_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. anunsigned 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 ofmeshif_vlanstructs, one per VLAN created on top of the mesh interface represented by this object. one per VLAN, periodt. ๐งmeshif_vlan_list_lockโ the lock protectingmeshif_vlan_list. yes, it also needs one. ๐blaโ bridge loop avoidance data.struct batadv_priv_bla, only whenCONFIG_BATMAN_ADV_BLAis 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 behindCONFIG_BATMAN_ADV_DAT. ๐mcastโ multicast data.struct batadv_priv_mcast, needsCONFIG_BATMAN_ADV_MCAST. ๐กbat_vโ B.A.T.M.A.N. V per mesh-interface private data.struct batadv_priv_bat_v, behindCONFIG_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
- 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