<div dir="ltr"><div>I'd like to request more consistent availability of the environment variables when the tinc per-network scripts run.</div><div><br></div><div>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.</div>
<div><br></div><div><br></div><div>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.<br clear="all">
</div><div><br></div><div>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:</div>
<div><br></div><div>[ $NODE = $NAME ] && exit<br></div><div><br></div><div>Instead I figured out this version which has OpenWrt specific stuff embedded into it to provide a NAME:</div><div><br></div><div>[ $NODE = `uci get tinc.$NETNAME.Name` ] && exit<br>
</div><div><br></div><div><br></div><div>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`</div>
<div><br></div><div>My almost completely generic tinc scripts for more context if helpful:</div><div><br></div><div>tinc-up:</div><div><div>#!/bin/sh</div><div>#ifconfig $INTERFACE 192.168.123.1<br></div><div>ip=`uci get network.lan.ipaddr`</div>
<div>ifconfig $INTERFACE $ip</div></div><div><br></div><div><div>tinc-down </div><div>#!/bin/sh</div><div>ifconfig $INTERFACE down</div></div><div><br></div><div>subnet-up:</div><div><div>#!/bin/sh</div><div>[ $NODE = `uci get tinc.$NETNAME.Name` ] && exit<br>
</div><div>route add -net $SUBNET dev $INTERFACE<br></div><div><br></div></div><div>subnet-down:<br></div><div><div>#!/bin/sh</div><div>[ $NODE = `uci get tinc.$NETNAME.Name` ] && exit<br></div><div>route del -net $SUBNET dev $INTERFACE<br>
</div></div><div><br></div><div><br></div>-- <br>Sandy McArthur, Jr.<br><br><div>"No nation could preserve its freedom in the midst of continual warfare."</div><div>- Letters and Other Writings of James Madison (1865), Vol. IV, p. 491</div>
</div>