summaryrefslogtreecommitdiff
path: root/package/utils/admswconfig/files/admswswitch.sh
blob: 3b8aabf34d18b02d527a736204d8c46e8c5e219f (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`
	ip link set dev eth$1 down
	admswconfig eth$1 ${ports}c
	ip link set dev 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
}