$OpenBSD: patch-gui_gdmchooser_c,v 1.4 2008/11/25 18:27:39 ajacoutot Exp $
--- gui/gdmchooser.c.orig	Wed Sep  3 20:35:57 2008
+++ gui/gdmchooser.c	Tue Nov 25 17:18:20 2008
@@ -40,6 +40,7 @@
 #include <net/if.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <ifaddrs.h>
 #ifdef HAVE_SYS_SOCKIO_H
 #include <sys/sockio.h>
 #endif
@@ -685,9 +686,38 @@ gdm_chooser_decode_packet (GIOChannel   *source,
 
 
 /* Find broadcast address for all active, non pointopoint interfaces */
+#ifdef __OpenBSD__
 static void
 gdm_chooser_find_bcaddr (void)
 {
+       struct ifaddrs *ifa, *ifaddrs;
+       struct sockaddr_in *sin;
+       int i;
+
+       if (getifaddrs(&ifaddrs))
+	       return;
+
+       for (ifa = ifaddrs, i = 0; ifa != NULL; ifa = ifa -> ifa_next) {
+	       if (ifa->ifa_addr == NULL || !(ifa->ifa_flags & IFF_UP) ||
+		       !(ifa->ifa_flags & IFF_BROADCAST))
+		       continue;
+
+	       switch(ifa->ifa_addr->sa_family) {
+		       case AF_INET:
+			       sin = (struct sockaddr_in *)ifa->ifa_broadaddr;
+			       bcaddr =  g_slist_append (bcaddr, sin);
+			       i++;
+			       break;
+	       }
+       }
+       freeifaddrs(ifaddrs);
+}
+
+#else
+
+static void
+gdm_chooser_find_bcaddr (void)
+{
 	int i = 0, num;
 	int sock;
 	struct ifconf ifc;
@@ -752,6 +782,7 @@ gdm_chooser_find_bcaddr (void)
 
 	g_free (buf);
 }
+#endif /*__OpenBSD__*/
 
 /* Append multicast address into the list */
 #ifdef ENABLE_IPV6
