Root/package/linux-atm/files/br2684ctl

1#!/bin/sh /etc/rc.common
2
3START=50
4
5SERVICE_DAEMONIZE=1
6SERVICE_WRITE_PID=1
7
8start_daemon() {
9    . /lib/functions/network.sh
10
11    local cfg="$1"
12
13    local atmdev
14    config_get atmdev "$cfg" atmdev 0
15
16    local unit
17    config_get unit "$cfg" unit 0
18
19    local vpi
20    config_get vpi "$cfg" vpi 8
21
22    local vci
23    config_get vci "$cfg" vci 35
24
25    local encaps
26    config_get encaps "$cfg" encaps
27
28    case "$encaps" in
29        1|vc) encaps=1;;
30        *) encaps=0;;
31    esac
32
33    local payload
34    config_get payload "$cfg" payload
35
36    case "$payload" in
37        0|routed) payload=0;;
38        *) payload=1;;
39    esac
40
41    local qos
42    config_get qos "$cfg" qos
43
44    local sendsize
45    config_get sendsize "$cfg" sendsize
46
47    local circuit="$atmdev.$vpi.$vci"
48
49    network_defer_device "nas$unit"
50
51    SERVICE_PID_FILE="/var/run/br2684ctl-$circuit.pid" \
52    service_start /usr/sbin/br2684ctl \
53        -c "$unit" -e "$encaps" -p "$payload" \
54        -a "$circuit" ${qos:+-q "$qos"} ${sendsize:+-s "$sendsize"}
55    sleep 1
56
57    network_ready_device "nas$unit"
58}
59
60stop_daemon() {
61    local cfg="$1"
62
63    local atmdev
64    config_get atmdev "$cfg" atmdev 0
65
66    local unit
67    config_get unit "$cfg" unit 0
68
69    local vpi
70    config_get vpi "$cfg" vpi 8
71
72    local vci
73    config_get vci "$cfg" vci 35
74
75    local circuit="$atmdev.$vpi.$vci"
76    
77    SERVICE_PID_FILE="/var/run/br2684ctl-$circuit.pid" \
78    service_stop /usr/sbin/br2684ctl
79}
80
81start() {
82    config_load network
83    config_foreach start_daemon atm-bridge
84}
85
86stop() {
87    config_load network
88    config_foreach stop_daemon atm-bridge
89}
90

Archive Download this file



interactive