diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-03-28 11:02:38 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-03-28 11:02:38 +0000 |
commit | c3bba7f8c61ee98265bcffef8ee86e22aa89bbe9 (patch) | |
tree | b554b4cb155a0b759d3bb78d263cdfc440916d3d /package/trelay/files/trelay.init | |
parent | 15757646c5733b8a658f20f2ca377503cfabbb63 (diff) | |
download | upstream-c3bba7f8c61ee98265bcffef8ee86e22aa89bbe9.tar.gz upstream-c3bba7f8c61ee98265bcffef8ee86e22aa89bbe9.tar.bz2 upstream-c3bba7f8c61ee98265bcffef8ee86e22aa89bbe9.zip |
add trelay, a trivial ethernet relay which allows pseudo-bridging ad-hoc or client mode devices over vlans to other hosts
SVN-Revision: 31122
Diffstat (limited to 'package/trelay/files/trelay.init')
-rw-r--r-- | package/trelay/files/trelay.init | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/package/trelay/files/trelay.init b/package/trelay/files/trelay.init new file mode 100644 index 0000000000..c812e12c69 --- /dev/null +++ b/package/trelay/files/trelay.init @@ -0,0 +1,32 @@ +#!/bin/sh /etc/rc.common +START=80 + +check_relay() { + local cfg="$1" + + config_get_bool enabled "$cfg" enabled 1 + [ "$enabled" -gt 0 ] || return + + config_get dev1 "$cfg" dev1 + config_get dev2 "$cfg" dev2 + + [ -d "/sys/kernel/debug/trelay/${dev1}-${dev2}" ] && return + [ -d "/sys/class/net/${dev1}" -a -d "/sys/class/net/${dev2}" ] || return + + ifconfig "$dev1" up + ifconfig "$dev2" up + echo "${dev1}-${dev2},${dev1},${dev2}" > /sys/kernel/debug/trelay/add +} + +start() { + config_load trelay + config_foreach check_relay trelay + touch /var/run/trelay.active +} + +stop() { + rm -f /var/run/trelay.active + for relay in /sys/kernel/debug/trelay/*; do + [ -d "$relay" ] && echo > "$relay/remove" + done +} |