Paul Wouters 5bc930
--- a/config.h.in	
Paul Wouters 5bc930
+++ a/config.h.in	
Paul Wouters 5bc930
@@ -308,6 +308,9 @@ 
Paul Wouters 5bc930
 /* define if your struct sigaction has sa_sigaction */
Paul Wouters 5bc930
 #undef HAVE_STRUCT_SIGACTION_SA_SIGACTION
Paul Wouters 5bc930
 
Paul Wouters 5bc930
+/* define if you have struct sock_extended_err */
Paul Wouters 5bc930
+#undef HAVE_STRUCT_SOCK_EXTENDED_ERR
Paul Wouters 5bc930
+
Paul Wouters 5bc930
 /* Define if your struct termios has component c_ispeed */
Paul Wouters 5bc930
 #undef HAVE_TERMIOS_ISPEED
Paul Wouters 5bc930
 
Paul Wouters 5bc930
--- a/configure.in	
Paul Wouters 5bc930
+++ a/configure.in	
Paul Wouters 5bc930
@@ -80,7 +80,8 @@ AC_HEADER_RESOLV()
Paul Wouters 5bc930
 AC_CHECK_HEADERS(termios.h linux/if_tun.h)
Paul Wouters 5bc930
 AC_CHECK_HEADERS(net/if_dl.h)
Paul Wouters 5bc930
 AC_CHECK_HEADERS(linux/types.h)
Paul Wouters 5bc930
-AC_CHECK_HEADER(linux/errqueue.h, AC_DEFINE(HAVE_LINUX_ERRQUEUE_H), [], [#include <linux/types.h>])
Paul Wouters 5bc930
+AC_CHECK_HEADER(linux/errqueue.h, AC_DEFINE(HAVE_LINUX_ERRQUEUE_H), [], [#include <sys/time.h>
Paul Wouters 5bc930
+#include <linux/types.h>])
Paul Wouters 5bc930
 AC_CHECK_HEADERS(sys/utsname.h sys/select.h sys/file.h)
Paul Wouters 5bc930
 AC_CHECK_HEADERS(util.h bsd/libutil.h libutil.h sys/stropts.h regex.h)
Paul Wouters 5bc930
 AC_CHECK_HEADERS(linux/fs.h linux/ext2_fs.h)
Paul Wouters 5bc930
@@ -915,6 +916,22 @@ if test $sc_cv_type_sa_family_t = yes; then
Paul Wouters 5bc930
 fi
Paul Wouters 5bc930
 AC_MSG_RESULT($sc_cv_type_sa_family_t)
Paul Wouters 5bc930
 
Paul Wouters 5bc930
+AC_MSG_CHECKING(for struct sock_extended_err)
Paul Wouters 5bc930
+AC_CACHE_VAL(sc_cv_struct_sock_extended_err,
Paul Wouters 5bc930
+[AC_TRY_COMPILE([#include <linux/types.h>
Paul Wouters 5bc930
+#if TIME_WITH_SYS_TIME
Paul Wouters 5bc930
+#include <sys/time.h>
Paul Wouters 5bc930
+#endif
Paul Wouters 5bc930
+#if HAVE_LINUX_ERRQUEUE_H
Paul Wouters 5bc930
+#include <linux/errqueue.h>
Paul Wouters 5bc930
+#endif],[struct sock_extended_err s;],
Paul Wouters 5bc930
+[sc_cv_struct_sock_extended_err=yes],
Paul Wouters 5bc930
+[sc_cv_struct_sock_extended_err=no])])
Paul Wouters 5bc930
+if test $sc_cv_struct_sock_extended_err = yes; then
Paul Wouters 5bc930
+   AC_DEFINE(HAVE_STRUCT_SOCK_EXTENDED_ERR)
Paul Wouters 5bc930
+fi
Paul Wouters 5bc930
+AC_MSG_RESULT($sc_cv_struct_sock_extended_err)
Paul Wouters 5bc930
+
Paul Wouters 5bc930
 AC_MSG_CHECKING(for struct sigaction.sa_sigaction)
Paul Wouters 5bc930
 AC_CACHE_VAL(sc_cv_struct_sigaction_sa_sigaction,
Paul Wouters 5bc930
 [AC_TRY_COMPILE([#include <signal.h>],[struct sigaction s;s.sa_sigaction=0;],
Paul Wouters 5bc930
--- a/xio-ip.c	
Paul Wouters 5bc930
+++ a/xio-ip.c	
Paul Wouters 5bc930
@@ -503,7 +503,7 @@ int xiolog_ancillary_ip(struct cmsghdr *cmsg, int *num,
Paul Wouters 5bc930
       return STAT_OK;
Paul Wouters 5bc930
 #endif /* defined(IP_PKTINFO) && HAVE_STRUCT_IN_PKTINFO */
Paul Wouters 5bc930
 #endif /* WITH_IP4 */
Paul Wouters 5bc930
-#ifdef IP_RECVERR
Paul Wouters 5bc930
+#if defined(IP_RECVERR) && HAVE_STRUCT_SOCK_EXTENDED_ERR
Paul Wouters 5bc930
    case IP_RECVERR: {
Paul Wouters 5bc930
       struct sock_extended_err *err =
Paul Wouters 5bc930
 	 (struct sock_extended_err *)CMSG_DATA(cmsg);
Paul Wouters 5bc930
@@ -521,7 +521,7 @@ int xiolog_ancillary_ip(struct cmsghdr *cmsg, int *num,
Paul Wouters 5bc930
 	       err->ee_code, '\0', err->ee_info, '\0', err->ee_data);
Paul Wouters 5bc930
       return STAT_OK;
Paul Wouters 5bc930
    }
Paul Wouters 5bc930
-#endif /* IP_RECVERR */
Paul Wouters 5bc930
+#endif /* defined(IP_RECVERR) && HAVE_STRUCT_SOCK_EXTENDED_ERR */
Paul Wouters 5bc930
 #ifdef IP_RECVIF
Paul Wouters 5bc930
    case IP_RECVIF: {
Paul Wouters 5bc930
       /* spec in FreeBSD: /usr/include/net/if_dl.h */