From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDEkH-0006yW-Qo for qemu-devel@nongnu.org; Wed, 25 Nov 2009 05:05:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDEkD-0006wL-6a for qemu-devel@nongnu.org; Wed, 25 Nov 2009 05:05:09 -0500 Received: from [199.232.76.173] (port=56503 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDEkC-0006wF-NG for qemu-devel@nongnu.org; Wed, 25 Nov 2009 05:05:04 -0500 Received: from mail1-relais-roc.national.inria.fr ([192.134.164.82]:8570) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1NDEkB-0008Dz-Po for qemu-devel@nongnu.org; Wed, 25 Nov 2009 05:05:04 -0500 From: Pierre Riteau Date: Wed, 25 Nov 2009 11:04:42 +0100 Message-Id: <1259143482-17735-1-git-send-email-Pierre.Riteau@irisa.fr> Subject: [Qemu-devel] [PATCH] Check for TUNSETOFFLOAD support before trying to enable offload features List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Mark McLoughlin Cc: Pierre Riteau This avoids the "TUNSETOFFLOAD ioctl() failed: Invalid argument" message on kernels without TUNSETOFFLOAD support. Signed-off-by: Pierre Riteau --- 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 0f621a2..e038e1a 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -129,6 +129,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