summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 217ab3e)
raw | patch | inline | side by side (parent: 217ab3e)
author | Florian Forster <octo@crystal.wlan.home.verplant.org> | |
Wed, 7 Feb 2007 12:58:23 +0000 (13:58 +0100) | ||
committer | Florian Forster <octo@crystal.wlan.home.verplant.org> | |
Wed, 7 Feb 2007 12:58:23 +0000 (13:58 +0100) |
configure.in | patch | blob | history | |
src/utils_dns.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index 760c91845d36905cc95901039165b22ab0f09e3a..a15be25788ac5f28c709cfe42b0702ba466baad1 100644 (file)
--- a/configure.in
+++ b/configure.in
@@ -452,6 +452,21 @@ AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_p
#include <linux/netdevice.h>
])
+# [AC_DEFINE(HAVE_STRUCT_UDPHDR_BSD, 1, [Define if struct udphdr exists and is the BSD variant.])],
+AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport],
+ [], [],
+ [
+ #include <sys/types.h>
+ #include <netinet/udp.h>
+ ])
+# [AC_DEFINE(HAVE_STRUCT_UDPHDR_GNU, 1, [Define if struct udphdr exists and is the GNU variant.])],
+AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source],
+ [], [],
+ [
+ #include <sys/types.h>
+ #include <netinet/udp.h>
+ ])
+
AC_MSG_CHECKING([for kernel type ($host_os)])
case $host_os in
*linux*)
diff --git a/src/utils_dns.c b/src/utils_dns.c
index 89c03203f6bc2a4916a15722ab3f1048b170acfd..a6643bbf2774e72041b9ba7a891bc84571a65713 100644 (file)
--- a/src/utils_dns.c
+++ b/src/utils_dns.c
# define PPP_CONTROL_VAL 0x03 /* The control byte value */
#endif
-#ifndef __FAVOR_BSD
-#define uh_sport source
-#define uh_dport dest
+#if HAVE_STRUCT_UDPHDR_UH_DPORT && HAVE_STRUCT_UDPHDR_UH_SPORT
+# define UDP_DEST uh_dport
+# define UDP_SRC uh_dport
+#elif HAVE_STRUCT_UDPHDR_DEST && HAVE_STRUCT_UDPHDR_SOURCE
+# define UDP_DEST dest
+# define UDP_SRC source
+#else
+# error "`struct udphdr' is unusable."
#endif
#include "utils_dns.h"
const struct in6_addr *d_addr)
{
char buf[PCAP_SNAPLEN];
- if ((ntohs (udp->uh_dport) != 53)
- && (ntohs (udp->uh_sport) != 53))
+ if ((ntohs (udp->UDP_DEST) != 53)
+ && (ntohs (udp->UDP_SRC) != 53))
return 0;
memcpy(buf, udp + 1, len - sizeof(*udp));
if (0 == handle_dns(buf, len - sizeof(*udp), s_addr, d_addr))