2007-04-21 09:37:13 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
2011-11-08 22:48:00 +00:00
|
|
|
|
2007-05-10 10:38:53 +00:00
|
|
|
START=50
|
2015-12-04 17:44:00 +00:00
|
|
|
USE_PROCD=1
|
2011-11-08 22:48:00 +00:00
|
|
|
|
2007-04-21 09:37:13 +00:00
|
|
|
start_daemon() {
|
|
|
|
local cfg="$1"
|
2010-10-20 20:10:17 +00:00
|
|
|
|
2015-12-10 14:40:55 +00:00
|
|
|
local atmdev disabled
|
|
|
|
|
|
|
|
config_get_bool disabled "$cfg" disabled 0
|
|
|
|
[ "$disabled" -eq 1 ] && return
|
|
|
|
|
2010-10-20 20:10:17 +00:00
|
|
|
config_get atmdev "$cfg" atmdev 0
|
|
|
|
|
2018-01-08 12:12:20 +00:00
|
|
|
local nameprefix
|
|
|
|
config_get nameprefix "$cfg" nameprefix "nas"
|
|
|
|
|
2010-10-20 20:10:17 +00:00
|
|
|
local unit
|
|
|
|
config_get unit "$cfg" unit 0
|
|
|
|
|
|
|
|
local vpi
|
|
|
|
config_get vpi "$cfg" vpi 8
|
|
|
|
|
|
|
|
local vci
|
|
|
|
config_get vci "$cfg" vci 35
|
|
|
|
|
|
|
|
local encaps
|
2007-04-21 09:37:13 +00:00
|
|
|
config_get encaps "$cfg" encaps
|
2010-10-20 20:10:17 +00:00
|
|
|
|
2007-04-21 09:37:13 +00:00
|
|
|
case "$encaps" in
|
|
|
|
1|vc) encaps=1;;
|
|
|
|
*) encaps=0;;
|
|
|
|
esac
|
2010-10-20 20:10:17 +00:00
|
|
|
|
|
|
|
local payload
|
|
|
|
config_get payload "$cfg" payload
|
|
|
|
|
|
|
|
case "$payload" in
|
|
|
|
0|routed) payload=0;;
|
|
|
|
*) payload=1;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
local qos
|
|
|
|
config_get qos "$cfg" qos
|
|
|
|
|
2011-03-20 01:21:49 +00:00
|
|
|
local sendsize
|
|
|
|
config_get sendsize "$cfg" sendsize
|
|
|
|
|
2015-12-04 17:44:00 +00:00
|
|
|
found=
|
|
|
|
for device in /sys/class/atm/*; do
|
|
|
|
[ -d "$device" ] || break
|
|
|
|
[ "$(cat $device/atmindex)" = "$atmdev" ] || continue
|
|
|
|
found=1
|
|
|
|
break
|
|
|
|
done
|
2012-08-09 13:13:26 +00:00
|
|
|
|
2015-12-04 17:44:00 +00:00
|
|
|
[ -n "$found" ] || return
|
2012-08-09 13:13:26 +00:00
|
|
|
|
2015-12-04 17:44:00 +00:00
|
|
|
local circuit="$atmdev.$vpi.$vci"
|
|
|
|
|
|
|
|
procd_open_instance
|
|
|
|
procd_set_param command \
|
2018-01-08 12:12:20 +00:00
|
|
|
/usr/sbin/br2684ctl_wrap "${nameprefix}${unit}" \
|
|
|
|
-n "$nameprefix" -c "$unit" -e "$encaps" -p "$payload" \
|
2016-01-18 15:35:30 +00:00
|
|
|
-a "$circuit" ${qos:+-q "$qos"} ${sendsize:+-s "$sendsize"} \
|
|
|
|
-S /lib/netifd/br2684-up
|
2015-12-04 17:44:00 +00:00
|
|
|
procd_close_instance
|
2007-04-21 09:37:13 +00:00
|
|
|
}
|
|
|
|
|
2015-12-04 17:44:00 +00:00
|
|
|
service_triggers() {
|
|
|
|
local script=$(readlink "$initscript")
|
|
|
|
local name=$(basename ${script:-$initscript})
|
2011-11-08 22:48:00 +00:00
|
|
|
|
2015-12-04 17:44:00 +00:00
|
|
|
procd_open_trigger
|
|
|
|
procd_add_raw_trigger hotplug.atm 2000 /etc/init.d/$name reload
|
2015-12-10 14:40:19 +00:00
|
|
|
procd_add_config_trigger "config.change" "network" /etc/init.d/$name reload
|
2015-12-04 17:44:00 +00:00
|
|
|
procd_close_trigger
|
2011-11-08 22:48:00 +00:00
|
|
|
}
|
|
|
|
|
2015-12-04 17:44:00 +00:00
|
|
|
start_service() {
|
2007-04-21 09:37:13 +00:00
|
|
|
config_load network
|
|
|
|
config_foreach start_daemon atm-bridge
|
|
|
|
}
|