summaryrefslogtreecommitdiff
path: root/package/swconfig/files/switch.sh
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-01-18 00:38:04 +0000
committerFelix Fietkau <nbd@openwrt.org>2010-01-18 00:38:04 +0000
commit54bbc306875d7eb7dc3b86016242580004a9644b (patch)
tree0c911058c8255e9746eb54bdbc8c0de04cd524a0 /package/swconfig/files/switch.sh
parent2670e906b6f9c500b87ece595825e88aa5157ff4 (diff)
downloadmtk-20170518-54bbc306875d7eb7dc3b86016242580004a9644b.zip
mtk-20170518-54bbc306875d7eb7dc3b86016242580004a9644b.tar.gz
mtk-20170518-54bbc306875d7eb7dc3b86016242580004a9644b.tar.bz2
swconfig: support providing the switch device name in an option instead of the section name - necessary to support switches that contain characters such as "-"
SVN-Revision: 19208
Diffstat (limited to 'package/swconfig/files/switch.sh')
-rw-r--r--package/swconfig/files/switch.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/package/swconfig/files/switch.sh b/package/swconfig/files/switch.sh
index 7078b2e..18d5fbd 100644
--- a/package/swconfig/files/switch.sh
+++ b/package/swconfig/files/switch.sh
@@ -2,8 +2,10 @@
# Copyright (C) 2009 OpenWrt.org
setup_switch_dev() {
- ifconfig "$1" 0.0.0.0
- swconfig dev "$1" load network
+ config_get name "$1" name
+ name="${name:-$1}"
+ [ -d "/sys/class/net/$name" ] && ifconfig "$name" up
+ swconfig dev "$name" load network
}
setup_switch() {