Remove .acl files
[vsys.git] / factory / setup-link
index 4facabc..ba8cb42 100755 (executable)
@@ -22,7 +22,7 @@ $IP link set $EGRE up
 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
@@ -37,6 +37,7 @@ iptables -t mangle -A FORWARD -o $BRIDGE -j MARK --set-mark $SLICEID
 
 ### Create "grab link" script
 GRAB=/vsys/grab-$ETUN0
+rm -f $GRAB $GRAB.acl
 cat > $GRAB <<EOF
 #!/bin/sh
 
@@ -45,6 +46,37 @@ read PID
 chcontext --ctx 1 -- echo \$PID > /sys/class/net/$ETUN0/new_ns_pid 
 EOF
 chmod +x $GRAB
+sleep 1
 echo $SLICE > $GRAB.acl 
 
+### Create "delete link" script
+DELETE=/vsys/delete-$ETUN0
+rm -f $DELETE $DELETE.acl
+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 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
+
+EOF
+chmod +x $DELETE
+sleep 1
+echo $SLICE > $DELETE.acl 
+