diff mbox

[qemu] tap: Allow specifying a bridge

Message ID 1473159289-28824-1-git-send-email-aik@ozlabs.ru
State New
Headers show

Commit Message

Alexey Kardashevskiy Sept. 6, 2016, 10:54 a.m. UTC
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 <aik@ozlabs.ru>
---

My reason for the patch is I want to use vhost on devices attached to
bridges other than br0 and since -netdev bridge ignores vhost, here is
the patch.
---
 net/tap.c        | 4 +++-
 qapi-schema.json | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Eric Blake Sept. 8, 2016, 2:31 p.m. UTC | #1
On 09/06/2016 05:54 AM, Alexey Kardashevskiy wrote:
> 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 <aik@ozlabs.ru>
> ---
> 

> +++ b/qapi-schema.json
> @@ -2604,6 +2604,7 @@
>      '*fds':        'str',
>      '*script':     'str',
>      '*downscript': 'str',
> +    '*br':         'str',

Missing documentation for the new member.
diff mbox

Patch

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,
                                    errp);
         if (fd == -1) {
             return -1;
diff --git a/qapi-schema.json b/qapi-schema.json
index 5658723..508312a 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2604,6 +2604,7 @@ 
     '*fds':        'str',
     '*script':     'str',
     '*downscript': 'str',
+    '*br':         'str',
     '*helper':     'str',
     '*sndbuf':     'size',
     '*vnet_hdr':   'bool',