I'd like to request more consistent availability of the environment variables when the tinc per-network scripts run. One thing I noticed is which environment variables are available during {tinc,host,subnet,hosts/[node]}-{up,down} scripts are inconsistent. I realize some don't make sense, eg: $SUBNET in tinc-up . But the $NAME var is only available in tinc-{up,down} and not the others. For example it makes sense to me that a subnet-up script executes in a context where "the name of this tinc daemon" would be known to Tinc and could be supplied via $NAME. I'm running Tinc 1.0.19 as provided by OpenWrt on my gateway router to vpn between some friends and family home lans. Works great one you adapt to the weirdness of OpenWrt's init/config layout. If this request has been satisfied in newer Tinc versions, please disregard this post. Where I wanted this particular example is in the subnet-up script. I would have liked to have written a more generic tinc subnet-up script with the line below to abort the subnet-up script when it executes for the local node's subnet: [ $NODE = $NAME ] && exit Instead I figured out this version which has OpenWrt specific stuff embedded into it to provide a NAME: [ $NODE = `uci get tinc.$NETNAME.Name` ] && exit The reason I'm doing this is because I wish to route between 192.168.. and 10... lans and the docs suggestion of a broad netmask it a bit much for both private IP ranges. Instead my subnet-up executes `route add -net $SUBNET dev $INTERFACE` My almost completely generic tinc scripts for more context if helpful: tinc-up: #!/bin/sh #ifconfig $INTERFACE 192.168.123.1 ip=`uci get network.lan.ipaddr` ifconfig $INTERFACE $ip tinc-down #!/bin/sh ifconfig $INTERFACE down subnet-up: #!/bin/sh [ $NODE = `uci get tinc.$NETNAME.Name` ] && exit route add -net $SUBNET dev $INTERFACE subnet-down: #!/bin/sh [ $NODE = `uci get tinc.$NETNAME.Name` ] && exit route del -net $SUBNET dev $INTERFACE -- Sandy McArthur, Jr. "No nation could preserve its freedom in the midst of continual warfare." - Letters and Other Writings of James Madison (1865), Vol. IV, p. 491 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.tinc-vpn.org/pipermail/tinc/attachments/20130930/ab3f43fe/attachment.html>
On Mon, Sep 30, 2013 at 11:00:45AM -0400, Sandy McArthur Jr wrote:> One thing I noticed is which environment variables are available during > {tinc,host,subnet,hosts/[node]}-{up,down} scripts are inconsistent. I > realize some don't make sense, eg: $SUBNET in tinc-up . But the $NAME var > is only available in tinc-{up,down} and not the others.[...]> I'm running Tinc 1.0.19 as provided by OpenWrt on my gateway router to vpn > between some friends and family home lans. Works great one you adapt to the > weirdness of OpenWrt's init/config layout. If this request has been > satisfied in newer Tinc versions, please disregard this post.This inconsistency has been fixed in tinc 1.0.22. -- Met vriendelijke groet / with kind regards, Guus Sliepen <guus at tinc-vpn.org> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://www.tinc-vpn.org/pipermail/tinc/attachments/20130930/2e898983/attachment.sig>