[package] libpcap: explicitely disable libnl support to prevent different build resul...
[openwrt.git] / package / trelay / files / trelay.init
1 #!/bin/sh /etc/rc.common
2 START=80
3
4 check_relay() {
5 local cfg="$1"
6
7 config_get_bool enabled "$cfg" enabled 1
8 [ "$enabled" -gt 0 ] || return
9
10 config_get dev1 "$cfg" dev1
11 config_get dev2 "$cfg" dev2
12
13 [ -d "/sys/kernel/debug/trelay/${dev1}-${dev2}" ] && return
14 [ -d "/sys/class/net/${dev1}" -a -d "/sys/class/net/${dev2}" ] || return
15
16 ifconfig "$dev1" up
17 ifconfig "$dev2" up
18 echo "${dev1}-${dev2},${dev1},${dev2}" > /sys/kernel/debug/trelay/add
19 }
20
21 start() {
22 config_load trelay
23 config_foreach check_relay trelay
24 touch /var/run/trelay.active
25 }
26
27 stop() {
28 rm -f /var/run/trelay.active
29 for relay in /sys/kernel/debug/trelay/*; do
30 [ -d "$relay" ] && echo > "$relay/remove"
31 done
32 }
This page took 0.046719 seconds and 5 git commands to generate.