aboutsummaryrefslogtreecommitdiffstats
path: root/package/utils/admswconfig/files/admswswitch.sh
blob: 984d7eea791fb24f780c2d8285b4ee3c7cb00ad3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org

setup_switch_vlan() {
	config_get ports "$CONFIG_SECTION" "eth$1"
	ports=`echo "$ports"| sed s/" "/""/g`
	ifconfig eth$1 down
	admswconfig eth$1 ${ports}c
	ifconfig eth$1 up
}

setup_switch() {
	config_cb() {
		case "$1" in
			switch)
				option_cb() {
					case "$1" in
						eth*) setup_switch_vlan "${1##eth}";;
					esac
				}
			;;
			*)
				option_cb() { return 0; }
			;;
		esac
	}
	config_load network
}