BATMAN-adv

Type: Kernel Module (Layer 2 Mesh) Role in Styrene: Physical connectivity layer for fleet devices

BATMAN-adv (Better Approach To Mobile Adhoc Networking - advanced) is a Linux kernel module that creates a virtual network switch across multiple wireless hops.

Why Styrene Uses BATMAN-adv

Reticulum solves logical connectivity (identity-based routing, encryption). BATMAN-adv solves physical connectivity:

ProblemBATMAN-adv Solution
Multi-hop WiFiTransparent bridging across mesh nodes
Path selectionOGM (Originator Messages) measure actual throughput
InterferenceAdapts routes based on real conditions
Node mobilityUpdates routes as devices move

Layer Position

┌─────────────────────────────────────┐
│  Reticulum (identity + encryption)  │  ← Sees bat0 as just another interface
├─────────────────────────────────────┤
│  BATMAN-adv (bat0 virtual switch)   │  ← YOU ARE HERE
├─────────────────────────────────────┤
│  802.11s mesh (wlan0, mesh-styrene) │  ← WiFi mesh mode
└─────────────────────────────────────┘

Virtual Interface

BATMAN-adv creates bat0, a virtual Ethernet interface:

  • All mesh nodes share the same bat0 broadcast domain
  • Traffic is encapsulated and routed through optimal path
  • Applications see a simple Ethernet interface

Styrene Configuration

Fleet devices use the batman-mesh.nix NixOS module:

styrene.mesh = {
  enable = true;
  meshId = "styrene";
  meshKey = "fleet-key-from-vault";
  channel = 6;
  gwMode = "client";  # or "server" or "off"
};

Gateway Modes

ModePurposeExample
serverBridges mesh to LAN/internetHub node
clientUses gateway when availableFleet devices
offPure mesh, no gatewayIsolated mesh

Key Concepts

OGM (Originator Messages)

Nodes periodically broadcast OGMs to announce presence. Other nodes measure:

  • Packet loss
  • Latency
  • Throughput quality

Routes favor paths with best actual performance, not just fewest hops.

TQ (Transmission Quality)

A 0-255 metric representing link quality. Higher = better. BATMAN-adv selects paths that maximize TQ.

Mesh vs Infrastructure

802.11s MeshInfrastructure (AP)
No central controllerAccess Point required
Multi-hop nativeSingle hop only
Devices peer directlyAll traffic through AP
PSK shared across meshPSK per-AP

Styrene uses 802.11s for device-to-device connectivity.

Debugging

# Show mesh neighbors
batctl n

# Show originators (all mesh nodes)
batctl o

# Show gateway list
batctl gwl

# Show transmission quality to node
batctl tq

Complementary Layers

BATMAN-adv and Reticulum are not redundant:

LayerSolvesUses
BATMAN-adv”Get frame from A to B over 3 hops”MAC addresses, OGMs
Reticulum“Send encrypted message to identity X”Cryptographic hashes

Reticulum runs over BATMAN-adv’s bat0 interface.

Resources

  • Reticulum — Overlay network running on bat0
  • LoRa — Alternative physical layer for long range

Graph