base-files: generate network config with "device" options
[openwrt/staging/ynezz.git] / package / base-files / files / lib / functions / uci-defaults.sh
index 407a9c710ff72ffafd5162e427e2da2d73bbcd55..02882f43ca4ed719a1f84144c1d8ea67fa7f1553 100644 (file)
@@ -39,7 +39,7 @@ ucidef_set_interface() {
 
                [ -n "$opt" -a -n "$val" ] || break
 
-               [ "$opt" = "ifname" -a "$val" != "${val/ //}" ] && {
+               [ "$opt" = "device" -a "$val" != "${val/ //}" ] && {
                        json_select_array "ports"
                        for e in $val; do json_add_string "" "$e"; done
                        json_close_array
@@ -79,11 +79,11 @@ ucidef_set_compat_version() {
 }
 
 ucidef_set_interface_lan() {
-       ucidef_set_interface "lan" ifname "$1" protocol "${2:-static}"
+       ucidef_set_interface "lan" device "$1" protocol "${2:-static}"
 }
 
 ucidef_set_interface_wan() {
-       ucidef_set_interface "wan" ifname "$1" protocol "${2:-dhcp}"
+       ucidef_set_interface "wan" device "$1" protocol "${2:-dhcp}"
 }
 
 ucidef_set_interfaces_lan_wan() {
@@ -201,14 +201,14 @@ _ucidef_finish_switch_roles() {
 
                        json_select_object "$role"
                                # attach previous interfaces (for multi-switch devices)
-                               json_get_var devices ifname
+                               json_get_var devices device
                                if ! list_contains devices "$device"; then
                                        devices="${devices:+$devices }$device"
                                fi
                        json_select ..
                json_select ..
 
-               ucidef_set_interface "$role" ifname "$devices"
+               ucidef_set_interface "$role" device "$devices"
        done
 }