qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] net: add mmsghdr struct check for L2TPV3
@ 2014-07-01 12:58 arei.gonglei
  2014-07-01 14:35 ` Stefan Hajnoczi
  2014-07-01 17:27 ` Peter Maydell
  0 siblings, 2 replies; 11+ messages in thread
From: arei.gonglei @ 2014-07-01 12:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: antivano, peter.maydell, weidong.huang, chenliang88, luonengjun,
	Gonglei, stefanha, pbonzini

From: Gonglei <arei.gonglei@huawei.com>

because mmsghdr struct is introduced on Linux kernel 3.3+.
add check for mmsghdr struct, it only gets built on hosts that
support mmsghdr.

Reported-by: chenliang <chenliang88@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
v2->v1: 
   delete $l2tpv3 variable initialization and 
   'if' false check suggested by PMM.
---
 configure         | 16 ++++++++++++++++
 net/Makefile.objs |  2 +-
 net/net.c         |  4 ++--
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 23ecb37..463ae6e 100755
--- a/configure
+++ b/configure
@@ -1712,6 +1712,19 @@ else
 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
 
 if ! has "$pkg_config_exe"; then
@@ -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
diff --git a/net/Makefile.objs b/net/Makefile.objs
index a06ba59..ec19cb3 100644
--- a/net/Makefile.objs
+++ b/net/Makefile.objs
@@ -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
diff --git a/net/net.c b/net/net.c
index 0869c60..6d930ea 100644
--- 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;
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-07-02  6:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-01 12:58 [Qemu-devel] [PATCH v2] net: add mmsghdr struct check for L2TPV3 arei.gonglei
2014-07-01 14:35 ` Stefan Hajnoczi
2014-07-01 15:06   ` Anton Ivanov (antivano)
2014-07-01 15:14     ` Peter Maydell
2014-07-01 15:26       ` Anton Ivanov (antivano)
2014-07-01 15:34         ` Peter Maydell
2014-07-01 15:58           ` Anton Ivanov (antivano)
2014-07-01 16:01             ` Peter Maydell
2014-07-02  6:21     ` Gonglei (Arei)
2014-07-01 17:27 ` Peter Maydell
2014-07-02  1:04   ` Gonglei (Arei)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).