summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-emulation/kvm/files/scripts-qemu-ifup.patch')
-rw-r--r--app-emulation/kvm/files/scripts-qemu-ifup.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/app-emulation/kvm/files/scripts-qemu-ifup.patch b/app-emulation/kvm/files/scripts-qemu-ifup.patch
new file mode 100644
index 0000000..cd9a16f
--- /dev/null
+++ b/app-emulation/kvm/files/scripts-qemu-ifup.patch
@@ -0,0 +1,26 @@
+--- scripts/qemu-ifup.orig 2007-04-28 12:43:42.514362441 -0500
++++ scripts/qemu-ifup 2007-04-28 14:30:36.507875100 -0500
+@@ -1,5 +1,19 @@
+ #!/bin/sh
+-
+-switch=$(/sbin/ip route list | awk '/^default / { print $NF }')
+-/sbin/ifconfig $1 0.0.0.0 up
+-/usr/sbin/brctl addif ${switch} $1
++cmd=""
++if [ "$EUID" != 0 ]; then
++ if [ -x "/usr/bin/sudo" ]; then
++ cmd="/usr/bin/sudo "
++ else
++ echo "You must have sudo or root privileges to bring up a network interface"
++ exit 0
++ fi
++fi
++echo "Bringing up interface $1"
++switch=$(/sbin/ip route list | awk '/^default / { print $5 }')
++if [[ $(/sbin/ifconfig | grep -c $1) -gt 0 ]]; then
++ ${cmd}/sbin/brctl delif ${switch} $1
++ ${cmd}/sbin/ifconfig $1 down
++fi
++${cmd}/usr/bin/tunctl -u $(/usr/bin/whoami) -t $1
++${cmd}/sbin/ifconfig $1 0.0.0.0 promisc up
++${cmd}/sbin/brctl addif ${switch} $1