Index: ext/posix/sys/socket.c
--- ext/posix/sys/socket.c.orig	2016-02-27 15:12:24.000000000 +0100
+++ ext/posix/sys/socket.c	2016-03-06 23:19:27.232511812 +0100
@@ -30,6 +30,7 @@
 #if HAVE_LINUX_NETLINK_H
 #include <linux/netlink.h>
 #endif
+#include <sys/types.h>
 #include <sys/socket.h>		/* Needs to be before net/if.h on OpenBSD 5.6 */
 #ifdef HAVE_NET_IF_H
 #include <net/if.h>
@@ -37,8 +38,13 @@
 #include <netdb.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
+#if 0
 #include <netinet/udp.h>
+#endif
 #include <sys/un.h>
+#if !defined(PF_UNSPEC) && defined(AF_UNSPEC)
+#define PF_UNSPEC AF_UNSPEC
+#endif
 
 /* strlcpy() implementation for non-BSD based Unices.
    strlcpy() is a safer less error-prone replacement for strncpy(). */
