10 KEYFILE="/etc/vini/egre-keys.txt"
11 if [ -e "$KEYFILE" ]; then
12 KEY=$( awk -v slice=$SLICE '$1 == slice {print $2}' $KEYFILE )
14 if [ -z "$KEY" ]; then
15 echo "No EGRE key found for slice $SLICE!"
16 echo "Please send mail to vini-users@lists.planet-lab.org."
27 $IP tunnel add $EGRE mode gre/eth remote $REMOTE key $KEY
33 echo $ETUN0,$ETUN1 > /sys/module/etun/parameters/newif
34 ifconfig $ETUN0 mtu 1458 up
40 brctl addif $BRIDGE $EGRE
41 brctl addif $BRIDGE $ETUN1
44 ### Setup iptables so that packets are visible in the vserver
45 iptables -t mangle -A FORWARD -o $BRIDGE -j MARK --set-mark $SLICEID
47 ### Create "grab link" script
48 GRAB=/vsys/local_grab-$ETUN0
49 echo $SLICE > $GRAB.acl
56 chcontext --ctx 1 -- echo \$PID > /sys/class/net/$ETUN0/new_ns_pid
60 ### Create script for setting link rate
61 BIND=/vsys/local_rate-$ETUN0
62 echo $SLICE > $BIND.acl
69 tc qdisc add dev $EGRE root handle 1: htb default 10
70 tc class add dev $EGRE parent 1: classid 1:10 htb rate \$rt ceil \$rt
78 ### Create "delete link" script
79 DELETE=/vsys/local_delete-$ETUN0
80 echo $SLICE > $DELETE.acl
87 # Remove iptables rule
88 iptables -t mangle -D FORWARD -o $BRIDGE -j MARK --set-mark $SLICEID
90 # Get rid of etun devices, only need name of one of them
91 echo $ETUN1 > /sys/module/etun/parameters/delif
97 # Get rid of EGRE tunnel
101 rm -f $GRAB $GRAB.acl
102 rm -f $DELETE $DELETE.acl
103 rm -f $BIND $BIND.acl