aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files
diff options
context:
space:
mode:
authorChuanhong Guo <gch981213@gmail.com>2020-04-10 12:07:25 +0800
committerChuanhong Guo <gch981213@gmail.com>2020-04-12 22:29:02 +0800
commitf017f617aecbd47debd4d3a734dc0e471342db96 (patch)
tree477423d6839f059542c626636f9c4b121d5ef367 /package/base-files/files
parent605a7ffff2995f09a222489a143fcdb94540b3d6 (diff)
downloadupstream-f017f617aecbd47debd4d3a734dc0e471342db96.tar.gz
upstream-f017f617aecbd47debd4d3a734dc0e471342db96.tar.bz2
upstream-f017f617aecbd47debd4d3a734dc0e471342db96.zip
base-files: preinit: also config switch when no port roles defined
current preinit code in base-files doesn't config switch when there are no port roles defined. But this kind of configuration exists on single port devices where switch vlan is simply disabled. configure reset and enable_vlan property when a switch node exist. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Diffstat (limited to 'package/base-files/files')
-rw-r--r--package/base-files/files/lib/preinit/10_indicate_preinit13
1 files changed, 7 insertions, 6 deletions
diff --git a/package/base-files/files/lib/preinit/10_indicate_preinit b/package/base-files/files/lib/preinit/10_indicate_preinit
index c3ec7bfdf7..423c425223 100644
--- a/package/base-files/files/lib/preinit/10_indicate_preinit
+++ b/package/base-files/files/lib/preinit/10_indicate_preinit
@@ -33,6 +33,11 @@ preinit_config_switch() {
json_get_vars enable reset
+ if [ "$reset" -eq "1" ]; then
+ swconfig dev $name set reset
+ fi
+ swconfig dev $name set enable_vlan $enable
+
if json_is_a roles array; then
json_get_keys roles roles
json_select roles
@@ -43,19 +48,15 @@ preinit_config_switch() {
json_select ..
if [ "$device" = "$lan_if" ]; then
- if [ "$reset" -eq "1" ]; then
- swconfig dev $name set reset
- fi
-
- swconfig dev $name set enable_vlan $enable
swconfig dev $name vlan $role set ports "$ports"
- swconfig dev $name set apply
fi
done
json_select ..
fi
+ swconfig dev $name set apply
+
json_select ..
json_select ..
}