How open-mesh-mirror/batman-adv works
batman-adv is a Linux kernel Layer-2 mesh driver: it presents a virtual Ethernet interface and routes or bridges frames across participating nodes. The main workflow is to configure a mesh and its physical interfaces, exchange protocol messages to discover neighbors and routes, then forward client frames toward their mesh destination. The tree and README identify additional gateway, multicast, address-resolution, loop-avoidance, fragmentation, diagnostics, and configuration capabilities. Edges for unsampled subsystems reflect documented roles; detailed call wiring is shown only where the excerpts support it.
Main entry points: routing.c Frame routing · netlink.c Generic netlink · main.c Module and packet dispatch · bat_v.c BATMAN V protocol
Components 23
Interfaces and control
- Virtual mesh interface
net/batman-adv/mesh-interface.c - Physical interfaces
net/batman-adv/hard-interface.c - Generic netlink
net/batman-adv/netlink.c - Module and packet dispatch
net/batman-adv/main.c - Mesh configuration and state
include/uapi/linux/batman_adv.h
Mesh routing
- Algorithm selection
net/batman-adv/bat_algo.c - BATMAN V protocol
net/batman-adv/bat_v.c - Neighbor probing
net/batman-adv/bat_v_elp.c - BATMAN V announcements
net/batman-adv/bat_v_ogm.c - BATMAN IV protocol
net/batman-adv/bat_iv_ogm.c - Originator tracking
net/batman-adv/originator.c - Frame routing
net/batman-adv/routing.c - Packet transmission
net/batman-adv/send.c
Mesh services
- Client translation table
net/batman-adv/translation-table.c - Gateway selection
net/batman-adv/gateway_client.c - Distributed ARP table
net/batman-adv/distributed-arp-table.c - Multicast handling
net/batman-adv/multicast.c - Bridge loop avoidance
net/batman-adv/bridge_loop_avoidance.c - Frame fragmentation
net/batman-adv/fragmentation.c
Diagnostics and tests
- Kernel logging and tracing
net/batman-adv/trace.c - Throughput meter
net/batman-adv/tp_meter.c
Other components
- Operator and batctl
- Linux networking
Connections 28
- Operator and batctl → Generic netlink: configures mesh
- Generic netlink → Mesh configuration and state: uses command schema
- Generic netlink → Virtual mesh interface: configures interface
- Linux networking → Virtual mesh interface: supplies frames
- Virtual mesh interface → Physical interfaces: attaches interfaces
- Physical interfaces → Module and packet dispatch: receives packets
- Module and packet dispatch → BATMAN IV protocol: dispatches packets
- Module and packet dispatch → BATMAN V protocol: initializes protocol
- BATMAN V protocol → Neighbor probing: probes neighbors
- BATMAN V protocol → BATMAN V announcements: announces topology
- BATMAN IV protocol → Originator tracking: updates node state
- BATMAN V announcements → Originator tracking: updates node state
- Algorithm selection → BATMAN V protocol: selects algorithm
- Algorithm selection → BATMAN IV protocol: selects algorithm
- Module and packet dispatch → Frame routing: dispatches packets
- Frame routing → Originator tracking: looks up routes
- Frame routing → Client translation table: looks up clients
- Frame routing → Virtual mesh interface: delivers frames
- Frame routing → Packet transmission: forwards frames
- Packet transmission → Physical interfaces: transmits frames
- Frame routing → Frame fragmentation: handles oversized frames
- Frame routing → Gateway selection: checks gateway route
- Frame routing → Distributed ARP table: resolves ARP
- Frame routing → Multicast handling: handles multicast
- Frame routing → Bridge loop avoidance: coordinates bridge loops
- Operator and batctl → Kernel logging and tracing: enables debug
- Operator and batctl → Throughput meter: requests measurement
- Generic netlink → Gateway selection: reports gateway state