Revision 2e8a73e0 vlans/prv-net-helper

b/vlans/prv-net-helper
1 1
#!/bin/bash
2 2

  
3 3
function usage {
4
	echo "Usage: $0 <mode> <parent interface> <prv min> <prv max> <offset>"
4
	echo "Usage: $0 <mode> <parent interface> <prv min> <prv max> <offset> <bridge prefix>"
5 5
	exit 1
6 6
}
7 7

  
8
if [ $# -ne 5 ]; then
8
if [ $# -ne 6 ]; then
9 9
	usage
10 10
fi
11 11

  
......
14 14
	prv_min=$2
15 15
	prv_max=$3
16 16
	offset=$4
17
  prefix=$5
17 18

  
18 19
	echo "Adding VLANs $2 - $3"
19 20
	vconfig set_name_type DEV_PLUS_VID_NO_PAD
20 21
	for prv in $(seq $prv_min $prv_max); do
21 22
		vlan=$(($prv+$offset))
22
		bridge=prv$prv
23
		bridge=$prefix$prv
23 24

  
24 25
		vconfig add $iface $vlan
25 26
		ifconfig $iface.$vlan up
......
39 40
	echo "Removing VLANs $2 - $3"
40 41
	for prv in $(seq $prv_min $prv_max); do
41 42
		vlan=$(($prv+$offset))
42
		bridge=prv$prv
43
		bridge=$prefix$prv
43 44

  
44 45
		(
45 46
		ifconfig $bridge down

Also available in: Unified diff