Changes for 2.6.32 kernel
[nodemanager-topo.git] / setup-egre-link
index 16c366a..dc31496 100755 (executable)
@@ -1,7 +1,5 @@
 #!/bin/sh +x
 
-IP=/sbin/ip
-
 SLICE=$1
 SLICEID=`id -u $SLICE`
 NODEID=$2
@@ -15,39 +13,25 @@ SUBNET=`expr match "$VIRTNET" '.*\(/[0-9]*\)'`
 LINK=${KEY}x${NODEID}
 
 modprobe ip_gre
-modprobe etun
 
 ### Setup EGRE tunnel
 EGRE=d$LINK
-$IP tunnel add $EGRE  mode gre/eth remote $REMOTE key $KEY ttl 64
-$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
+ip link add $EGRE type gretap remote $REMOTE key $KEY ttl 64
+ip link set $EGRE up
+
+### Setup macvlan
+MACV=a$LINK
+ip link add link $EGRE $MACV type macvlan
 
 ### Put a process in the vserver so we can move the interface there
-su $SLICE -c "sleep 30" &
-sleep 1
-PID=`su $SLICE -c "pgrep sleep"`
-chcontext --ctx 1 -- echo $PID > /sys/class/net/$ETUN0/new_ns_pid 
-sleep 1
-su $SLICE -c "sudo /sbin/ifconfig $ETUN0 ${VIRTIP}${SUBNET} up; sudo /sbin/route add -net $VIRTNET dev $ETUN0"
+su $SLICE -c "sleep 30 &"
+PID=`su $SLICE -c "pgrep -n sleep"`
+ip link set $MACV netns $PID
+naddress --add --nid $SLICEID --ip ${VIRTIP}${SUBNET}
+su $SLICE -c "sudo /sbin/ifconfig $MACV ${VIRTIP}${SUBNET} mtu 1458 up"
 
 ### Set rate
+ifconfig $EGRE txqueuelen 1000
 tc qdisc add dev $EGRE root handle 1: htb default 10
 tc class add dev $EGRE parent 1: classid 1:10 htb rate $RATE ceil $RATE