diff --git a/config.h.in b/config.h.in index 2965536..9085c8c 100644 --- a/config.h.in +++ b/config.h.in @@ -352,6 +352,9 @@ /* define if you have struct cmsghdr */ #undef HAVE_STRUCT_CMSGHDR +/* define if you have struct in_pktinfo */ +#undef HAVE_STRUCT_IN_PKTINFO + /* define if your struct ip has ip_hl; otherwise assume ip_vhl */ #undef HAVE_STRUCT_IP_IP_HL diff --git a/configure.in b/configure.in index 6488ee8..f1ee52e 100644 --- a/configure.in +++ b/configure.in @@ -1113,6 +1113,19 @@ if test $sc_cv_struct_cmsghdr = yes; then fi AC_MSG_RESULT($sc_cv_struct_cmsghdr) +dnl check for struct in_pktinfo +AC_MSG_CHECKING(for struct in_pktinfo) +AC_CACHE_VAL(sc_cv_struct_in_pktinfo, +[AC_TRY_COMPILE([#include +#include +#include ],[struct in_pktinfo s;], +[sc_cv_struct_in_pktinfo=yes], +[sc_cv_struct_in_pktinfo=no])]) +if test $sc_cv_struct_in_pktinfo = yes; then + AC_DEFINE(HAVE_STRUCT_IN_PKTINFO) +fi +AC_MSG_RESULT($sc_cv_struct_in_pktinfo) + dnl check for ip_hl in struct ip AC_MSG_CHECKING(for struct ip.ip_hl) AC_CACHE_VAL(sc_cv_struct_ip_ip_hl, diff --git a/xio-ip.c b/xio-ip.c index 34d25cc..365f066 100644 --- a/xio-ip.c +++ b/xio-ip.c @@ -467,7 +467,7 @@ int xiolog_ancillary_ip(struct cmsghdr *cmsg, int *num, xiodump(CMSG_DATA(cmsg), msglen, valbuff, vallen, 0); return STAT_OK; #if WITH_IP4 -#ifdef IP_PKTINFO +#if defined(IP_PKTINFO) && HAVE_STRUCT_IN_PKTINFO case IP_PKTINFO: { struct in_pktinfo *pktinfo = (struct in_pktinfo *)CMSG_DATA(cmsg); *num = 3; @@ -481,7 +481,7 @@ int xiolog_ancillary_ip(struct cmsghdr *cmsg, int *num, inet4addr_info(ntohl(pktinfo->ipi_addr.s_addr), scratch3, sizeof(scratch3))); } return STAT_OK; -#endif /* IP_PKTINFO */ +#endif /* defined(IP_PKTINFO) && HAVE_STRUCT_IN_PKTINFO */ #endif /* WITH_IP4 */ #ifdef IP_RECVERR case IP_RECVERR: {