batman-robin
batman-robin is a Rust library and CLI tool to interact with the BATMAN-adv kernel module, providing easy access to mesh network interfaces, neighbors, gateways, and routing algorithms.
What are BATMAN and Robin?
BATMAN-adv (Better Approach To Mobile Ad-hoc Networking - advanced) is a Linux kernel module that implements a Layer 2 mesh networking protocol. Operating entirely within the kernel, BATMAN-adv routes Ethernet frames rather than IP packets, making all participating nodes appear as if they're on the same local area network (LAN). This protocol-agnostic approach enables transparent support for higher layer protocols like IPv4, IPv6, DHCP, and more across multiple physical media including WiFi, Ethernet, and VPN connections.
Key features of BATMAN-adv include:
- Decentralized mesh networking: No central controller required; each node autonomously manages routing
- Layer 2 operation: Routes Ethernet frames for protocol independence at higher layers
- Multi-media support: Works with WiFi, Ethernet, VPNs, and any Layer 2 interface
- Dynamic topology handling: Adapts to mobile and changing network environments
- Minimal overhead: Efficient in-kernel implementation
Robin is the companion tool that makes working with BATMAN-adv straightforward. Named after Batman's sidekick, batman-robin provides both a Rust library (for programmatic access) and a command-line interface (robctl) to manage and monitor BATMAN-adv mesh networks. With Robin, you can easily query mesh status, configure routing parameters, manage network interfaces, and monitor mesh topology—all without needing to work directly with low-level netlink APIs or kernel interfaces.
For more information about BATMAN-adv:
Features
- Query and manage BATMAN-adv mesh interfaces
- Retrieve neighbors, originators, gateways, and translation tables
- Enable/disable aggregation, AP isolation, and bridge loop avoidance
- Inspect and set routing algorithms
- Provides both a Rust API and a command-line interface (
robctl)
Prerequisites
Before using Robin, you need to have the BATMAN-adv kernel module installed and loaded on your Linux system:
# Check if batman-adv is available
# Load the module
For installation instructions and system requirements, see the BATMAN-adv installation guide.
Installation
Add batman-robin as a dependency in your Cargo.toml:
[]
= { = "https://github.com/sntns/robin.git" }
= { = "1", = ["full"] }
Build the CLI:
This will install the robctl CLI tool.
Rust API Usage
use ;
use tokio;
async
API Highlights
- Interface Management
get_interface,set_interface,create_interface,destroy_interface,count_interfaces
- Mesh Settings
get_aggregation,set_aggregationget_ap_isolation,set_ap_isolationget_bridge_loop_avoidance,set_bridge_loop_avoidance
- Routing
get_default_routing_algo,get_active_routing_algos,get_available_routing_algos,set_default_routing_algo
- Gateway
get_gw_mode,set_gw_mode
- Network Tables
neighbors,originators,translocal,transglobal,gateways
CLI Usage
Examples
- Check neighbors
- Enable aggregation
- Set gateway mode to server
- Create a mesh interface with BATMAN_V
- Display the default routing algorithm
Testing
To run tests:
To check code formatting and lint:
To check coverage (requires tarpaulin):
Contributing
Contributions are welcome! You can:
- Open issues for bugs or feature requests
- Submit pull requests for improvements
- Add more examples and documentation
Please make sure to run cargo fmt and cargo clippy before submitting PRs.
Learn More
BATMAN-adv Resources
- Official BATMAN-adv Documentation - Linux kernel documentation for the batman-adv module
- BATMAN-adv Wiki - Comprehensive guides, tutorials, and configuration examples
- open-mesh.org - The B.A.T.M.A.N. advanced project homepage
- BATMAN-adv GitHub - Source code and development repository
Related Tools
- batctl - The official BATMAN-adv control and management tool (C implementation)
Robin vs batctl Comparison
For a comprehensive comparison between Robin and batctl features, including a list of implemented and missing methods, see BATCTL_COMPARISON.md
License
This project is licensed under the MIT License. See the LICENSE file for details.