summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPierre Riteau <Pierre.Riteau@irisa.fr>2009-11-25 18:49:35 +0000
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 09:41:35 -0600
commit2e50326c44c802ca9b9d591341085e49208927be (patch)
tree24b82990a051e7552f02b07dcc4bcd8d85650d4b /net
parentnet: fix TAP networking on host kernels without IFF_VNET_HDR support (diff)
downloadqemu-kvm-2e50326c44c802ca9b9d591341085e49208927be.tar.gz
qemu-kvm-2e50326c44c802ca9b9d591341085e49208927be.tar.bz2
qemu-kvm-2e50326c44c802ca9b9d591341085e49208927be.zip
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 <Pierre.Riteau@irisa.fr> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net')
-rw-r--r--net/tap-linux.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/tap-linux.c b/net/tap-linux.c
index e4f7e2723..6af9e824d 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)