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
Tagging module vsys - vsys-0.7-9
[vsys.git]
/
factory
/
setup-link
diff --git
a/factory/setup-link
b/factory/setup-link
index
5851ee6
..
1eedfab
100755
(executable)
--- a/
factory/setup-link
+++ b/
factory/setup-link
@@
-22,7
+22,7
@@
$IP link set $EGRE up
ETUN0=v$LINK
ETUN1=etun$LINK
echo $ETUN0,$ETUN1 > /sys/module/etun/parameters/newif
ETUN0=v$LINK
ETUN1=etun$LINK
echo $ETUN0,$ETUN1 > /sys/module/etun/parameters/newif
-ifconfig $ETUN0 up
+ifconfig $ETUN0
mtu 1458
up
ifconfig $ETUN1 up
### Setup bridge
ifconfig $ETUN1 up
### Setup bridge
@@
-37,6
+37,8
@@
iptables -t mangle -A FORWARD -o $BRIDGE -j MARK --set-mark $SLICEID
### Create "grab link" script
GRAB=/vsys/grab-$ETUN0
### Create "grab link" script
GRAB=/vsys/grab-$ETUN0
+echo $SLICE > $GRAB.acl
+rm -f $GRAB
cat > $GRAB <<EOF
#!/bin/sh
cat > $GRAB <<EOF
#!/bin/sh
@@
-45,13
+47,19
@@
read PID
chcontext --ctx 1 -- echo \$PID > /sys/class/net/$ETUN0/new_ns_pid
EOF
chmod +x $GRAB
chcontext --ctx 1 -- echo \$PID > /sys/class/net/$ETUN0/new_ns_pid
EOF
chmod +x $GRAB
-echo $SLICE > $GRAB.acl
### Create "delete link" script
DELETE=/vsys/delete-$ETUN0
### Create "delete link" script
DELETE=/vsys/delete-$ETUN0
+echo $SLICE > $DELETE.acl
+rm -f $DELETE
cat > $DELETE <<EOF
#!/bin/sh
cat > $DELETE <<EOF
#!/bin/sh
+read NULL
+
+# Remove iptables rule
+iptables -t mangle -D FORWARD -o $BRIDGE -j MARK --set-mark $SLICEID
+
# Get rid of etun devices, only need name of one of them
echo $ETUN1 > /sys/module/etun/parameters/delif
# Get rid of etun devices, only need name of one of them
echo $ETUN1 > /sys/module/etun/parameters/delif
@@
-63,11
+71,10
@@
brctl delbr $BRIDGE
ip tunnel del $EGRE
# Clean up files
ip tunnel del $EGRE
# Clean up files
-rm
$GRAB
-rm
$DELETE
+rm
-f $GRAB $GRAB.acl
+rm
-f $DELETE $DELETE.acl
EOF
chmod +x $DELETE
EOF
chmod +x $DELETE
-echo $SLICE > $DELETE.acl