How openwrt/netifd works
netifd is an OpenWrt network-interface daemon: it manages configured interfaces, protocol state, IP settings and Linux link devices, and exposes daemon control and notifications through ubus. The principal runtime path is interface lifecycle management, protocol-provided or configured IP state, then device/system operations; device types include bridges and bonding, while external devices and script/ucode handlers extend configuration and control. The excerpts directly show only selected calls, so other likely orchestration links are dashed and marked unverified rather than asserted.
Main entry points: interface.c Interface lifecycle · system.c System abstraction · proto.c Protocol registry · ubus.c Ubus API
Components 21
Daemon runtime
- Daemon entry
main.c
Interfaces and IP
- Interface lifecycle
interface.c - IP settings
interface-ip.c - IP rules
iprule.c
Protocols and configuration
- Config loading
config.c - Protocol registry
proto.c - Static protocol
proto-static.c - Shell protocol
proto-shell.c - External protocol
proto-ext.c - Ucode protocol
proto-ucode.c - Ucode runtime
ucode.c
Devices and system
- Device lifecycle
device.c - Bridge device
bridge.c - Bonding device
bonding.c - External devices
extdev.c - System abstraction
system.c - Linux networking
system-linux.c
Control and events
- Script handlers
handler.c - Ubus API
ubus.c - Interface events
interface-event.c
Other components
- Network operator
Connections 20
- Network operator → Ubus API: controls
- Daemon entry → Ubus API: initializes
main.c - Config loading → Interface lifecycle: loads settings
- Interface lifecycle → IP settings: initializes and updates
interface.c - Interface lifecycle → Device lifecycle: releases and configures
interface.c - Interface lifecycle → Protocol registry: attaches protocol
- Protocol registry → Static protocol: dispatches
- Protocol registry → Shell protocol: dispatches
- Protocol registry → External protocol: dispatches
- Protocol registry → Ucode protocol: dispatches
- Ucode protocol → Ucode runtime: uses runtime
- IP settings → System abstraction: adds addresses
interface-ip.c - IP rules → System abstraction: applies rules
- Device lifecycle → System abstraction: manages links
- System abstraction → Linux networking: implements Linux ops
- Bridge device → System abstraction: configures bridge
- Bonding device → System abstraction: configures bonding
- External devices → Script handlers: uses handlers
- Interface lifecycle → Interface events: emits lifecycle events
- Interface lifecycle → Ubus API: publishes interface state