Go to file
Corey Bryant a7c36ee492 Add support for net bridge
The most common use of -net tap is to connect a tap device to a bridge.  This
requires the use of a script and running qemu as root in order to allocate a
tap device to pass to the script.

This model is great for portability and flexibility but it's incredibly
difficult to eliminate the need to run qemu as root.  The only really viable
mechanism is to use tunctl to create a tap device, attach it to a bridge as
root, and then hand that tap device to qemu.  The problem with this mechanism
is that it requires administrator intervention whenever a user wants to create
a guest.

By essentially writing a helper that implements the most common qemu-ifup
script that can be safely given cap_net_admin, we can dramatically simplify
things for non-privileged users.  We still support existing -net tap options
as a mechanism for advanced users and backwards compatibility.

Currently, this is very Linux centric but there's really no reason why it
couldn't be extended for other Unixes.

A typical invocation would be similar to one of the following:

  qemu linux.img -net bridge -net nic,model=virtio

  qemu linux.img -net tap,helper="/usr/local/libexec/qemu-bridge-helper"
                 -net nic,model=virtio

  qemu linux.img -netdev bridge,id=hn0
                 -device virtio-net-pci,netdev=hn0,id=nic1

  qemu linux.img -netdev tap,helper="/usr/local/libexec/qemu-bridge-helper",id=hn0
                 -device virtio-net-pci,netdev=hn0,id=nic1

The default bridge that we attach to is br0.  The thinking is that a distro
could preconfigure such an interface to allow out-of-the-box bridged networking.

Alternatively, if a user wants to use a different bridge, a typical invocation
would be simliar to one of the following:

  qemu linux.img -net bridge,br=qemubr0 -net nic,model=virtio

  qemu linux.img -net tap,helper="/usr/local/libexec/qemu-bridge-helper --br=qemubr0"
                 -net nic,model=virtio

  qemu linux.img -netdev bridge,br=qemubr0,id=hn0
                 -device virtio-net-pci,netdev=hn0,id=nic1

  qemu linux.img -netdev tap,helper="/usr/local/libexec/qemu-bridge-helper --br=qemubr0",id=hn0
                 -device virtio-net-pci,netdev=hn0,id=nic1

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Richa Marwaha <rmarwah@linux.vnet.ibm.com>
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 16:24:40 -06:00
audio
block qcow: Use bdrv functions to replace file operation 2012-01-26 14:49:18 +01:00
bsd-user elf: Improve symbol lookup (optimize, fix for bsd-user) 2012-01-10 18:40:09 +01:00
darwin-user
default-configs Merge remote-tracking branch 'afaerber/prep-up' into staging 2012-01-23 10:58:02 -06:00
docs docs: describe live block operations 2012-01-26 14:49:18 +01:00
fpu
fsdev virtfs-proxy-helper: Add missing printf format attribute 2012-01-13 10:37:00 +00:00
gdb-xml
hw hw/vmmouse.c: Disable vmmouse after reboot 2012-02-01 16:24:38 -06:00
include/qemu qom: add the base Object class (v2) 2012-01-27 10:28:30 -06:00
libcacard
linux-headers
linux-user elf: Improve symbol lookup (optimize, fix for bsd-user) 2012-01-10 18:40:09 +01:00
net Add support for net bridge 2012-02-01 16:24:40 -06:00
pc-bios optionroms: Silence intermediate file removal 2012-02-01 14:45:02 -06:00
qapi qapi: protect against NULL QObject in qmp_input_get_object 2011-12-19 10:27:33 -06:00
qga
QMP qmp: add block_job_cancel command 2012-01-26 14:49:18 +01:00
qom qdev: change ambiguous qdev names 2012-01-27 10:50:55 -06:00
roms pseries: SLOF PCI flag day 2012-01-21 05:17:02 +01:00
scripts qerror: add check-qerror.sh to verify alphabetical order 2012-01-18 10:23:39 -02:00
slirp
sysconfigs/target
target-alpha
target-arm Add Cortex-A15 CPU definition 2012-01-25 15:10:17 +00:00
target-cris
target-i386 hyperv: fix build on non-KVM hosts 2012-01-23 20:04:51 +00:00
target-lm32
target-m68k
target-microblaze microblaze: Break the tb at memory barriers 2012-01-12 13:54:17 +01:00
target-mips
target-ppc PPC: Enable 440EP CPU target 2012-01-21 05:17:00 +01:00
target-s390x s390: fix cpu hotplug / cpu activity on interrupts 2012-01-04 02:48:14 +01:00
target-sh4 target-sh4: ignore ocbp and ocbwb instructions 2012-01-10 18:20:10 +01:00
target-sparc target-sparc: Fix mixup of uint64 and uint64_t 2012-01-22 09:55:35 +00:00
target-unicore32
target-xtensa
tcg tcg-arm: fix a typo in comments 2012-01-13 10:36:59 +00:00
tests tests: Silence gtester in Makefile 2012-01-19 08:14:33 +00:00
trace g_thread_init users: don't call it if glib >= 2.31 2011-12-20 15:44:31 -06:00
ui sdl: Limit sdl_grab_end in handle_activation to Windows hosts 2012-02-01 14:45:02 -06:00
.gitignore Update gitignore file 2012-01-21 05:17:01 +01:00
.gitmodules
.mailmap
a.out.h
acl.c
acl.h
aes.c
aes.h
aio.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
alpha-dis.c
alpha.ld
arch_init.c memory: change dirty setting APIs to take a size 2012-01-25 18:32:47 +00:00
arch_init.h audio: remove unused parameter isa_pic 2011-12-20 15:44:31 -06:00
arm-dis.c
arm-semi.c
arm.ld
async.c
balloon.c
balloon.h
bitmap.c
bitmap.h
bitops.c
bitops.h
block_int.h block: add support for partial streaming 2012-01-26 14:49:18 +01:00
block-migration.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
block-migration.h
block.c block: add bdrv_find_backing_image 2012-01-26 14:49:18 +01:00
block.h block: add bdrv_find_backing_image 2012-01-26 14:49:18 +01:00
blockdev.c block: add support for partial streaming 2012-01-26 14:49:18 +01:00
blockdev.h qapi: Convert block_set_io_throttle 2012-01-18 10:23:39 -02:00
bswap.h
bt-host.c bt-host: add missing break statement 2012-01-13 10:37:00 +00:00
bt-host.h
bt-vhci.c
buffered_file.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
buffered_file.h
cache-utils.c
cache-utils.h
Changelog
check-qdict.c check-qdict: convert to gtest 2012-01-12 10:05:37 -06:00
check-qfloat.c check-qfloat: convert to gtest 2012-01-12 10:05:37 -06:00
check-qint.c check-qint: convert to gtest 2012-01-12 10:05:37 -06:00
check-qjson.c check-qjson: enable disabled tests 2012-01-12 10:05:38 -06:00
check-qlist.c check-qlist: convert to gtest 2012-01-12 10:05:38 -06:00
check-qstring.c check-qstring: remove check.h include 2012-01-12 11:33:22 -06:00
cmd.c
cmd.h
CODING_STYLE
compatfd.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
compatfd.h
compiler.h
config.h
configure Add support for net bridge 2012-02-01 16:24:40 -06:00
console.c console: Fix segfault on screendump without VGA adapter 2012-01-03 02:49:25 +01:00
console.h qapi: Convert expire_password 2012-01-18 10:23:38 -02:00
COPYING
COPYING.LIB
coroutine-gthread.c g_thread_init users: don't call it if glib >= 2.31 2011-12-20 15:44:31 -06:00
coroutine-ucontext.c
coroutine-win32.c
cpu-all.h Remove IO_MEM_SHIFT 2012-01-04 13:34:50 +02:00
cpu-common.h Remove IO_MEM_SHIFT 2012-01-04 13:34:50 +02:00
cpu-defs.h
cpu-exec.c
cpus.c apic: Inject external NMI events via LINT1 2012-01-19 12:14:40 +01:00
cpus.h
cris-dis.c cris-dis: Clean memory allocation 2012-01-10 09:36:43 +01:00
cursor_hidden.xpm
cursor_left_ptr.xpm
cursor.c
cutils.c sheepdog: move coroutine send/recv function to generic code 2011-12-22 11:53:53 +01:00
def-helper.h
device_tree.c
device_tree.h
dis-asm.h
disas.c
disas.h
dma-helpers.c
dma.h
dyngen-exec.h tcg/arm: Use r6 as TCG_AREG0 to avoid clash with Thumb framepointer 2012-01-10 17:52:49 +01:00
elf.h
envlist.c
envlist.h
error_int.h
error.c
error.h
event_notifier.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
event_notifier.h prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
exec-all.h Direct dispatch through MemoryRegion 2012-01-04 13:34:50 +02:00
exec-memory.h
exec-obsolete.h Fix off-by-one in dirty bitmap functions 2012-01-29 14:53:55 +00:00
exec.c exec.c: Clarify comment about tlb_flush() flush_global parameter 2012-02-01 14:45:01 -06:00
gdbstub.c gdbstub: Fix fd leak in gdbserver_open() error path 2012-01-06 15:07:14 +00:00
gdbstub.h
gen-icount.h
HACKING
hmp-commands.hx qmp: add block_job_cancel command 2012-01-26 14:49:18 +01:00
hmp.c qmp: add query-block-jobs 2012-01-26 14:49:18 +01:00
hmp.h qmp: add query-block-jobs 2012-01-26 14:49:18 +01:00
host-utils.c
host-utils.h
hppa-dis.c
hppa.ld
i386-dis.c
i386.ld
ia64-dis.c
ia64.ld
input.c
int128.h
iohandler.c
ioport-user.c
ioport.c
ioport.h
iorange.h
iov.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
iov.h
json-lexer.c Add 'fall through' comments to case statements without break 2012-01-13 10:36:59 +00:00
json-lexer.h
json-parser.c
json-parser.h
json-streamer.c
json-streamer.h
kvm-all.c memory: change dirty setting APIs to take a size 2012-01-25 18:32:47 +00:00
kvm-stub.c kvm: x86: Establish IRQ0 override control 2012-01-19 12:14:42 +01:00
kvm.h kvm: x86: Add user space part for in-kernel APIC 2012-01-19 12:14:42 +01:00
libfdt_env.h
LICENSE
linux-aio.c
m68k-dis.c
m68k-semi.c
m68k.ld
main-loop.c main-loop: For tools, initialize timers as part of qemu_init_main_loop() 2012-02-01 14:45:02 -06:00
main-loop.h main-loop: For tools, initialize timers as part of qemu_init_main_loop() 2012-02-01 14:45:02 -06:00
MAINTAINERS hw/9pfs: Update MAINTAINERS file 2012-02-01 14:42:03 -06:00
Makefile Add basic version of bridge helper 2012-02-01 16:24:38 -06:00
Makefile.dis
Makefile.hw qom: add the base Object class (v2) 2012-01-27 10:28:30 -06:00
Makefile.objs qom: add the base Object class (v2) 2012-01-27 10:28:30 -06:00
Makefile.target qom: add the base Object class (v2) 2012-01-27 10:28:30 -06:00
Makefile.user
memory.c memory: change dirty setting APIs to take a size 2012-01-25 18:32:47 +00:00
memory.h memory: change dirty setting APIs to take a size 2012-01-25 18:32:47 +00:00
microblaze-dis.c
migration-exec.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
migration-fd.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
migration-tcp.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
migration-unix.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
migration.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
migration.h
mips-dis.c
mips.ld
module.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
module.h
monitor.c qmp: add query-block-jobs 2012-01-26 14:49:18 +01:00
monitor.h qmp: add block_job_cancel command 2012-01-26 14:49:18 +01:00
nbd.c qemu-nbd: throttle requests 2011-12-22 11:53:59 +01:00
nbd.h qemu-nbd: move client handling to nbd.c 2011-12-22 11:53:59 +01:00
net.c Add support for net bridge 2012-02-01 16:24:40 -06:00
net.h Add support for net bridge 2012-02-01 16:24:40 -06:00
notify.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
notify.h
os-posix.c keep the PID file locked for the lifetime of the process 2012-02-01 16:23:57 -06:00
os-win32.c link the main loop and its dependencies into the tools 2011-12-22 11:53:58 +01:00
osdep.c move corking functions to osdep.c 2011-12-22 11:53:58 +01:00
osdep.h
oslib-posix.c link the main loop and its dependencies into the tools 2011-12-22 11:53:58 +01:00
oslib-win32.c link the main loop and its dependencies into the tools 2011-12-22 11:53:58 +01:00
path.c
pci-ids.txt
pflib.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
pflib.h
poison.h
posix-aio-compat.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
ppc64.ld PPC: Fix linker scripts on ppc hosts 2012-01-10 18:23:58 +01:00
ppc-dis.c
ppc.ld PPC: Fix linker scripts on ppc hosts 2012-01-10 18:23:58 +01:00
qapi-schema-guest.json
qapi-schema-test.json
qapi-schema.json add QERR_BASE_NOT_FOUND 2012-01-26 14:49:18 +01:00
qbool.c
qbool.h
qdict-test-data.txt
qdict.c
qdict.h
qemu_socket.h move corking functions to osdep.c 2011-12-22 11:53:58 +01:00
qemu-aio.h
qemu-barrier.h
qemu-bridge-helper.c Add cap reduction support to enable use as SUID 2012-02-01 16:24:39 -06:00
qemu-char.c
qemu-char.h
qemu-common.h qdev: Introduce lost tick policy property 2012-02-01 14:45:01 -06:00
qemu-config.c kvm: Activate in-kernel irqchip support 2012-01-19 12:14:42 +01:00
qemu-config.h
qemu-coroutine-int.h
qemu-coroutine-io.c sheepdog: move coroutine send/recv function to generic code 2011-12-22 11:53:53 +01:00
qemu-coroutine-lock.c
qemu-coroutine-sleep.c coroutine: add co_sleep_ns() coroutine sleep function 2012-01-26 11:45:26 +01:00
qemu-coroutine.c
qemu-coroutine.h coroutine: add co_sleep_ns() coroutine sleep function 2012-01-26 11:45:26 +01:00
qemu-doc.texi
qemu-error.c
qemu-error.h
qemu-file.h vmstate: extract declarations out of hw/hw.h 2012-01-13 10:20:51 -06:00
qemu-ga.c Spelling fixes in comments and documentation 2012-01-13 10:36:59 +00:00
qemu-img-cmds.hx
qemu-img.c
qemu-img.texi
qemu-io.c Merge remote-tracking branch 'kwolf/for-anthony' into staging 2012-01-27 08:58:52 -06:00
qemu-lock.h
qemu-log.h
qemu-nbd.c qemu-nbd: drop loop which can never loop 2012-01-06 15:09:53 +00:00
qemu-nbd.texi
qemu-objects.h
qemu-option.c qemu-option: Introduce default mechanism 2012-02-01 14:45:01 -06:00
qemu-option.h qemu-option: Introduce default mechanism 2012-02-01 14:45:01 -06:00
qemu-options-wrapper.h
qemu-options.h
qemu-options.hx Add support for net bridge 2012-02-01 16:24:40 -06:00
qemu-os-posix.h
qemu-os-win32.h
qemu-progress.c
qemu-queue.h
qemu-sockets.c
qemu-tech.texi
qemu-thread-posix.c
qemu-thread-posix.h
qemu-thread-win32.c
qemu-thread-win32.h
qemu-thread.h
qemu-timer-common.c
qemu-timer.c remove #if 0 code for timers 2012-01-27 05:29:56 +00:00
qemu-timer.h ptimer: move declarations to ptimer.h 2012-01-13 10:20:50 -06:00
qemu-tls.h
qemu-tool.c main-loop: For tools, initialize timers as part of qemu_init_main_loop() 2012-02-01 14:45:02 -06:00
qemu-x509.h
qemu-xattr.h
qemu.sasl
qerror.c add QERR_BASE_NOT_FOUND 2012-01-26 14:49:18 +01:00
qerror.h add QERR_BASE_NOT_FOUND 2012-01-26 14:49:18 +01:00
qfloat.c
qfloat.h
qint.c
qint.h
qjson.c
qjson.h
qlist.c
qlist.h
qmp-commands.hx qmp: add query-block-jobs 2012-01-26 14:49:18 +01:00
qmp.c qapi: Convert change 2012-01-18 10:23:39 -02:00
qobject.h
qstring.c
qstring.h
range.h
readline.c
readline.h
README
rules.mak
s390-dis.c
s390.ld
savevm.c Fix vmstate_register_ram() for rom/device regions 2012-01-08 18:16:31 +02:00
sh4-dis.c
softmmu_defs.h
softmmu_exec.h
softmmu_header.h
softmmu_template.h Remove IO_MEM_SHIFT 2012-01-04 13:34:50 +02:00
softmmu-semi.h
sparc64.ld
sparc-dis.c
sparc.ld
spice-qemu-char.c
sysemu.h mc146818rtc: Use lost_tick_policy property 2012-02-01 14:45:01 -06:00
targphys.h
tcg-runtime.c
tci-dis.c
tci.c
test-coroutine.c
test-qmp-commands.c
test-qmp-input-visitor.c qmp: Add missing gcc format attribute and fix format string 2012-01-18 10:23:39 -02:00
test-qmp-output-visitor.c
thunk.c
thunk.h
TODO
trace-events GRLIB UART: Add RX channel 2012-01-30 19:13:21 +00:00
translate-all.c
uboot_image.h
usb-bsd.c usb: convert to QEMU Object Model 2012-01-27 10:50:47 -06:00
usb-linux.c usb: convert to QEMU Object Model 2012-01-27 10:50:47 -06:00
usb-redir.c usb: convert to QEMU Object Model 2012-01-27 10:50:47 -06:00
usb-stub.c
user-exec.c
VERSION
version.rc
vgafont.h
vl.c main-loop: For tools, initialize timers as part of qemu_init_main_loop() 2012-02-01 14:45:02 -06:00
vmstate.h vmstate: extract declarations out of hw/hw.h 2012-01-13 10:20:51 -06:00
x86_64.ld
xen-all.c memory: change dirty setting APIs to take a size 2012-01-25 18:32:47 +00:00
xen-mapcache.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
xen-mapcache.h
xen-stub.c prepare for future GPLv2+ relicensing 2012-01-13 10:55:56 -06:00
xtensa-semi.c

Read the documentation in qemu-doc.html or on http://wiki.qemu.org

- QEMU team