X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=factory%2Fsetup-link;fp=factory%2Fsetup-link;h=0000000000000000000000000000000000000000;hb=b81d4faa0fd65a42ae4a9a0191b4684d3aa7ff62;hp=e5cbd2f1f6270da78cdf2ce96a2f96c437327b50;hpb=8d38d04aebf97cd4f5a9bc8d1c6586b3daef4685;p=vsys.git diff --git a/factory/setup-link b/factory/setup-link deleted file mode 100755 index e5cbd2f..0000000 --- a/factory/setup-link +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh +x - -IP=/sbin/ip - -SLICE=$1 -SLICEID=`id -u $SLICE` -read INDEX -read REMOTE -read KEY - -LINK=${KEY}if${INDEX} - -modprobe ip_gre -modprobe etun - -### Setup EGRE tunnel -EGRE=d$LINK -$IP tunnel add $EGRE mode gre/eth remote $REMOTE key $KEY -$IP link set $EGRE up - -### Setup etun -ETUN0=a$LINK -ETUN1=b$LINK -echo $ETUN0,$ETUN1 > /sys/module/etun/parameters/newif -ifconfig $ETUN0 mtu 1458 up -ifconfig $ETUN1 up - -### Setup bridge -BRIDGE=c$LINK -brctl addbr $BRIDGE -brctl addif $BRIDGE $EGRE -brctl addif $BRIDGE $ETUN1 -ifconfig $BRIDGE up - -### Setup iptables so that packets are visible in the vserver -iptables -t mangle -A FORWARD -o $BRIDGE -j MARK --set-mark $SLICEID - -### Create "grab link" script -GRAB=/vsys/local_grab-$ETUN0 -echo $SLICE > $GRAB.acl -rm -f $GRAB -cat > $GRAB < /sys/class/net/$ETUN0/new_ns_pid -EOF -chmod +x $GRAB - -### Create script for setting link rate -BIND=/vsys/local_rate-$ETUN0 -echo $SLICE > $BIND.acl -rm -f $BIND -cat > $BIND < $DELETE.acl -rm -f $DELETE -cat > $DELETE < /sys/module/etun/parameters/delif - -# Get rid of bridge -ifconfig $BRIDGE down -brctl delbr $BRIDGE - -# Get rid of EGRE tunnel -ip tunnel del $EGRE - -# Clean up files -rm -f $GRAB $GRAB.acl -rm -f $DELETE $DELETE.acl -rm -f $BIND $BIND.acl -EOF -chmod +x $DELETE