Add ttl to virtual link for OSPF
[vsys.git] / factory / setup-link
index e5cbd2f..58a431f 100755 (executable)
@@ -6,7 +6,16 @@ SLICE=$1
 SLICEID=`id -u $SLICE`
 read INDEX
 read REMOTE
-read KEY
+
+KEYFILE="/etc/vini/egre-keys.txt"
+if [ -e "$KEYFILE" ]; then
+    KEY=$( awk -v slice=$SLICE '$1 == slice {print $2}' $KEYFILE )
+fi
+if [ -z "$KEY" ]; then
+    echo "No EGRE key found for slice $SLICE!"
+    echo "Please send mail to vini-users@lists.planet-lab.org."
+    exit 1
+fi
 
 LINK=${KEY}if${INDEX}
 
@@ -15,7 +24,7 @@ modprobe etun
 
 ### Setup EGRE tunnel
 EGRE=d$LINK
-$IP tunnel add $EGRE  mode gre/eth remote $REMOTE key $KEY
+$IP tunnel add $EGRE  mode gre/eth remote $REMOTE key $KEY ttl 64
 $IP link set $EGRE up
 
 ### Setup etun