git://git.onelab.eu
/
vsys.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use more familiar HTB instead of TBF
[vsys.git]
/
factory
/
setup-link
diff --git
a/factory/setup-link
b/factory/setup-link
index
5c93a30
..
6fb4b9e
100755
(executable)
--- a/
factory/setup-link
+++ b/
factory/setup-link
@@
-4,29
+4,29
@@
IP=/sbin/ip
SLICE=$1
SLICEID=`id -u $SLICE`
SLICE=$1
SLICEID=`id -u $SLICE`
-read
LABEL
+read
INDEX
read REMOTE
read KEY
read REMOTE
read KEY
-LINK=${
LABEL}k$KEY
+LINK=${
KEY}if${INDEX}
modprobe ip_gre
modprobe etun
### Setup EGRE tunnel
modprobe ip_gre
modprobe etun
### Setup EGRE tunnel
-EGRE=
egre
$LINK
+EGRE=
d
$LINK
$IP tunnel add $EGRE mode gre/eth remote $REMOTE key $KEY
$IP link set $EGRE up
### Setup etun
$IP tunnel add $EGRE mode gre/eth remote $REMOTE key $KEY
$IP link set $EGRE up
### Setup etun
-ETUN0=
v
$LINK
-ETUN1=
etun
$LINK
+ETUN0=
a
$LINK
+ETUN1=
b
$LINK
echo $ETUN0,$ETUN1 > /sys/module/etun/parameters/newif
ifconfig $ETUN0 mtu 1458 up
ifconfig $ETUN1 up
### Setup bridge
echo $ETUN0,$ETUN1 > /sys/module/etun/parameters/newif
ifconfig $ETUN0 mtu 1458 up
ifconfig $ETUN1 up
### Setup bridge
-BRIDGE=
br
$LINK
+BRIDGE=
c
$LINK
brctl addbr $BRIDGE
brctl addif $BRIDGE $EGRE
brctl addif $BRIDGE $ETUN1
brctl addbr $BRIDGE
brctl addif $BRIDGE $EGRE
brctl addif $BRIDGE $ETUN1
@@
-48,18
+48,17
@@
chcontext --ctx 1 -- echo \$PID > /sys/class/net/$ETUN0/new_ns_pid
EOF
chmod +x $GRAB
EOF
chmod +x $GRAB
-### Create
"bind link" script
-BIND=/vsys/
bind-link
-$ETUN0
+### Create
script for setting link rate
+BIND=/vsys/
rate
-$ETUN0
echo $SLICE > $BIND.acl
rm -f $BIND
cat > $BIND <<EOF
#!/bin/sh
read rt
echo $SLICE > $BIND.acl
rm -f $BIND
cat > $BIND <<EOF
#!/bin/sh
read rt
-read lt
-read burs
-tc qdisc add dev $EGRE root tbf rate \$rt latency \$lt burst \$burs
+tc qdisc add dev $EGRE root handle 1: htb default 10
+tc class add dev $EGRE parent 1: classid 1:10 htb rate \$rt ceil \$rt
rm -rf $BIND.acl
touch $BIND.acl
rm -rf $BIND.acl
touch $BIND.acl
@@
-67,18
+66,6
@@
touch $BIND.acl
EOF
chmod +x $BIND
EOF
chmod +x $BIND
-### Create "unbind link" script
-UNBIND=/vsys/unbind-link-$ETUN0
-touch $UNBIND.acl
-rm -f $UNBIND
-cat > $UNBIND <<EOF
-#!/bin/sh
-
-tc qdisc del root dev $EGRE
-
-EOF
-chmod +x $UNBIND
-
### Create "delete link" script
DELETE=/vsys/delete-$ETUN0
echo $SLICE > $DELETE.acl
### Create "delete link" script
DELETE=/vsys/delete-$ETUN0
echo $SLICE > $DELETE.acl
@@
-105,6
+92,5
@@
ip tunnel del $EGRE
rm -f $GRAB $GRAB.acl
rm -f $DELETE $DELETE.acl
rm -f $BIND $BIND.acl
rm -f $GRAB $GRAB.acl
rm -f $DELETE $DELETE.acl
rm -f $BIND $BIND.acl
-rm -f $UNBIND $UNBIND.acl
EOF
chmod +x $DELETE
EOF
chmod +x $DELETE