[OpenWrt-Devel] [PATCH v2 1/2] base-files: always store label MAC address in uci system config

Kristian Evensen kristian.evensen at gmail.com
Mon Nov 4 08:57:02 EST 2019

Hi Adrian,

On Mon, Nov 4, 2019 at 11:44 AM Adrian Schmutzler
<freifunk at adrianschmutzler.de> wrote:
> If set, label MAC address is available from one of two sources,
> device tree or board.json. So far, the function get_mac_label
> was meant for retrieving the address, while an option in uci
> system config was specified only for case 2 (board.json).
> Since this has been perceived as counter-intuitive, this patch
> changes front-end access to the label MAC address:
> During first-boot, the label MAC address will be written to uci
> system config file for both cases, no matter whether is was
> specified in DT or in board.json (via 02_network). A user of
> the label MAC address will then read the value from
> system. at system[0].label_macaddr, which is easier and more intuitive
> than using a function and still have an uci value set.
> Since this is only changing the access to the label MAC address, it
> won't interfere with the addresses stored in the code base so far.
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>

I am not an authority on anything, but I don't think a "runtime" value
like the label mac should be stored in a persistent configuration
file. For example, if someone makes a mistake with the label MAC, you
would need a uci-default script for fixing up the config. You also
have the issue of devices that have already been installed, without a
uci-defaults script they will not have a label mac in UCI.

Instead, I would keep board.json as the source for label MAC and have
get_mac_label parse the JSON-file. I guess you might also have to
patch the generation of board.json to include the device tree. At
least I think that board.json is as easy to work with as uci from
scripts, Luci, etc.


openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list