swrap: Check if the in_pktinfo structure is available.
authorAndreas Schneider <asn@samba.org>
Tue, 3 Jun 2014 13:01:34 +0000 (15:01 +0200)
committerMichael Adam <obnox@samba.org>
Thu, 5 Jun 2014 21:57:10 +0000 (23:57 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
lib/socket_wrapper/socket_wrapper.c
lib/socket_wrapper/wscript

index f5a7858d5c36bd4e1e1c6cd7ac3aacda2f0ce7ac..56d1d966a0aa32b706d07dd12108f8953c5e2f64 100644 (file)
@@ -3053,7 +3053,7 @@ static int swrap_msghdr_add_pktinfo(struct socket_info *si,
 {
        /* Add packet info */
        switch (si->pktinfo) {
-#ifdef IP_PKTINFO
+#if defined(IP_PKTINFO) && defined(HAVE_STRUCT_IN_PKTINFO)
        case AF_INET: {
                struct sockaddr_in *sin;
                struct in_pktinfo pkt;
index 53dace41db61e3cabe6f8d13d5ce42d832df648c..60b4ca89d1ce54f90e2a87248f20c75530e89300 100644 (file)
@@ -48,6 +48,11 @@ def configure(conf):
                                     headers='sys/types.h sys/socket.h',
                                     define='HAVE_STRUCT_MSGHDR_MSG_CONTROL')
 
+        conf.CHECK_STRUCTURE_MEMBER('struct in_pktinfo',
+                                    'ipi_addr',
+                                    headers='sys/types.h sys/socket.h netinet/in.h',
+                                    define='HAVE_STRUCT_IN_PKTINFO')
+
         conf.CHECK_STRUCTURE_MEMBER('struct in6_pktinfo',
                                     'ipi6_addr',
                                     headers='sys/types.h sys/socket.h netinet/in.h',