[gst-cvs] gst-plugins-good: only use struct ip_mreqn if it is detected

Andy Wingo wingo at kemper.freedesktop.org
Mon Apr 20 06:54:50 PDT 2009


Module: gst-plugins-good
Branch: master
Commit: 07dcbacd60402016bec2e3797e37008df58e6a79
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=07dcbacd60402016bec2e3797e37008df58e6a79

Author: Andy Wingo <wingo at wingomac.bcn.oblong.net>
Date:   Mon Apr 20 15:46:03 2009 +0200

only use struct ip_mreqn if it is detected

* configure.ac: Make an explicit check for struct ip_mreqn.

* gst/udp/gstudpnetutils.c: Use HAVE_IP_MREQN instead of the ad-hoc checks.

---

 configure.ac             |    6 ++++++
 gst/udp/gstudpnetutils.c |   12 ++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index bb12f78..31cb7ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -179,6 +179,12 @@ dnl Check for mmap (needed by electricfence plugin)
 AC_FUNC_MMAP
 AM_CONDITIONAL(GST_HAVE_MMAP, test "x$ac_cv_func_mmap_fixed_mapped" == "xyes")
 
+dnl Check for mmap (needed by electricfence plugin)
+
+AC_CHECK_TYPE([struct ip_mreqn], [
+              AC_DEFINE(HAVE_IP_MREQN,, [Define if we have struct ip_mreqn])],,
+              [#include <netinet/in.h>])
+
 dnl *** checks for dependency libraries ***
 
 dnl GLib is required
diff --git a/gst/udp/gstudpnetutils.c b/gst/udp/gstudpnetutils.c
index 71828d3..707f7fc 100644
--- a/gst/udp/gstudpnetutils.c
+++ b/gst/udp/gstudpnetutils.c
@@ -172,21 +172,21 @@ gst_udp_join_group (int sockfd, struct sockaddr_storage *addr, gchar * iface)
   switch (addr->ss_family) {
     case AF_INET:
     {
-#if defined (G_OS_WIN32) || (defined (__SVR4) && defined (__sun))
-      struct ip_mreq mreq4;
-#else
+#ifdef HAVE_IP_MREQN
       struct ip_mreqn mreq4;
+#else
+      struct ip_mreq mreq4;
 #endif
 
       mreq4.imr_multiaddr.s_addr =
           ((struct sockaddr_in *) addr)->sin_addr.s_addr;
-#if defined (G_OS_WIN32) || (defined (__SVR4) && defined (__sun))
-      mreq4.imr_interface.s_addr = INADDR_ANY;
-#else
+#if HAVE_IP_MREQN
       if (iface)
         mreq4.imr_ifindex = if_nametoindex (iface);
       else
         mreq4.imr_ifindex = 0;  /* Pick any.  */
+#else
+      mreq4.imr_interface.s_addr = INADDR_ANY;
 #endif
 
       if ((ret =





More information about the Gstreamer-commits mailing list