Skip to contentSkip to conversation

tap: Allow specifying a bridge

PATCH Superseded Alexey Kardashevskiy 2 participants 2 messages Sep 6, 2016 – Sep 8, 2016 Networking

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tap: Allow specifying a bridge

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.

---

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(-)
net/tap.c +3 -1
index 6abb962..b6896a7 100644
@@ -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;
qapi-schema.json +1 -0
index 5658723..508312a 100644
@@ -2604,6 +2604,7 @@
     '*fds':        'str',
     '*script':     'str',
     '*downscript': 'str',
+    '*br':         'str',
     '*helper':     'str',
     '*sndbuf':     'size',
     '*vnet_hdr':   'bool',
Signature · 1 line
2.5.0.rc3
#1 lore raw
Quoted 12 lines · Alexey Kardashevskiy

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.

---

+++ b/qapi-schema.json

qapi-schema.json line 2607

Quoted 4 lines
qapi-schema.json +1 -0
@@ -2604,6 +2604,7 @@
     '*fds':        'str',
     '*script':     'str',
     '*downscript': 'str',
+    '*br':         'str',

Missing documentation for the new member.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org