Skip to content

Commit

Permalink
base-files: preinit: also config switch when no port roles defined
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
981213 committed Apr 12, 2020
1 parent 605a7ff commit f017f61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package/base-files/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
include $(INCLUDE_DIR)/feeds.mk

PKG_NAME:=base-files
PKG_RELEASE:=216
PKG_RELEASE:=217
PKG_FLAGS:=nonshared

PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
Expand Down
13 changes: 7 additions & 6 deletions package/base-files/files/lib/preinit/10_indicate_preinit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ..
}
Expand Down

0 comments on commit f017f61

Please sign in to comment.