Some management apps like libvirt creates a tap interface,
adds it to a bridge and then passes the fd to qemu-kvm.

Since we have no way of querying whether the IFF_VNET_HDR
flag has been enabled on the interface, the app needs to
tell us if has enabled it.

Signed-off-by: Mark McLoughlin <[EMAIL PROTECTED]>
---
 qemu/vl.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/qemu/vl.c b/qemu/vl.c
index 14a66e0..499d6f9 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -5487,10 +5487,19 @@ int net_client_init(const char *device, const char *p)
         int fd;
         vlan->nb_host_devs++;
         if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
+            int vnet_hdr = 0;
             fd = strtol(buf, NULL, 0);
             fcntl(fd, F_SETFL, O_NONBLOCK);
+            if (get_param_value(buf, sizeof(buf), "vnet_hdr", p) > 0) {
+                if (strcmp(buf, "on") == 0) {
+                    vnet_hdr = 1;
+                } else if (strcmp(buf, "off") != 0) {
+                    fprintf(stderr, "qemu: '%s' invalid vnet_hdr option\n", 
buf);
+                    return 0;
+                }
+            }
             ret = -1;
-            if (net_tap_fd_init(vlan, fd, 0))
+            if (net_tap_fd_init(vlan, fd, vnet_hdr))
                 ret = 0;
         } else {
             if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) {
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to