qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 42/44] net: check for TUNSETOFFLOAD support before t


From: Mark McLoughlin
Subject: [Qemu-devel] [PATCH 42/44] net: check for TUNSETOFFLOAD support before trying to enable offload features
Date: Wed, 25 Nov 2009 18:49:35 +0000

From: Pierre Riteau <address@hidden>

This avoids the "TUNSETOFFLOAD ioctl() failed: Invalid argument" message
on kernels without TUNSETOFFLOAD support.

Signed-off-by: Pierre Riteau <address@hidden>
Signed-off-by: Mark McLoughlin <address@hidden>
---
 net/tap-linux.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/net/tap-linux.c b/net/tap-linux.c
index e4f7e27..6af9e82 100644
--- a/net/tap-linux.c
+++ b/net/tap-linux.c
@@ -131,6 +131,11 @@ void tap_fd_set_offload(int fd, int csum, int tso4,
 {
     unsigned int offload = 0;
 
+    /* Check if our kernel supports TUNSETOFFLOAD */
+    if (ioctl(fd, TUNSETOFFLOAD, 0) != 0 && errno == EINVAL) {
+        return;
+    }
+
     if (csum) {
         offload |= TUN_F_CSUM;
         if (tso4)
-- 
1.6.5.2





reply via email to

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