
RTACO (RTnetlink Asio COroutines) is a coroutine-first, RTNL-only control-plane library for Linux. It provides Boost.Asio awaitable APIs for NETLINK_ROUTE transactions and for subscribing to kernel notifications (link, address, route, neighbor).
Scope
- Linux only (NETLINK_ROUTE / RTNETLINK).
- Control-plane only - no dataplane.
- Results use std::expected<..., std::error_code>.
API at a glance
- llmx::rtaco::Control (include/rtaco/nl_control.hxx)
- Dumps: dump_routes(), dump_addresses(), dump_links(), dump_neighbors().
- Awaitables: async_dump_routes(), async_dump_addresses(), async_dump_links(), async_dump_neighbors().
- Neighbor ops: probe_neighbor(), flush_neighbor(), get_neighbor() and async variants.
- llmx::rtaco::Listener (include/rtaco/nl_listener.hxx)
- Starts a netlink receive loop and emits typed events via Signal.
- Subscribe via connect_to_event(...) for LinkEvent, AddressEvent, RouteEvent, NeighborEvent.
- Use ExecPolicy::Sync for inline handlers, or ExecPolicy::Async to post handlers onto the executor.
Build
Dependencies:
- C++23 compiler on Linux
- Boost (Asio, Signals2, System)
- Linux netlink headers (typically from linux-libc-dev / kernel headers)
Configure and build (Ninja):
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DRTACO_BUILD_EXAMPLES=ON
cmake --build build
Install:
Consume from CMake:
find_package(llmx-rtaco CONFIG REQUIRED)
target_link_libraries(your_target PRIVATE llmx::rtaco)
Usage (minimal)
#include <boost/asio/io_context.hpp>
boost::asio::io_context io;
return 1;
}
});
io.run();
return 0;
}
High-level control interface for kernel netlink operations.
Definition nl_control.hxx:31
auto dump_routes() -> route_list_result_t
Synchronously dump routes from the kernel.
Definition nl_control.cxx:51
Asynchronous netlink message listener and event dispatcher.
Definition nl_listener.hxx:36
void start()
Start listening for netlink messages and dispatch events.
Definition nl_listener.cxx:59
auto connect_to_event(link_signal_t::slot_t &&slot, ExecPolicy policy=ExecPolicy::Sync) -> boost::signals2::connection
Connect a handler to link events.
Definition nl_listener.hxx:72
int main()
Definition nl_control_example.cxx:11
Definition nl_route_event.hxx:16
For a more complete setup, see:
Privileges
Some operations (for example neighbor probe/flush) typically require CAP_NET_ADMIN. The examples may need to be run under sudo or with capabilities, depending on your environment.
License
See [LICENSE](LICENSE).