- Netifd is available in OpenWrt since R28499 (trunk)
Netifd is an RPC-capable daemon written in C for better access to kernel APIs with the ability to listen on netlink events.
Netifd has replaced the old OpenWrt-network configuration scripts, the actual scripts that configured the network, e.g.
- some scripts in
Netifd is intended to stay compatible with the existing format of
/etc/config/network, the only exceptions being rare special cases like
aliases or the overlay variables in
/var/state (though even most of those can be easily emulated).
- test what has been ported
- review of the code
- help porting more of our protocol handler scripts (so far, static, ppp, pppoe, pppoa and dhcp are supported)
One thing that
netifd does much better then old OpenWrt-network configuration scripts is handling configuration changes. With
netfid, when the file
/etc/config/network changes, you no longer have to restart all interfaces. Simply run
/etc/init.d/network reload. This will issue an
netifd, telling it to figure out the difference between runtime state and the new config and apply only that. This works on a per-interface level, even with protocol handlers written as shell scripts.
It boils down to the fact that the current network and interface setup mechanisms (via network configuration scripts) are rather constrained and inflexible:
- lack of statefulness
- tendency for raceconditions
- inability to properly nest protocols
- limited featureset of the ash shell which will not allow for complex interface operations like e.g. calculating ULAs
- you name it
Netifd will be able to manage even complex interface configurations with a mix of bonding, vlans, bridges, etc. and handle the dependencies
between interfaces properly - and of course all that without adding unnecessary bloat. AFAIK there are no alternatives to netifd, e.g. connman seems to be centered around one specifific use case only: having a mobile device access the internet through multiple connections.
ubus(~ 13KiB) is an RPC daemon similar to dbus but with a much friendlier C API
- json-c (~ 6KiB) required only for the CLI
Whereas desktop distributions use glib and dbus (and udev) OpenWrt uses libubox and ubus (and hotplug2). This provides some pretty awesome functionality without requiring huge libraries with huge dependencies (*cough* glib).
dbus is bloated, its C API is very annoying to use and requires writing large amounts of boilerplate code. In fact, the pure C API is so annoying that its own API documentation states: "If you use this low-level API directly, you're signing up for some pain."
ubus is tiny and has the advantage of being easy to use from regular C code, as well as automatically making all exported API functionality also available to shell scripts with no extra effort.
doc/techref/netifd.txt · Last modified: 2012/11/29 17:39 by orca