Patchwork [44/44] net: fix vnet_hdr handling in solaris tap code

login
register
mail settings
Submitter Mark McLoughlin
Date Nov. 25, 2009, 6:49 p.m.
Message ID <1259174977-26212-45-git-send-email-markmc@redhat.com>
Download mbox | patch
Permalink /patch/39459/
State New
Headers show

Comments

Mark McLoughlin - Nov. 25, 2009, 6:49 p.m.
Print an error if the user specifies vnet_hdr=1 on the cmdline.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 net/tap-solaris.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Patch

diff --git a/net/tap-solaris.c b/net/tap-solaris.c
index ef4e60c..e14fe36 100644
--- a/net/tap-solaris.c
+++ b/net/tap-solaris.c
@@ -180,6 +180,17 @@  int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required
        return -1;
     }
     pstrcpy(ifname, ifname_size, dev);
+    if (*vnet_hdr) {
+        /* Solaris doesn't have IFF_VNET_HDR */
+        *vnet_hdr = 0;
+
+        if (vnet_hdr_required && !*vnet_hdr) {
+            qemu_error("vnet_hdr=1 requested, but no kernel "
+                       "support for IFF_VNET_HDR available");
+            close(fd);
+            return -1;
+        }
+    }
     fcntl(fd, F_SETFL, O_NONBLOCK);
     return fd;
 }