From b0aea56b51603b34d526bbfb94fed2ae0976fb0f Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 15 Mar 2007 14:07:41 +0000 Subject: [PATCH] Fixed bug #969: Fixed compiltation errors on OpenBSD 4.0. --- configure.ac | 42 +++++++++++++++++++++++------------------- ziffy/hooks.c | 11 ++++++++--- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac index ee19ae4..122f1d0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl YAZ Toolkit, Index Data 1995-2007 dnl See the file LICENSE for details. -dnl $Id: configure.ac,v 1.67 2007-03-07 08:54:13 adam Exp $ +dnl $Id: configure.ac,v 1.68 2007-03-15 14:07:41 adam Exp $ AC_PREREQ(2.59) AC_INIT([yaz],[2.1.53],[yaz-help@indexdata.dk]) AC_CONFIG_SRCDIR(configure.ac) @@ -23,14 +23,17 @@ YAZ_DOC dnl dnl dnl ------ Headers -AC_CHECK_HEADERS([dirent.h fnmatch.h wchar.h locale.h langinfo.h pwd.h unistd.h sys/select.h sys/socket.h sys/stat.h sys/time.h sys/times.h sys/types.h sys/un.h sys/wait.h netinet/in.h netdb.h arpa/inet.h netinet/tcp.h netinet/in_systm.h]) -AC_CHECK_HEADERS([netinet/if_ether.h],[],[],[ +AC_CHECK_HEADERS([dirent.h fnmatch.h wchar.h locale.h langinfo.h pwd.h unistd.h sys/select.h sys/socket.h sys/stat.h sys/time.h sys/times.h sys/types.h sys/un.h sys/wait.h netdb.h arpa/inet.h netinet/tcp.h netinet/in_systm.h]) +AC_CHECK_HEADERS([net/if.h netinet/in.h netinet/if_ether.h],[],[],[ #if HAVE_SYS_TYPES_H #include #endif #if HAVE_SYS_SOCKET_H #include #endif + #if HAVE_NET_IF_H + #include + #endif #if HAVE_NETINET_IN_H #include #endif @@ -176,6 +179,7 @@ if test "$with_iconv" != "no"; then fi dnl ------ libpcap / ziffy +echo "ether_h = ${ac_cv_header_netinet_if_ether_h}" AC_SUBST(ZIFFY_PROG) AC_SUBST(PCAP_LIBS) AC_SUBST(PCAP_CFLAGS) @@ -184,28 +188,28 @@ AC_ARG_WITH(pcap, [ --with-pcap[=DIR] libpcap root dir located in (dir) AC_MSG_CHECKING([for libpcap (required for ziffy)]) if test "${PCAP_DIR}" != "no"; then - if test "${PCAP_DIR}" != "yes" && test "${PCAP_DIR}" != "default"; then + if test "${ac_cv_header_netinet_if_ether_h}" = "no"; then + : + elif test "${PCAP_DIR}" != "yes" && test "${PCAP_DIR}" != "default"; then if test -r $PCAP_DIR/libpcap.a && test -r $PCAP_DIR/pcap.h; then PCAP_DIR="$PCAP_DIR" PCAP_LIBS="${LIBS} -L$PCAP_DIR -lpcap" PCAP_CFLAGS="${INCS} -I$PCAP_DIR" ZIFFY_PROG=ziffy fi - else - if test -d /usr/local && - test -r /usr/local/lib/libpcap.a && - test -r /usr/local/include/pcap.h; then - PCAP_DIR="/usr/local" - PCAP_LIBS="${LIBS} -L$PCAP_DIR/lib -lpcap" - PCAP_CFLAGS="${INCS} -I$PCAP_DIR/include" - ZIFFY_PROG=ziffy - elif test -d /usr && - test -r /usr/lib/libpcap.a && - test -r /usr/include/pcap.h; then - PCAP_DIR="/usr" - PCAP_LIBS="${LIBS} -lpcap" - ZIFFY_PROG=ziffy - fi + elif test -d /usr/local && + test -r /usr/local/lib/libpcap.a && + test -r /usr/local/include/pcap.h; then + PCAP_DIR="/usr/local" + PCAP_LIBS="${LIBS} -L$PCAP_DIR/lib -lpcap" + PCAP_CFLAGS="${INCS} -I$PCAP_DIR/include" + ZIFFY_PROG=ziffy + elif test -d /usr && + test -r /usr/lib/libpcap.a && + test -r /usr/include/pcap.h; then + PCAP_DIR="/usr" + PCAP_LIBS="${LIBS} -lpcap" + ZIFFY_PROG=ziffy fi fi if test -z "$ZIFFY_PROG"; then diff --git a/ziffy/hooks.c b/ziffy/hooks.c index 7645f74..cec5e50 100644 --- a/ziffy/hooks.c +++ b/ziffy/hooks.c @@ -36,10 +36,15 @@ #include #include -#include #include +#if HAVE_NET_IF_H #include +#endif + +#if HAVE_NETINET_IN_H +#include +#endif #if HAVE_NETINET_IF_ETHER_H #include @@ -210,9 +215,9 @@ z3950apdu * pduhook (const struct pcap_pkthdr * h, const u_char * p) printf ("ETHER: Total size = %d : header = %d : data = %d\n", eth_size, eth_hlen, eth_size - eth_hlen), printf ("ETHER: Source = %s\n", - etheraddr_string (dlt == DLT_NULL ? NULL : (char *) & e -> ether_shost)), + etheraddr_string (dlt == DLT_NULL ? NULL : (u_char *) & e -> ether_shost)), printf ("ETHER: Destination = %s\n", - etheraddr_string (dlt == DLT_NULL ? NULL : (char *) & e -> ether_dhost)), + etheraddr_string (dlt == DLT_NULL ? NULL : (u_char *) & e -> ether_dhost)), fflush (stdout), fmemdmp (stdout, (char *) e, eth_size, "Ethernet Packet"); -- 1.7.10.4