[OpenWrt-Devel] tinc protocol handler

openwrt-devel at couprie.net openwrt-devel at couprie.net
Thu May 28 06:49:39 EDT 2015


Hi,

I am working to create a protocol handler for tinc (chaos calmer).

I do not understand the following lines ?

proto_init_update "*" 1
proto_send_update "$iface"

Can someone take a look at the code below and give me some advice :-) or 
point me to documentation.

Perry

#!/bin/sh

. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"

proto_tinc_init_config() {

     no_device=1
     available=1

     proto_config_add_string "ipaddr"
     proto_config_add_string "netmask"
     proto_config_add_string "ifname"
}

proto_tinc_setup() {

     local config="$1"
     local iface="$2"

     # Code to start tinc interface.
     /usr/sbin/tincd --net=$iface --pidfile=/var/run/tinc.$iface.pid

     logger -p daemon.info -t "Tinc interface started"

     proto_init_update "*" 1
     proto_send_update "$iface"

     return 0
}

proto_tinc_teardown() {

     local iface="$1"

     # Code to stop tinc interface.
     if [ -f /var/run/tinc.$iface.pid ]
     then
         pid=`cat /var/run/tinc.$iface.pid`
         kill $pid
     fi

     proto_init_update "*" 0
     proto_send_update "$iface"

     return 0
}

add_protocol tinc
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list