Root/package/linux-atm/files/br2684ctl

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

Archive Download this file



interactive