# olsr/olsrd architecture

> Architecture diagram of the GitHub repository olsr/olsrd, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/olsr/olsrd
- Repository: https://github.com/olsr/olsrd

## Overview

OLSRd is a mobile ad hoc network routing daemon. Its principal workflow is to receive OLSR traffic, maintain link and topology knowledge, calculate routes, and apply route changes to the operating system. The tree also shows optional plugins for status APIs, naming, position updates, packet forwarding, and other integrations, plus separate graphical frontends. The README is empty and the excerpts are partial, so several subsystem connections are intentionally left unspecified.

Main entry points: [`src/process_routes.c`](https://github.com/olsr/olsrd/blob/master/src/process_routes.c) (Route updates), [`lib/info/olsrd_info.c`](https://github.com/olsr/olsrd/blob/master/lib/info/olsrd_info.c) (Status information), [`src/process_package.c`](https://github.com/olsr/olsrd/blob/master/src/process_package.c) (Packet processing), [`src/interfaces.c`](https://github.com/olsr/olsrd/blob/master/src/interfaces.c) (Interface management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Routing daemon"]
  node_daemon["Daemon startup<br/>[main.c]"]
  node_interfaces["Interface management<br/>[interfaces.c]"]
  node_packet["Packet processing<br/>[process_package.c]"]
  node_links["Link state<br/>[link_set.c]"]
  node_topology["Topology state<br/>[tc_set.c]"]
  node_mpr["MPR selection<br/>[mpr.c]"]
  node_spf["Route calculation<br/>[olsr_spf.c]"]
  node_route_update["Route updates<br/>[process_routes.c]"]
  node_plugin_loader["Plugin loading<br/>[plugin_loader.c]"]
end

subgraph group_platform["Network platform"]
  node_kernel_routes["Linux route backend<br/>[kernel_routes_nl.c]"]
  node_bsd_routes["BSD route backend<br/>[kernel_routes.c]"]
  node_windows_routes["Windows route backend<br/>[kernel_routes.c]"]
end

subgraph group_plugins["Optional plugins"]
  node_info_api["Status information<br/>[olsrd_info.c]"]
  node_jsoninfo["JSON status plugin<br/>[olsrd_jsoninfo.c]"]
  node_httpinfo["HTTP status plugin<br/>[olsrd_httpinfo.c]"]
  node_txtinfo["Text status plugin<br/>[olsrd_txtinfo.c]"]
  node_name_service["Network naming<br/>[nameservice.c]"]
  node_pud["Position updates<br/>[pud.c]"]
  node_bmf["Broadcast forwarding<br/>[Bmf.c]"]
end

subgraph group_clients["Management clients"]
  node_gtk["GTK frontend<br/>[main.c]"]
  node_win_gui["Windows frontend<br/>[Frontend.cpp]"]
end

node_network(("Peer network"))
node_kernel[("OS routing table")]
node_gpsd["GPS data source"]
node_info_client(("Info API client"))

node_network -->|"sends traffic"| node_interfaces
node_interfaces -->|"delivers packets"| node_packet
node_packet -->|"updates link state"| node_links
node_packet -->|"updates topology"| node_topology
node_links -->|"provides neighbors"| node_mpr
node_topology -->|"provides topology"| node_spf
node_mpr -->|"provides relays"| node_spf
node_spf -->|"provides routes"| node_route_update
node_route_update -->|"applies changes"| node_kernel_routes
node_route_update -.->|"applies changes"| node_bsd_routes
node_route_update -.->|"applies changes"| node_windows_routes
node_kernel_routes -->|"writes routes"| node_kernel
node_bsd_routes -.->|"writes routes"| node_kernel
node_windows_routes -.->|"writes routes"| node_kernel
node_daemon -->|"starts"| node_interfaces
node_daemon -->|"loads plugins"| node_plugin_loader
node_info_client -.->|"requests status"| node_info_api
node_jsoninfo -.->|"uses status data"| node_info_api
node_httpinfo -.->|"uses status data"| node_info_api
node_txtinfo -.->|"uses status data"| node_info_api
node_gpsd -.->|"provides position"| node_pud

click node_daemon "https://github.com/olsr/olsrd/blob/master/src/main.c"
click node_interfaces "https://github.com/olsr/olsrd/blob/master/src/interfaces.c"
click node_packet "https://github.com/olsr/olsrd/blob/master/src/process_package.c"
click node_links "https://github.com/olsr/olsrd/blob/master/src/link_set.c"
click node_topology "https://github.com/olsr/olsrd/blob/master/src/tc_set.c"
click node_mpr "https://github.com/olsr/olsrd/blob/master/src/mpr.c"
click node_spf "https://github.com/olsr/olsrd/blob/master/src/olsr_spf.c"
click node_route_update "https://github.com/olsr/olsrd/blob/master/src/process_routes.c"
click node_kernel_routes "https://github.com/olsr/olsrd/blob/master/src/linux/kernel_routes_nl.c"
click node_bsd_routes "https://github.com/olsr/olsrd/blob/master/src/bsd/kernel_routes.c"
click node_windows_routes "https://github.com/olsr/olsrd/blob/master/src/win32/kernel_routes.c"
click node_plugin_loader "https://github.com/olsr/olsrd/blob/master/src/plugin_loader.c"
click node_info_api "https://github.com/olsr/olsrd/blob/master/lib/info/olsrd_info.c"
click node_jsoninfo "https://github.com/olsr/olsrd/blob/master/lib/jsoninfo/src/olsrd_jsoninfo.c"
click node_httpinfo "https://github.com/olsr/olsrd/blob/master/lib/httpinfo/src/olsrd_httpinfo.c"
click node_txtinfo "https://github.com/olsr/olsrd/blob/master/lib/txtinfo/src/olsrd_txtinfo.c"
click node_name_service "https://github.com/olsr/olsrd/blob/master/lib/nameservice/src/nameservice.c"
click node_pud "https://github.com/olsr/olsrd/blob/master/lib/pud/src/pud.c"
click node_bmf "https://github.com/olsr/olsrd/blob/master/lib/bmf/src/Bmf.c"
click node_gtk "https://github.com/olsr/olsrd/blob/master/gui/linux-gtk/src/main.c"
click node_win_gui "https://github.com/olsr/olsrd/blob/master/gui/win32/Main/Frontend.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_daemon,node_interfaces,node_packet,node_links,node_topology,node_mpr,node_spf,node_route_update,node_plugin_loader,node_info_client toneBlue
class node_kernel_routes,node_bsd_routes,node_windows_routes,node_kernel toneAmber
class node_info_api,node_jsoninfo,node_httpinfo,node_txtinfo,node_name_service,node_pud,node_bmf toneMint
class node_gtk,node_win_gui toneRose
class node_network,node_gpsd toneIndigo
```

## Components

### Routing daemon

- [Daemon startup](https://github.com/olsr/olsrd/blob/master/src/main.c): `src/main.c`
- [Interface management](https://github.com/olsr/olsrd/blob/master/src/interfaces.c): `src/interfaces.c`
- [Packet processing](https://github.com/olsr/olsrd/blob/master/src/process_package.c): `src/process_package.c`
- [Link state](https://github.com/olsr/olsrd/blob/master/src/link_set.c): `src/link_set.c`
- [Topology state](https://github.com/olsr/olsrd/blob/master/src/tc_set.c): `src/tc_set.c`
- [MPR selection](https://github.com/olsr/olsrd/blob/master/src/mpr.c): `src/mpr.c`
- [Route calculation](https://github.com/olsr/olsrd/blob/master/src/olsr_spf.c): `src/olsr_spf.c`
- [Route updates](https://github.com/olsr/olsrd/blob/master/src/process_routes.c): `src/process_routes.c`
- [Plugin loading](https://github.com/olsr/olsrd/blob/master/src/plugin_loader.c): `src/plugin_loader.c`

### Network platform

- [Linux route backend](https://github.com/olsr/olsrd/blob/master/src/linux/kernel_routes_nl.c): `src/linux/kernel_routes_nl.c`
- [BSD route backend](https://github.com/olsr/olsrd/blob/master/src/bsd/kernel_routes.c): `src/bsd/kernel_routes.c`
- [Windows route backend](https://github.com/olsr/olsrd/blob/master/src/win32/kernel_routes.c): `src/win32/kernel_routes.c`

### Optional plugins

- [Status information](https://github.com/olsr/olsrd/blob/master/lib/info/olsrd_info.c): `lib/info/olsrd_info.c`
- [JSON status plugin](https://github.com/olsr/olsrd/blob/master/lib/jsoninfo/src/olsrd_jsoninfo.c): `lib/jsoninfo/src/olsrd_jsoninfo.c`
- [HTTP status plugin](https://github.com/olsr/olsrd/blob/master/lib/httpinfo/src/olsrd_httpinfo.c): `lib/httpinfo/src/olsrd_httpinfo.c`
- [Text status plugin](https://github.com/olsr/olsrd/blob/master/lib/txtinfo/src/olsrd_txtinfo.c): `lib/txtinfo/src/olsrd_txtinfo.c`
- [Network naming](https://github.com/olsr/olsrd/blob/master/lib/nameservice/src/nameservice.c): `lib/nameservice/src/nameservice.c`
- [Position updates](https://github.com/olsr/olsrd/blob/master/lib/pud/src/pud.c): `lib/pud/src/pud.c`
- [Broadcast forwarding](https://github.com/olsr/olsrd/blob/master/lib/bmf/src/Bmf.c): `lib/bmf/src/Bmf.c`

### Management clients

- [GTK frontend](https://github.com/olsr/olsrd/blob/master/gui/linux-gtk/src/main.c): `gui/linux-gtk/src/main.c`
- [Windows frontend](https://github.com/olsr/olsrd/blob/master/gui/win32/Main/Frontend.cpp): `gui/win32/Main/Frontend.cpp`

### Other components

- **Peer network**
- **OS routing table**
- **GPS data source**
- **Info API client**

## Connections

- Peer network → Interface management: sends traffic
- Interface management → Packet processing: delivers packets
- Packet processing → Link state: updates link state
- Packet processing → Topology state: updates topology
- Link state → MPR selection: provides neighbors
- Topology state → Route calculation: provides topology
- MPR selection → Route calculation: provides relays
- Route calculation → Route updates: provides routes
- Route updates → Linux route backend: applies changes
- Route updates → BSD route backend: applies changes
- Route updates → Windows route backend: applies changes
- Linux route backend → OS routing table: writes routes
- BSD route backend → OS routing table: writes routes
- Windows route backend → OS routing table: writes routes
- Daemon startup → Interface management: starts
- Daemon startup → Plugin loading: loads plugins
- Info API client → Status information: requests status
- JSON status plugin → Status information: uses status data
- HTTP status plugin → Status information: uses status data
- Text status plugin → Status information: uses status data
- GPS data source → Position updates: provides position
