base-files: config_generate: split macaddr with multiple ifaces
authorSungbo Eo <mans0n@gorani.run>
Mon, 11 Nov 2019 16:20:45 +0000 (01:20 +0900)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Tue, 26 Nov 2019 16:04:17 +0000 (17:04 +0100)
commit7863a8f302048857ce2276fbbdf899f474b8948c
tree9ec7a03730f3b92f7d289ea135715475f4fbcd9f
parentdaed78ab55b135235a106b4b75bf3b650f81786e
base-files: config_generate: split macaddr with multiple ifaces

netifd does not handle network.@device[x].name properly if it
contains multiple ifaces separated by spaces. Due to this, board.d
lan_mac setup does not work if multiple ifaces are set to LAN by
ucidef_set_interface_lan.

To fix this, create a device node for each member iface when
running config_generate instead. Those are named based on the
member ifname:

  ucidef_set_interface_lan "eth0 eth1.1"
  ucidef_set_interface_macaddr "lan" "yy:yy:yy:yy:yy:01"

will return

  config device 'lan_eth0_dev'
        option name 'eth0'
        option macaddr 'yy:yy:yy:yy:yy:01'

  config device 'lan_eth1_1_dev'
        option name 'eth1.1'
        option macaddr 'yy:yy:yy:yy:yy:01'

ref: https://github.com/openwrt/openwrt/pull/2542

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
[always use new scheme, extend description, change commit title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 298814e6be7640d89328de9e7c90d4349e30683f)
package/base-files/Makefile
package/base-files/files/bin/config_generate