From: Pierre Riteau Date: Wed, 25 Nov 2009 18:49:35 +0000 (+0000) Subject: net: check for TUNSETOFFLOAD support before trying to enable offload features X-Git-Tag: v0.12.0-rc0~129 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e50326c44c802ca9b9d591341085e49208927be;p=thirdparty%2Fqemu.git net: check for TUNSETOFFLOAD support before trying to enable offload features This avoids the "TUNSETOFFLOAD ioctl() failed: Invalid argument" message on kernels without TUNSETOFFLOAD support. Signed-off-by: Pierre Riteau Signed-off-by: Mark McLoughlin Signed-off-by: Anthony Liguori --- diff --git a/net/tap-linux.c b/net/tap-linux.c index e4f7e2723b7..6af9e824d3c 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)