[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH qemu v2] tap: Allow specifying a bridge

From: Alexey Kardashevskiy
Subject: [Qemu-devel] [PATCH qemu v2] tap: Allow specifying a bridge
Date: Tue, 13 Sep 2016 17:11:54 +1000

The tap backend is already using qemu-bridge-helper to attach tap
interface to a bridge but (unlike the bridge backend) it always uses
the default bridge name - br0.

This adds a "br" property support to the tap backend.

Signed-off-by: Alexey Kardashevskiy <address@hidden>
* documented a new member in json and hx
 net/tap.c        |  4 +++-
 qapi-schema.json |  3 +++
 qemu-options.hx  | 12 +++++++-----
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/net/tap.c b/net/tap.c
index 6abb962..b6896a7 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -857,7 +857,9 @@ free_fail:
             return -1;
-        fd = net_bridge_run_helper(tap->helper, DEFAULT_BRIDGE_INTERFACE,
+        fd = net_bridge_run_helper(tap->helper,
+                                   tap->has_br ?
+                                   tap->br : DEFAULT_BRIDGE_INTERFACE,
         if (fd == -1) {
             return -1;
diff --git a/qapi-schema.json b/qapi-schema.json
index c4f3674..dbb9f8f 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2575,6 +2575,8 @@
 # @downscript: #optional script to shut down the interface
+# @br: #optional bridge name
 # @helper: #optional command to execute to configure bridge
 # @sndbuf: #optional send buffer limit. Understands [TGMKkb] suffixes.
@@ -2604,6 +2606,7 @@
     '*fds':        'str',
     '*script':     'str',
     '*downscript': 'str',
+    '*br':         'str',
     '*helper':     'str',
     '*sndbuf':     'size',
     '*vnet_hdr':   'bool',
diff --git a/qemu-options.hx b/qemu-options.hx
index a71aaf8..0b3ea42 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1594,10 +1594,11 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
     "                configure a host TAP network backend with ID 'str'\n"
-    "         
+    "         
     "         [,poll-us=n]\n"
     "                configure a host TAP network backend with ID 'str'\n"
+    "                connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE 
     "                use network scripts 'file' (default=" 
     "                to configure it and 'dfile' (default=" 
     "                to deconfigure it\n"
@@ -1884,8 +1885,8 @@ processed and applied to -net user. Mixing them with the 
new configuration
 syntax gives undefined results. Their use for new applications is discouraged
 as they will be removed from future versions.
address@hidden -netdev 
address@hidden -net 
address@hidden -netdev 
address@hidden -net 
 Connect the host TAP network interface @var{name} to VLAN @var{n}.
 Use the network script @var{file} to configure it and the network script
@@ -1896,8 +1897,9 @@ automatically provides one. The default network configure 
script is
 to disable script execution.
 If running QEMU as an unprivileged user, use the network helper
address@hidden to configure the TAP interface. The default network
-helper executable is @file{/path/to/qemu-bridge-helper}.
address@hidden to configure the TAP interface and attach it to the bridge.
+The default network helper executable is @file{/path/to/qemu-bridge-helper}
+and the default bridge device is @file{br0}.
 @address@hidden can be used to specify the handle of an already
 opened host TAP interface.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]