]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
OSX 10.9 now has IP_PKTINFO 1510/head
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Sat, 5 Jul 2014 13:51:05 +0000 (15:51 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Sat, 5 Jul 2014 13:51:05 +0000 (15:51 +0200)
pdns/nameserver.cc

index 008844ee38ba334256bb4e6d601b1735606f6a5c..98ce853ccc05895aa11fce7d066a0dddeb31200d 100644 (file)
@@ -81,10 +81,9 @@ extern StatBag S;
     The main() of PowerDNS can be found in receiver.cc - start reading there for further insights into the operation of the nameserver
 */
 
-#ifdef IP_PKTINFO
+#if defined(IP_PKTINFO)
   #define GEN_IP_PKTINFO IP_PKTINFO
-#endif
-#ifdef IP_RECVDSTADDR
+#elif defined(IP_RECVDSTADDR)
   #define GEN_IP_PKTINFO IP_RECVDSTADDR 
 #endif
 
@@ -337,15 +336,14 @@ static bool HarvestDestinationAddress(struct msghdr* msgh, ComboAddress* destina
   memset(destination, 0, sizeof(*destination));
   struct cmsghdr *cmsg;
   for (cmsg = CMSG_FIRSTHDR(msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(msgh,cmsg)) {
-#ifdef IP_PKTINFO
+#if defined(IP_PKTINFO)
      if ((cmsg->cmsg_level == IPPROTO_IP) && (cmsg->cmsg_type == IP_PKTINFO)) {
         struct in_pktinfo *i = (struct in_pktinfo *) CMSG_DATA(cmsg);
         destination->sin4.sin_addr = i->ipi_addr;
         destination->sin4.sin_family = AF_INET;
         return true;
     }
-#endif
-#ifdef IP_RECVDSTADDR
+#elif defined(IP_RECVDSTADDR)
     if ((cmsg->cmsg_level == IPPROTO_IP) && (cmsg->cmsg_type == IP_RECVDSTADDR)) {
       struct in_addr *i = (struct in_addr *) CMSG_DATA(cmsg);
       destination->sin4.sin_addr = *i;