After spending nearly a day "configuring" OpenWRT (stable RC4) by altering
most init scripts, effectively forking my own private distro, I've decided to
post here my reasons for doing so. Hopefully this post will be perceived as
constructive criticism and not merely flaimbait.
My reason for choosing OpenWRT was that I could use the full power of a shell
based distro and not be limited by some web interface (Linksys or some other
<cool name>WRT). Unfortunately, I've discovered quickly that the limits of the
web interface were preserved in a lower layer, i.e. the miscrosoftish nvram
registry, which OpenWRT unfortunately adopted.
Perusing some of the posts here, I've discovered that using the nvram as
master config was a design decisions of the OpenWRT team. I'm trying to
argue two points: (1) that keeping the nvram as master config is wrong for a
shell focused distro, and (2) that similar Linksys compatibility can be
achieved by a less annoying import/export procedure.
(1) The nvram registry makes perfect sense for a firmware that lacks a
writable file system, and is web focused, i.e. Linksys and clones.
The "param=value" paradigm fits web applications like a glove.
When a writable file system is available, keeping the nvram as master
config is a bad decision. Many important kernel features (e.g. iptables
firewall) and applications (e.g. dnsmasq) require more powerful languages
than "param=value" offers. The OpenWRT compatibility with Linksys firmware
is fairly limited anyway, as as illustrated by OpenWRT ignoring the
important wk_mode parameter. Having the init scripts rewrite the firewall
rules on every boot to fit wk_mode, which thankfully is not done,
illustrates the limitations of the nvram as master config. OpenWRT has to
play a constant catchup game if it really wants to keep up with the
plethora of Linksys parameters.
I found the master nvram approach very annoying in some specific cases. An
example is the deletion at boot time of /etc/resolv.conf if
lan_dns is not set, even if lan_proto=static. An even more annoying one
was the dnsmasq init script: it added wrong DHCP ranges, which were
impossible to fix using the nvram. I have multiple subnets connected to
the WRT, so a single nvram "lan" setting is not feasible, whereas I can
easily specify them in dnsmasq.conf.
(2) So what's the solution? Mine was to effectively import the settings into
/etc files, sometimes manually, e.g. for wk_mode, and _prevent_ the boot
scripts from subsequently changing them. The import could easily be
automated in the firstboot script. The import approach (as opposed to
master) has the added benefit that one can use config files from most
other LSB (Linux Standards Base) disk based distro's. E.g, I've imported
quagga rip config from a disk based box; quagga init script thankfully
didn't read the nvram at all.
I personally don't care at all about exporting to nvram. Most people
choosing to use OpenWRT would only care about import anyway, as long as
the nvram is preserved, which will allow them to back out of OpenWRT if a
shell based router is too rich for them. Exporting the config of features
not present in Linksys firmware (e.g. wifi_*) is pointless anyway.
Most people using a web based WRT distro are probably unaware of the nvram
language because they don't use it directly, while most admins would
probably find (like me) that using the nvram registry means learning new
config settings, which don't have any advantages but plenty of
disadvantages in a shell router.