Signed-off-by: Colin McCabe <cmccabe@alumni.cmu.edu>
--- /dev/null
+#!/bin/bash -xe
+
+#
+# Create tun and bridge interfaces for qemu.
+#
+
+TAP=tap0
+BR=br0
+
+die() {
+ echo $@
+ exit 1
+}
+
+up() {
+ /sbin/tunctl -b -t $TAP
+ /sbin/ifconfig $TAP up
+ /sbin/brctl addbr $BR
+ /sbin/brctl addif $BR $TAP
+ /sbin/ifconfig $BR 192.168.123.1 netmask 255.255.255.0
+ /sbin/ifconfig $BR up
+}
+
+down() {
+ /sbin/ifconfig $BR down
+ /sbin/ifconfig $TAP down
+ /sbin/brctl delbr $BR
+ /sbin/tunctl -d $TAP
+}
+
+ARG="x$1"
+if [ $ARG == "xup" ]; then
+ up
+elif [ $ARG == "xdown" ]; then
+ down
+else
+ die "must specify either up or down."
+fi