]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
net: add mmsghdr struct check for L2TPV3
authorGonglei <arei.gonglei@huawei.com>
Tue, 1 Jul 2014 12:58:08 +0000 (20:58 +0800)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 1 Jul 2014 16:42:23 +0000 (17:42 +0100)
The mmsghdr struct is only introduced in Linux 2.6.32; add a
configure check for it and disable L2TPV3 on hosts which are
too old to provide it, rather than simply failing to compile.

Reported-by: chenliang <chenliang88@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1404219488-11196-1-git-send-email-arei.gonglei@huawei.com
[PMM: cleaned up commit message and corrected kernel version number]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
configure
net/Makefile.objs
net/net.c

index ed41eda4d3fc2a5294f7453c56b99bc3f031a7e5..7dd43fdc70d04bde3d996c7eabbb5434051ead21 100755 (executable)
--- a/configure
+++ b/configure
@@ -1711,6 +1711,19 @@ else
     echo big/little test failed
 fi
 
+##########################################
+# L2TPV3 probe
+
+cat > $TMPC <<EOF
+#include <sys/socket.h>
+int main(void) { return sizeof(struct mmsghdr); }
+EOF
+if compile_prog "" "" ; then
+  l2tpv3=yes
+else
+  l2tpv3=no
+fi
+
 ##########################################
 # pkg-config probe
 
@@ -4343,6 +4356,9 @@ fi
 if test "$netmap" = "yes" ; then
   echo "CONFIG_NETMAP=y" >> $config_host_mak
 fi
+if test "$l2tpv3" = "yes" ; then
+  echo "CONFIG_L2TPV3=y" >> $config_host_mak
+fi
 if test "$cap_ng" = "yes" ; then
   echo "CONFIG_LIBCAP=y" >> $config_host_mak
 fi
index a06ba59dad6a0a2b2f93f11ea5f131a233d812f1..ec19cb31d9c9e19c8d6059731129956dd963bfe8 100644 (file)
@@ -2,7 +2,7 @@ common-obj-y = net.o queue.o checksum.o util.o hub.o
 common-obj-y += socket.o
 common-obj-y += dump.o
 common-obj-y += eth.o
-common-obj-$(CONFIG_LINUX) += l2tpv3.o
+common-obj-$(CONFIG_L2TPV3) += l2tpv3.o
 common-obj-$(CONFIG_POSIX) += tap.o vhost-user.o
 common-obj-$(CONFIG_LINUX) += tap-linux.o
 common-obj-$(CONFIG_WIN32) += tap-win32.o
index 0869c60beee479dc966ce7c853d58529bd69a89a..6d930ea63ba77a42a7fbba832ad06e7a1a19bcda 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -806,7 +806,7 @@ static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
 #ifdef CONFIG_VHOST_NET_USED
         [NET_CLIENT_OPTIONS_KIND_VHOST_USER] = net_init_vhost_user,
 #endif
-#ifdef CONFIG_LINUX
+#ifdef CONFIG_L2TPV3
         [NET_CLIENT_OPTIONS_KIND_L2TPV3]    = net_init_l2tpv3,
 #endif
 };
@@ -845,7 +845,7 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
 #ifdef CONFIG_VHOST_NET_USED
         case NET_CLIENT_OPTIONS_KIND_VHOST_USER:
 #endif
-#ifdef CONFIG_LINUX
+#ifdef CONFIG_L2TPV3
         case NET_CLIENT_OPTIONS_KIND_L2TPV3:
 #endif
             break;