[LEDE-DEV] [RFC/RFT 0/7] base-files: use board.d for failsafe network setup

Jonas Gorski jonas.gorski at gmail.com
Fri Jul 29 02:07:48 PDT 2016


This patchset aims at implementing a generic failsafe network setup
based on board.d data, adding working networking for most targets that
were missing the appropriate failsafe hooks.

This was developed against ipq806x which is currently missing failsafe
networking, and at least on AP148 and R7500v1 the switch needs to have
a configured VLAN before it starts passing frames, regardless of 
enable_vlan.

Working network in failsafe mode requires special handling by targets by
adding an extra failsafe hook to setup the right interface. This is
often overlooked, and many targets are missing it.

Since the switch to board.d based config generation, we actually have
the required information (and some) in parsable form, and with it, we
can setup the network interface, and can even setup the switch easily.

To achive that, I first split out the config generation from
board_detect as we are only interested in the board.json.

Since we can't access the overlay, I needed to change the location of
the generated board.json to /tmp for failsafe.

Now that it is accessible, we can start using the information in it to
configure the switch, if required, and the failsafe networking.

Since some configuration might require the networking to be tagged,
failsafe networking learned to setup vlans.

As a fallback if swconfig is missing, failsafe networking will try to
use the interface untagged.

Most targets are untested, and this is a request for testing. Note that
the code only triggers if ifname wasn't setup by any preinit scripts,
so targets that implement it aren't changed (apart from those where I
deleted the setup_preinit_iface script).

Targets that had trivial set_preinit_iface scripts I removed:

* adm5120
* apm821xx
* ar71xx
* ath25
* ramips
* brcm53xx
* brcm2708
* brcm63xx
* lantiq
* mpc85xx

Targets I didn't touch yet:

* brcm47xx: waits for the eth to come up, not sure if required?

Targets that should now have gained working networking in failsafe:

* ar7
* arc770
* at91
* imx6
* ipq906x
* kirkwood
* malta
* mcs8214x
* mediatek
* mvebu
* mxs
* octeon
* orion
* oxnas
* realview
* sunxi
* xburst
* zynq

Targets that do not implement board.d, thus are not supported:

* adm8668 (still implements set_preinit_iface)
* arm64
* au1000
* cns3xxx
* gemini
* ixp4xx
* omap
* omap24xx
* ppc40x
* ppc44x
* rb532
* uml
* x86

This patchset is also available at my staging git at

https://git.lede-project.org/?p=lede/jogo/staging.git;a=shortlog;h=refs/heads/generic-failsafe-networking

Jonas Gorski (7):
  base-files: split config generation out of board_detect
  base-files: add preinit ifname detection based on board.json
  base-files: allow failsafe to configure vlans
  base-files: configure switch in failsafe
  targets: remove trivial set_preinit_iface_*
  ramips: switch to generic failsafe iface setup
  ath25: switch to generic failsafe iface setup

 package/base-files/files/bin/board_detect          |  10 +-
 package/base-files/files/etc/init.d/boot           |   2 +-
 .../base-files/files/lib/functions/uci-defaults.sh |   2 -
 .../files/lib/preinit/10_indicate_preinit          | 102 ++++++++++++++++++++-
 .../lib/preinit/05_set_preinit_iface_adm5120       |   9 --
 .../lib/preinit/05_set_preinit_iface_apm821xx      |   9 --
 .../lib/preinit/05_set_preinit_iface_ar71xx        |  57 ------------
 .../lib/preinit/15_preinit_iface_atheros           |  35 -------
 .../lib/preinit/05_set_preinit_iface_bcm53xx       |   7 --
 .../lib/preinit/05_set_preinit_iface_brcm2708      |  17 ----
 .../lib/preinit/05_init_interfaces_brcm63xx        |  37 --------
 .../lib/preinit/05_set_preinit_iface_lantiq        |  10 --
 .../lib/preinit/05_set_preinit_iface_mpc85xx       |  12 ---
 .../lib/preinit/07_set_preinit_iface_ramips        |  29 ------
 14 files changed, 105 insertions(+), 233 deletions(-)
 delete mode 100644 target/linux/adm5120/base-files/lib/preinit/05_set_preinit_iface_adm5120
 delete mode 100644 target/linux/apm821xx/base-files/lib/preinit/05_set_preinit_iface_apm821xx
 delete mode 100644 target/linux/ar71xx/base-files/lib/preinit/05_set_preinit_iface_ar71xx
 delete mode 100644 target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros
 delete mode 100644 target/linux/bcm53xx/base-files/lib/preinit/05_set_preinit_iface_bcm53xx
 delete mode 100644 target/linux/brcm2708/base-files/lib/preinit/05_set_preinit_iface_brcm2708
 delete mode 100644 target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx
 delete mode 100644 target/linux/lantiq/base-files/lib/preinit/05_set_preinit_iface_lantiq
 delete mode 100644 target/linux/mpc85xx/base-files/lib/preinit/05_set_preinit_iface_mpc85xx
 delete mode 100644 target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips

-- 
2.1.4




More information about the Lede-dev mailing list