From c791544bb02e852644c55401018bc17ec1b9b40e Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Wed, 21 Jul 2010 11:04:59 -0400 Subject: qemu: Use a TAP device instead of slirp for networking With this patch, a persistent TAP device is set up by poky-qemu-ifup, which is now run before qemu. The qemu command line now uses the device that was constructed (rather than the hard-coded tap0) and it is told not to run any networking scripts. When qemu shuts down, poky-qemu-ifdown removes the TAP device. sudo use - sudo is used to run poky-qemu-ifup. sudo is no longer used to run qemu, as qemu no longer needs privileges to set up networking. poky-qemu-ifdown is run without privileges, as you can remove a TAP device which you own. Signed-off-by: Jeff Dike --- scripts/poky-qemu-ifdown | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'scripts/poky-qemu-ifdown') diff --git a/scripts/poky-qemu-ifdown b/scripts/poky-qemu-ifdown index 221235311..d9e9e9586 100755 --- a/scripts/poky-qemu-ifdown +++ b/scripts/poky-qemu-ifdown @@ -17,11 +17,9 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +TAP=$1 -IFCONFIG=`which ifconfig` -if [ "x$IFCONFIG" = "x" ]; then - # better than nothing... - IFCONFIG=/sbin/ifconfig -fi +TUNCTL=`which tunctl` +[ "$TUNCTL" = "" ] && TUNCTL=/usr/sbin/tunctl -$IFCONFIG tap0 down +$TUNCTL -d $TAP -- cgit v1.2.3