summaryrefslogtreecommitdiffstats
path: root/package/linux-atm/files/ipoa.sh
blob: 5d6da1ef954483be14003727dba38e38c8656432 (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
29
30
31
32
33
34
scan_ipoa() {
	config_get ifname "$1" ifname
	ipoadev="${ipoadev:-0}"
	config_get unit "$1" unit
	[ -z "$unit" ] && {
		config_set "$1" ifname "atm$ipoadev"
		config_set "$1" unit "$ipoadev"
		ipoadev="$(($ipoadev + 1))"
	}
}

setup_interface_ipoa() {
	local iface="$1"
	local config="$2"
	
	config_get device "$config" device
	config_get vpi "$config" vpi
	vpi=${vpi:-8}
	config_get vci "$config" vci
	vci=${vci:-36}

	config_get encaps "$config" encaps
	case "$encaps" in
		1|vc) ENCAPS="vc-encaps" ;;
		*) ENCAPS="llc-encaps" ;;
	esac

	config_get mtu "$cfg" mtu
	mtu=${mtu:-1500}
	atmarp -c $device
	ifconfig $device $ip netmask $mask mtu $mtu up
	atmarp -s $gw $vpi.$vci null
	route add default gw $gw
}