swconfig: support receiving SWITCH_TYPE_LINK from kernel
[openwrt/openwrt.git] / package / network / config / swconfig / files / switch.sh
1 #!/bin/sh
2 # Copyright (C) 2009 OpenWrt.org
3
4 setup_switch_dev() {
5 local name
6 config_get name "$1" name
7 name="${name:-$1}"
8 [ -d "/sys/class/net/$name" ] && ip link set dev "$name" up
9 swconfig dev "$name" load network
10 }
11
12 setup_switch() {
13 config_load network
14 config_foreach setup_switch_dev switch
15 }