@@ -88,8 +88,32 @@ ucidef_set_interfaces_lan_wan() {
}
ucidef_set_interface_raw() {
+ local opt=";"
+ local val=""
+
+ [ -z "$1" ] && return
+
json_select_object network
- _ucidef_set_interface "$@"
+
+ for i in "$@"; do
+ [ "$opt" == ";" ] && {
+ json_select_object "$i"
+ opt=""
+ continue
+ }
+ [ -z $opt ] && {
+ opt="$i"
+ continue
+ }
+ [ -z $val ] && val="$i"
+
+ json_add_string "$opt" "$val"
+
+ opt=""
+ val=""
+ done
+
+ json_select ..
json_select ..
}
@@ -427,7 +427,7 @@ ar71xx_setup_interfaces()
;;
tellstick-znet-lite)
ucidef_set_interface_wan "eth0"
- ucidef_set_interface_raw "wlan" "wlan0" "dhcp"
+ ucidef_set_interface_raw "wlan" iface "wlan0" protocol "dhcp"
;;
tl-mr3420-v2|\
tl-wr841n-v8|\
@@ -458,7 +458,7 @@ ar71xx_setup_interfaces()
;;
tl-wr841n-v1|\
tl-wr941nd)
- ucidef_set_interface_raw "eth" "eth0"
+ ucidef_set_interface_raw "eth" iface "eth0"
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
;;
tl-wr741nd|\
This allows custom config generation. E.g. setting lan adrress from eeprom or random address (so that routers can be chained by default) or configuring a fully custom interface. Changes from v1: - fix protocol option name for users Signed-off-by: Roman Yeryomin <roman@advem.lv> --- .../base-files/files/lib/functions/uci-defaults.sh | 26 +++++++++++++++++++++- .../linux/ar71xx/base-files/etc/board.d/02_network | 4 ++-- 2 files changed, 27 insertions(+), 3 deletions(-)