Compatibility fixes for NetBSD 5.1.2
authorEmil Mikulic <emikulic@gmail.com>
Mon, 11 Jun 2012 09:33:41 +0000 (19:33 +1000)
committerEmil Mikulic <emikulic@gmail.com>
Mon, 11 Jun 2012 09:42:05 +0000 (19:42 +1000)
decode.c
dns.c

index def8c29..eb09802 100644 (file)
--- a/decode.c
+++ b/decode.c
 #include <string.h>
 #include <unistd.h>
 #include <arpa/inet.h> /* inet_ntoa() */
+#include <net/if.h> /* struct ifreq */
 
 /* need struct ether_header */
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-# include <sys/queue.h>
-# include <net/if.h>
-# include <net/if_arp.h>
+#ifdef __NetBSD__ /* works for NetBSD 5.1.2 */
 # include <netinet/if_ether.h>
 #else
-# ifdef __sun
-#  include <sys/ethernet.h>
-#  define ETHER_HDR_LEN 14
+# ifdef __OpenBSD__
+#  include <sys/queue.h>
+#  include <net/if_arp.h>
+#  include <netinet/if_ether.h>
 # else
-#  ifdef _AIX
-#   include <netinet/if_ether.h>
+#  ifdef __sun
+#   include <sys/ethernet.h>
 #   define ETHER_HDR_LEN 14
 #  else
-#   include <net/ethernet.h>
+#   ifdef _AIX
+#    include <netinet/if_ether.h>
+#    define ETHER_HDR_LEN 14
+#   else
+#    include <net/ethernet.h>
+#   endif
 #  endif
 # endif
 #endif
@@ -58,7 +62,6 @@
 # endif
 #endif
 
-#include <net/if.h> /* struct ifreq */
 #include <netinet/in_systm.h> /* n_long */
 #include <netinet/ip.h> /* struct ip */
 #include <netinet/ip6.h> /* struct ip6_hdr */
diff --git a/dns.c b/dns.c
index e8bdbb4..c89dc1b 100644 (file)
--- a/dns.c
+++ b/dns.c
 #include <string.h>
 #include <unistd.h>
 
+#ifdef __NetBSD__
+# define gethostbyaddr(addr, len, type) \
+         gethostbyaddr((const char *)(addr), len, type)
+#endif
+
 static void dns_main(void) _noreturn_; /* the child process runs this */
 
 #define CHILD 0 /* child process uses this socket */