Index: gst/udp/gstudpnetutils.c
===================================================================
--- gst/udp/gstudpnetutils.c	(revision 1)
+++ gst/udp/gstudpnetutils.c	(working copy)
@@ -22,21 +22,14 @@
 #include "config.h"
 #endif
 
+#include <errno.h>
+#include <stdio.h>
+#include <memory.h>
+
 #include "gstudpnetutils.h"
 
 #ifdef G_OS_WIN32
 
-int
-gst_udp_net_utils_win32_inet_aton (const char *c, struct in_addr *paddr)
-{
-  paddr->s_addr = inet_addr (c);
-
-  if (paddr->s_addr == INADDR_NONE)
-    return 0;
-
-  return 1;
-}
-
 gboolean
 gst_udp_net_utils_win32_wsa_startup (GstObject * obj)
 {
@@ -60,3 +53,161 @@
 }
 
 #endif
+
+int gst_udp_get_addr(const char *hostname, int port, struct sockaddr_storage *addr)
+{
+  struct addrinfo hints, *res;
+  char service[NI_MAXSERV];
+  int ret;
+
+  memset(&hints, 0, sizeof(hints));
+  hints.ai_family = AF_UNSPEC;
+  hints.ai_socktype = SOCK_DGRAM;
+  snprintf(service, sizeof(service)-1, "%d", port);
+
+  if((ret = getaddrinfo(hostname, (port == -1) ? NULL : service, &hints, &res)) < 0)
+    return ret;
+
+  memcpy(addr, res->ai_addr, sizeof(struct sockaddr_storage));
+  freeaddrinfo(res);
+
+  return ret;
+}
+
+int gst_udp_socket(const char *hostname, int port, struct sockaddr_storage *addr)
+{
+  struct addrinfo hints, *res;
+  char service[NI_MAXSERV];
+  int ret;
+
+  memset(&hints, 0, sizeof(hints));
+  hints.ai_family = AF_UNSPEC;
+  hints.ai_socktype = SOCK_DGRAM;
+  snprintf(service, sizeof(service)-1, "%d", port);
+
+  if ((ret = getaddrinfo(hostname, (port == -1) ? NULL : service, &hints, &res)) < 0)
+    return ret;
+  ret = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+
+  if(addr != NULL) {
+    memcpy(addr, res->ai_addr, sizeof(struct sockaddr_storage));
+  }
+  freeaddrinfo(res);
+
+  return ret;
+}
+
+int gst_udp_join_group(int sockfd, int loop, int ttl, struct sockaddr_storage *addr)
+{
+  int ret = -1;
+
+  switch (addr->ss_family) {
+  case AF_INET:
+    {
+      struct ip_mreq mreq4;
+
+      mreq4.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
+      mreq4.imr_interface.s_addr= INADDR_ANY;
+
+      if ((ret = setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop))) < 0)
+        return ret;
+
+      if ((ret = setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl))) < 0)
+        return ret;
+
+      if ((ret = setsockopt(sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&mreq4, sizeof(mreq4))) < 0)
+        return ret;
+    }
+    break;
+
+    case AF_INET6:
+      {
+        struct ipv6_mreq    mreq6;
+
+        memcpy(&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *)addr)->sin6_addr), sizeof(struct in6_addr));
+        mreq6.ipv6mr_interface = 0;
+
+        if ((ret = setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &loop, sizeof(loop))) < 0)
+          return ret;
+
+        if ((ret = setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &ttl, sizeof(ttl))) < 0)
+          return ret;
+
+        if ((ret = setsockopt(sockfd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (const void *)&mreq6, sizeof(mreq6))) < 0)
+          return ret;
+     }
+     break;
+
+    default:
+      errno = EAFNOSUPPORT;
+  }
+
+  return ret;
+}
+
+int gst_udp_leave_group(int sockfd, struct sockaddr_storage *addr)
+{
+  int ret = -1;
+
+  switch (addr->ss_family) {
+  case AF_INET:
+    {
+      struct ip_mreq mreq4;
+
+      mreq4.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
+      mreq4.imr_interface.s_addr= INADDR_ANY;
+
+      if ((ret = setsockopt(sockfd, IPPROTO_IP, IP_DROP_MEMBERSHIP, (const void *)&mreq4, sizeof(mreq4))) < 0)
+        return ret;
+    }
+    break;
+
+    case AF_INET6:
+      {
+        struct ipv6_mreq mreq6;
+
+        memcpy(&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *)addr)->sin6_addr), sizeof(struct in6_addr));
+        mreq6.ipv6mr_interface = 0;
+
+        if ((ret = setsockopt(sockfd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, (const void *)&mreq6, sizeof(mreq6))) < 0)
+          return ret;
+     }
+     break;
+
+    default:
+      errno = EAFNOSUPPORT;
+  }
+
+  return ret;
+}
+
+int gst_udp_is_multicast(struct sockaddr_storage *addr)
+{
+  int ret = -1;
+
+  switch (addr->ss_family) {
+  case AF_INET:
+    {
+      struct sockaddr_in *addr4 = (struct sockaddr_in *)addr;
+      ret = IN_MULTICAST(ntohl(addr4->sin_addr.s_addr));
+    }
+    break;
+
+  case AF_INET6:
+    {
+      struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr;
+      ret = IN6_IS_ADDR_MULTICAST(&addr6->sin6_addr);
+    }
+    break;
+
+  default:
+    errno = EAFNOSUPPORT;
+  }
+
+  return ret;
+}
+
+int gst_udp_is_ipv6_addr(struct sockaddr_storage *addr)
+{
+  return (addr->ss_family == AF_INET6) ? 1 : 0;
+}
Index: gst/udp/gstudpsrc.c
===================================================================
--- gst/udp/gstudpsrc.c	(revision 1)
+++ gst/udp/gstudpsrc.c	(working copy)
@@ -351,7 +351,7 @@
 {
   GstUDPSrc *udpsrc;
   GstNetBuffer *outbuf;
-  struct sockaddr_in tmpaddr;
+  struct sockaddr_storage tmpaddr;
   socklen_t len;
   fd_set read_fds;
   guint max_sock;
@@ -467,9 +467,25 @@
   GST_BUFFER_DATA (outbuf) = pktdata;
   GST_BUFFER_SIZE (outbuf) = ret;
 
-  gst_netaddress_set_ip4_address (&outbuf->from, tmpaddr.sin_addr.s_addr,
-      tmpaddr.sin_port);
+  switch( tmpaddr.ss_family ) {
+  case AF_INET:
+    {
+      gst_netaddress_set_ip4_address (&outbuf->from, ((struct sockaddr_in*)&tmpaddr)->sin_addr.s_addr,
+          ((struct sockaddr_in*)&tmpaddr)->sin_port);
+    }
+    break;
+  case AF_INET6:
+    {
+      guint8 ip6[16];
 
+      memcpy(ip6, &((struct sockaddr_in6*)&tmpaddr)->sin6_addr, sizeof(ip6));
+      gst_netaddress_set_ip6_address (&outbuf->from, ip6, ((struct sockaddr_in*)&tmpaddr)->sin_port);
+    }
+    break;
+  default:
+    goto receive_error; //FIXME: not actualy a receive error
+  }
+
   gst_buffer_set_caps (GST_BUFFER_CAST (outbuf), udpsrc->caps);
 
   GST_LOG_OBJECT (udpsrc, "read %d bytes", (int) readsize);
@@ -679,7 +695,7 @@
 {
   guint bc_val;
   gint reuse;
-  struct sockaddr_in my_addr;
+  struct sockaddr_storage my_addr;
   guint len;
   int port;
   GstUDPSrc *src;
@@ -704,12 +720,9 @@
   fcntl (WRITE_SOCKET (src), F_SETFL, O_NONBLOCK);
 #endif
 
-  if (!inet_aton (src->multi_group, &(src->multi_addr.imr_multiaddr)))
-    src->multi_addr.imr_multiaddr.s_addr = 0;
-
   if (src->sockfd == -1) {
     /* need to allocate a socket */
-    if ((ret = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+    if ((ret = gst_udp_socket(src->multi_group, src->port, &src->myaddr)) < 0)
       goto no_socket;
 
     src->sock = ret;
@@ -721,15 +734,6 @@
                 sizeof (reuse))) < 0)
       goto setsockopt_error;
 
-    memset (&src->myaddr, 0, sizeof (src->myaddr));
-    src->myaddr.sin_family = AF_INET;   /* host byte order */
-    src->myaddr.sin_port = htons (src->port);   /* short, network byte order */
-
-    if (src->multi_addr.imr_multiaddr.s_addr)
-      src->myaddr.sin_addr.s_addr = src->multi_addr.imr_multiaddr.s_addr;
-    else
-      src->myaddr.sin_addr.s_addr = INADDR_ANY;
-
     GST_DEBUG_OBJECT (src, "binding on port %d", src->port);
     if ((ret = bind (src->sock, (struct sockaddr *) &src->myaddr,
                 sizeof (src->myaddr))) < 0)
@@ -740,11 +744,8 @@
     src->externalfd = TRUE;
   }
 
-  if (src->multi_addr.imr_multiaddr.s_addr) {
-    src->multi_addr.imr_interface.s_addr = INADDR_ANY;
-    if ((ret =
-            setsockopt (src->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
-                &src->multi_addr, sizeof (src->multi_addr))) < 0)
+  if( gst_udp_is_multicast(&src->myaddr) ) {
+    if ((ret = gst_udp_join_group(src->sock, 1, src->ttl, &src->myaddr)) < 0)
       goto membership;
   }
 
@@ -779,7 +780,10 @@
               sizeof (bc_val))) < 0)
     goto no_broadcast;
 
-  port = ntohs (my_addr.sin_port);
+  /* NOTE: sockaddr_in.sin_port works for ipv4 and ipv6 because sin_port
+   * follows ss_family on both
+   */
+  port = ntohs (((struct sockaddr_in*)&my_addr)->sin_port);
   GST_DEBUG_OBJECT (src, "bound, on port %d", port);
   if (port != src->port) {
     src->port = port;
@@ -787,7 +791,7 @@
     g_object_notify (G_OBJECT (src), "port");
   }
 
-  src->myaddr.sin_port = htons (src->port + 1);
+  ((struct sockaddr_in*)&src->myaddr)->sin_port = htons (src->port + 1);
 
   return TRUE;
 
Index: gst/udp/gstudpnetutils.h
===================================================================
--- gst/udp/gstudpnetutils.h	(revision 1)
+++ gst/udp/gstudpnetutils.h	(working copy)
@@ -52,7 +52,6 @@
 #define IOCTL_SOCKET ioctlsocket
 #define CLOSE_SOCKET(sock) closesocket(sock)
 #define setsockopt(sock,l,opt,val,len) setsockopt(sock,l,opt,(char *)(val),len)
-#define inet_aton(c,addr) gst_udp_net_utils_win32_inet_aton ((c),(addr))
 #define WSA_STARTUP(obj) gst_udp_net_utils_win32_wsa_startup(GST_OBJECT(obj))
 #define WSA_CLEANUP(obj) WSACleanup ()
 
@@ -68,10 +67,16 @@
 
 #ifdef G_OS_WIN32
 
-int      gst_udp_net_utils_win32_inet_aton (const char *c, struct in_addr * addr);
 gboolean gst_udp_net_utils_win32_wsa_startup (GstObject * obj);
 
 #endif
 
+int gst_udp_get_addr(const char *hostname, int port, struct sockaddr_storage *addr);
+int gst_udp_socket(const char *hostname, int port, struct sockaddr_storage *addr);
+int gst_udp_join_group(int sockfd, int loop, int ttl, struct sockaddr_storage *addr);
+int gst_udp_leave_group(int sockfd, struct sockaddr_storage *addr);
+int gst_udp_is_multicast(struct sockaddr_storage *addr);
+int gst_udp_is_ipv6_addr(struct sockaddr_storage *addr);
+
 #endif /* __GST_UDP_NET_UTILS_H__*/
 
Index: gst/udp/gstudpsrc.h
===================================================================
--- gst/udp/gstudpsrc.h	(revision 1)
+++ gst/udp/gstudpsrc.h	(working copy)
@@ -68,8 +68,7 @@
   int      control_sock[2];
   gboolean externalfd;
 
-  struct   sockaddr_in myaddr;
-  struct   ip_mreq multi_addr;
+  struct   sockaddr_storage myaddr;
 };
 
 struct _GstUDPSrcClass {
Index: gst/udp/gstdynudpsink.c
===================================================================
--- gst/udp/gstdynudpsink.c	(revision 1)
+++ gst/udp/gstdynudpsink.c	(working copy)
@@ -29,10 +29,13 @@
 GST_DEBUG_CATEGORY_STATIC (dynudpsink_debug);
 #define GST_CAT_DEFAULT (dynudpsink_debug)
 
-#define CLOSE_IF_REQUESTED(udpctx)                                      \
-  if ((!udpctx->externalfd) || (udpctx->externalfd && udpctx->closefd)) \
-    CLOSE_SOCKET(udpctx->sock);                                         \
-  udpctx->sock = -1;
+#define CLOSE_IF_REQUESTED(udpctx)                                        \
+  if ((!udpctx->externalfd) || (udpctx->externalfd && udpctx->closefd)) { \
+    CLOSE_SOCKET(udpctx->sock);                                           \
+    CLOSE_SOCKET(udpctx->sock6);                                          \
+  }                                                                       \
+  udpctx->sock = -1;                                                      \
+  udpctx->sock6 = -1;
 
 static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
@@ -178,6 +181,7 @@
   sink->externalfd = FALSE;
 
   sink->sock = -1;
+  sink->sock6 = -1;
 }
 
 static void
@@ -195,12 +199,7 @@
   gint ret, size;
   guint8 *data;
   GstNetBuffer *netbuf;
-  struct sockaddr_in theiraddr;
-  guint16 destport;
-  guint32 destaddr;
 
-  memset (&theiraddr, 0, sizeof (theiraddr));
-
   if (GST_IS_NETBUFFER (buffer)) {
     netbuf = GST_NETBUFFER (buffer);
   } else {
@@ -216,16 +215,41 @@
   GST_DEBUG ("about to send %d bytes", size);
 
   // let's get the address from the netbuffer
-  gst_netaddress_get_ip4_address (&netbuf->to, &destaddr, &destport);
+  switch( gst_netaddress_get_net_type(&netbuf->to) ) {
+  case GST_NET_TYPE_IP4:
+    {
+      struct sockaddr_in theiraddr;
 
-  GST_DEBUG ("sending %d bytes to client %d port %d", size, destaddr, destport);
+      memset (&theiraddr, 0, sizeof (theiraddr));
+      gst_netaddress_get_ip4_address (&netbuf->to,
+        &theiraddr.sin_addr.s_addr, &theiraddr.sin_port);
+      GST_DEBUG ("sending %d bytes to client %d port %d", size,
+        theiraddr.sin_addr.s_addr, theiraddr.sin_port);
 
-  theiraddr.sin_family = AF_INET;
-  theiraddr.sin_addr.s_addr = destaddr;
-  theiraddr.sin_port = destport;
-  ret = sendto (sink->sock, data, size, 0,
-      (struct sockaddr *) &theiraddr, sizeof (theiraddr));
+      theiraddr.sin_family = AF_INET;
+      ret = sendto (sink->sock, data, size, 0,
+        (struct sockaddr *) &theiraddr, sizeof (theiraddr));
+    }
+    break;
+  case GST_NET_TYPE_IP6:
+    {
+      struct sockaddr_in6 theiraddr;
+      guint8 ip6[16];
 
+      memset (&theiraddr, 0, sizeof (theiraddr));
+      gst_netaddress_get_ip6_address (&netbuf->to, ip6, &theiraddr.sin6_port);
+      memcpy(&theiraddr.sin6_addr, ip6, sizeof(theiraddr.sin6_addr));
+
+      theiraddr.sin6_family = AF_INET6;
+      ret = sendto (sink->sock6, data, size, 0,
+        (struct sockaddr *) &theiraddr, sizeof (theiraddr));
+    }
+    break;
+  default:
+    errno = EAFNOSUPPORT;
+    ret = -1;
+  }
+
   if (ret < 0) {
     if (errno != EINTR && errno != EAGAIN) {
       goto send_error;
@@ -297,18 +321,30 @@
 
   if (sink->sockfd == -1) {
     /* create sender socket if none available */
-    if ((sink->sock = socket (AF_INET, SOCK_DGRAM, 0)) == -1)
+    if ((sink->sock = socket (PF_INET, SOCK_DGRAM, 0)) == -1)
       goto no_socket;
 
+    GST_DEBUG("");
+    sink->sock6 = socket (PF_INET6, SOCK_DGRAM, 0);
+    if( sink->sock6 == -1 && errno != EAFNOSUPPORT )
+      goto no_socket;
+
     bc_val = 1;
     if ((ret =
             setsockopt (sink->sock, SOL_SOCKET, SO_BROADCAST, &bc_val,
                 sizeof (bc_val))) < 0)
       goto no_broadcast;
+    if (sink->sock6 != -1
+        && (ret =
+            setsockopt (sink->sock6, SOL_SOCKET, SO_BROADCAST, &bc_val,
+                sizeof (bc_val))) < 0) {
+      perror("failed to set SO_BROADCAST in ipv6 socket\n");
+      goto no_broadcast;
+    }
 
     sink->externalfd = TRUE;
   } else {
-    sink->sock = sink->sockfd;
+    sink->sock6 = sink->sock = sink->sockfd;
     sink->externalfd = TRUE;
   }
   return TRUE;
Index: gst/udp/gstmultiudpsink.c
===================================================================
--- gst/udp/gstmultiudpsink.c	(revision 1)
+++ gst/udp/gstmultiudpsink.c	(working copy)
@@ -389,23 +389,13 @@
   /* FIXME, can we use multicast and unicast over the same
    * socket? if not, search for socket of this multicast group or
    * create a new one. */
-  if (setsockopt (*(client->sock), IPPROTO_IP, IP_ADD_MEMBERSHIP,
-          &(client->multi_addr), sizeof (client->multi_addr)) < 0)
-    perror ("setsockopt IP_ADD_MEMBERSHIP\n");
-  if (setsockopt (*(client->sock), IPPROTO_IP, IP_MULTICAST_TTL, &ttl,
-          sizeof (ttl)) < 0)
-    perror ("setsockopt IP_MULTICAST_TTL\n");
-  if (setsockopt (*(client->sock), IPPROTO_IP, IP_MULTICAST_LOOP, &loop,
-          sizeof (loop)) < 0)
-    perror ("setsockopt IP_MULTICAST_LOOP\n");
+  gst_udp_join_group(*(client->sock), loop, ttl, &client->theiraddr);
 }
 
 static void
 leave_multicast (GstUDPClient * client)
 {
-  if (setsockopt (*(client->sock), IPPROTO_IP, IP_DROP_MEMBERSHIP,
-          &(client->multi_addr), sizeof (client->multi_addr)) < 0)
-    perror ("setsockopt IP_DROP_MEMBERSHIP\n");
+  gst_udp_leave_group(*(client->sock), &client->theiraddr);
 }
 
 /* create a socket for sending to remote machine */
@@ -420,12 +410,20 @@
   /* create sender socket */
   if ((sink->sock = socket (AF_INET, SOCK_DGRAM, 0)) == -1)
     goto no_socket;
+  sink->sock6 = socket (AF_INET6, SOCK_DGRAM, 0);
+  if( sink->sock6 == -1 && errno != EAFNOSUPPORT )
+    goto no_socket;
 
   bc_val = 1;
   if ((ret =
           setsockopt (sink->sock, SOL_SOCKET, SO_BROADCAST, &bc_val,
               sizeof (bc_val))) < 0)
     goto no_broadcast;
+  if (sink->sock6 != -1
+      && (ret =
+          setsockopt (sink->sock6, SOL_SOCKET, SO_BROADCAST, &bc_val,
+              sizeof (bc_val))) < 0)
+    goto no_broadcast;
 
   sink->bytes_to_serve = 0;
   sink->bytes_served = 0;
@@ -434,8 +432,9 @@
 
   for (clients = sink->clients; clients; clients = g_list_next (clients)) {
     client = (GstUDPClient *) clients->data;
-    if (client->multi_addr.imr_multiaddr.s_addr)
+    if (gst_udp_is_multicast(&client->theiraddr)) {
       join_multicast (client);
+    }
   }
   return TRUE;
 
@@ -459,13 +458,12 @@
 gst_multiudpsink_close (GstMultiUDPSink * sink)
 {
   CLOSE_SOCKET (sink->sock);
+  CLOSE_SOCKET (sink->sock6);
 }
 
 void
 gst_multiudpsink_add (GstMultiUDPSink * sink, const gchar * host, gint port)
 {
-  struct hostent *he;
-  struct in_addr addr;
   GstUDPClient *client;
   GTimeVal now;
 
@@ -475,41 +473,27 @@
   client->port = port;
   client->sock = &sink->sock;
 
-  memset (&client->theiraddr, 0, sizeof (client->theiraddr));
-  memset (&client->multi_addr, 0, sizeof (client->multi_addr));
-  client->theiraddr.sin_family = AF_INET;       /* host byte order */
-  client->theiraddr.sin_port = htons (port);    /* short, network byte order */
+  if( gst_udp_get_addr(host, port, &client->theiraddr) < 0)
+    goto getaddrinfo_error;
 
+  if( gst_udp_is_ipv6_addr(&client->theiraddr) ) {
+    GST_DEBUG_OBJECT (sink, "ipv6 client address detected");
+    client->sock = &sink->sock6;
+  } else {
+    GST_DEBUG_OBJECT (sink, "ipv4 client address detected");
+  }
+
   g_get_current_time (&now);
   client->connect_time = GST_TIMEVAL_TO_TIME (now);
 
-  /* if its an IP address */
-  if (inet_aton (host, &addr)) {
-    /* check if its a multicast address */
-    if ((ntohl (addr.s_addr) & 0xf0000000) == 0xe0000000) {
-      GST_DEBUG_OBJECT (sink, "multicast address detected");
-      client->multi_addr.imr_multiaddr.s_addr = addr.s_addr;
-      client->multi_addr.imr_interface.s_addr = INADDR_ANY;
-
-      client->theiraddr.sin_addr = client->multi_addr.imr_multiaddr;
-
-    } else {
-      GST_DEBUG_OBJECT (sink, "normal address detected");
-      client->theiraddr.sin_addr = *((struct in_addr *) &addr);
-    }
-    /* if init_send has already been called, set sockopts for multicast */
-    if (*client->sock > 0 && client->multi_addr.imr_multiaddr.s_addr)
+  /* check if its a multicast address */
+  if (gst_udp_is_multicast(&client->theiraddr)) {
+    GST_DEBUG_OBJECT (sink, "multicast address detected");
+    if (*client->sock > 0)
       join_multicast (client);
-  }
-  /* we dont need to lookup for localhost */
-  else if (strcmp (host, "localhost") == 0 && inet_aton ("127.0.0.1", &addr)) {
-    client->theiraddr.sin_addr = *((struct in_addr *) &addr);
-  }
-  /* if its a hostname */
-  else if ((he = gethostbyname (host))) {
-    client->theiraddr.sin_addr = *((struct in_addr *) he->h_addr);
+
   } else {
-    goto host_error;
+    GST_DEBUG_OBJECT (sink, "normal address detected");
   }
 
   g_mutex_lock (sink->client_lock);
@@ -522,9 +506,9 @@
   return;
 
   /* ERRORS */
-host_error:
+getaddrinfo_error:
   {
-    GST_WARNING_OBJECT (sink, "hostname lookup error?");
+    GST_WARNING_OBJECT (sink, "getaddrinfo lookup error?");
     g_free (client->host);
     g_free (client);
     return;
@@ -571,7 +555,7 @@
   g_get_current_time (&now);
   client->disconnect_time = GST_TIMEVAL_TO_TIME (now);
 
-  if (client->multi_addr.imr_multiaddr.s_addr)
+  if (gst_udp_is_multicast(&client->theiraddr))
     leave_multicast (client);
 
   /* Unlock to emit signal before we delete the actual client */
Index: gst/udp/gstdynudpsink.h
===================================================================
--- gst/udp/gstdynudpsink.h	(revision 1)
+++ gst/udp/gstdynudpsink.h	(working copy)
@@ -60,6 +60,7 @@
 
   /* the socket in use */
   int sock;
+  int sock6;
   gboolean externalfd;
 };
 
Index: gst/udp/gstmultiudpsink.h
===================================================================
--- gst/udp/gstmultiudpsink.h	(revision 1)
+++ gst/udp/gstmultiudpsink.h	(working copy)
@@ -46,8 +46,7 @@
 typedef struct {
   int *sock;
 
-  struct sockaddr_in theiraddr;
-  struct ip_mreq multi_addr;
+  struct sockaddr_storage theiraddr;
 
   gchar *host;
   gint port;
@@ -65,6 +64,7 @@
   GstBaseSink parent;
 
   int sock;
+  int sock6;    /* for ipv6 address */
 
   GMutex        *client_lock;
   GList         *clients;
