net/lsm: add link state monitor package. (thank you Brian J. Murrell)
[openwrt/svn-archive/archive.git] / net / n2n / files / n2n.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2008 OpenWrt.org
3 START=90
4
5 config_cb() {
6 local cfg="$CONFIG_SECTION"
7 config_get configname "$cfg" TYPE
8
9 case "$configname" in
10 edge)
11 config_get ipaddr "$cfg" ipaddr
12 config_get supernode "$cfg" supernode
13 config_get port "$cfg" port
14 config_get community "$cfg" community
15 config_get key "$cfg" key
16 config_get_bool route "$cfg" route 0
17 [ "$route" = "1" ] && args='-r'
18 if [ "$ipaddr" != "" ]; then
19 edge -f $args -a $ipaddr -c $community -k $key -l ${supernode}:${port}
20 fi
21 ;;
22 supernode)
23 config_get port "$cfg" port
24 if [ "$port" != "" ]; then
25 supernode -l $port &
26 fi
27 ;;
28 esac
29 }
30
31 start() {
32 config_load n2n
33 }
34 stop() {
35 killall edge
36 killall supernode
37 }