- enable build outside of the tree

- endian checks (use WORDS_BIGENDIAN)
- fallback def for IPPROTO_{AH,ESP}
- sa_len issues
- do not use bittypes.h, respect AC_LBL_CHECK_TYPES
This commit is contained in:
itojun 1999-10-30 07:36:34 +00:00
parent a68de397e8
commit b8037ee961
8 changed files with 44 additions and 15 deletions

View File

@ -17,7 +17,7 @@
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
# #
# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.210 1999-10-30 05:11:06 itojun Exp $ (LBL) # @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.211 1999-10-30 07:36:34 itojun Exp $ (LBL)
# #
# Various configurable paths (remember to edit Makefile.in, not Makefile) # Various configurable paths (remember to edit Makefile.in, not Makefile)
@ -118,6 +118,8 @@ getaddrinfo.o: $(srcdir)/missing/getaddrinfo.c
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/getaddrinfo.c $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/getaddrinfo.c
version.o: version.c version.o: version.c
$(CC) $(CFLAGS) -c version.c
version.c: $(srcdir)/VERSION version.c: $(srcdir)/VERSION
@rm -f $@ @rm -f $@
sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@ sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@

13
aclocal.m4 vendored
View File

@ -1,4 +1,4 @@
dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.65 1999-10-30 05:11:06 itojun Exp $ (LBL) dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.66 1999-10-30 07:36:35 itojun Exp $ (LBL)
dnl dnl
dnl Copyright (c) 1995, 1996, 1997, 1998 dnl Copyright (c) 1995, 1996, 1997, 1998
dnl The Regents of the University of California. All rights reserved. dnl The Regents of the University of California. All rights reserved.
@ -51,7 +51,7 @@ AC_DEFUN(AC_LBL_C_INIT,
$1="-O" $1="-O"
$2="" $2=""
if test "${srcdir}" != "." ; then if test "${srcdir}" != "." ; then
$2="-I\$\(srcdir\)" $2="-I\$(srcdir)"
fi fi
if test "${CFLAGS+set}" = set; then if test "${CFLAGS+set}" = set; then
LBL_CFLAGS="$CFLAGS" LBL_CFLAGS="$CFLAGS"
@ -200,7 +200,7 @@ AC_DEFUN(AC_LBL_LIBPCAP,
continue; continue;
fi fi
lastdir=$dir lastdir=$dir
if test -r $dir/pcap.c ; then if test -r $dir/libpcap.a ; then
libpcap=$dir/libpcap.a libpcap=$dir/libpcap.a
d=$dir d=$dir
dnl continue and select the last one that exists dnl continue and select the last one that exists
@ -214,7 +214,13 @@ AC_DEFUN(AC_LBL_LIBPCAP,
fi fi
else else
$1=$libpcap $1=$libpcap
if test -r $d/pcap.h; then
$2="-I$d $$2" $2="-I$d $$2"
elif test -r $srcdir/../libpcap/pcap.h; then
$2="-I$d -I$srcdir/../libpcap $$2"
else
AC_MSG_ERROR(cannot find pcap.h, see INSTALL)
fi
AC_MSG_RESULT($libpcap) AC_MSG_RESULT($libpcap)
fi fi
LIBS="$libpcap $LIBS" LIBS="$libpcap $LIBS"
@ -920,6 +926,7 @@ AC_DEFUN(AC_CHECK_AAAA, [
AC_MSG_CHECKING(for AAAA) AC_MSG_CHECKING(for AAAA)
AC_CACHE_VAL($1, AC_CACHE_VAL($1,
AC_TRY_COMPILE([ AC_TRY_COMPILE([
# include <sys/types.h>
# include <arpa/nameser.h>], # include <arpa/nameser.h>],
[int a = T_AAAA], [int a = T_AAAA],
$1=yes, $1=yes,

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
/* YIPS @(#)$Id: isakmp.h,v 1.1 1999-10-30 05:11:09 itojun Exp $ */ /* YIPS @(#)$Id: isakmp.h,v 1.2 1999-10-30 07:36:36 itojun Exp $ */
/* refer to RFC 2408 */ /* refer to RFC 2408 */
@ -101,12 +101,12 @@ struct isakmp {
cookie_t i_ck; /* Initiator Cookie */ cookie_t i_ck; /* Initiator Cookie */
cookie_t r_ck; /* Responder Cookie */ cookie_t r_ck; /* Responder Cookie */
u_int8_t np; /* Next Payload Type */ u_int8_t np; /* Next Payload Type */
#if BYTE_ORDER == LITTLE_ENDIAN #if defined(WORDS_BIGENDIAN) || (defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN))
u_int8_t v_min:4, /* MnVer */
v_maj:4; /* MjVer */
#else
u_int8_t v_maj:4, /* MnVer */ u_int8_t v_maj:4, /* MnVer */
v_min:4; /* MjVer */ v_min:4; /* MjVer */
#else
u_int8_t v_min:4, /* MnVer */
v_maj:4; /* MjVer */
#endif #endif
u_int8_t etype; /* Exchange Type */ u_int8_t etype; /* Exchange Type */
u_int8_t flags; /* Flags */ u_int8_t flags; /* Flags */

View File

@ -65,9 +65,11 @@
#include "cdecl_ext.h" #include "cdecl_ext.h"
#endif #endif
#if 0
#ifndef HAVE_U_INT32_T #ifndef HAVE_U_INT32_T
#include "bittypes.h" #include "bittypes.h"
#endif #endif
#endif
#ifndef HAVE_SOCKADDR_STORAGE #ifndef HAVE_SOCKADDR_STORAGE
#include "sockstorage.h" #include "sockstorage.h"

View File

@ -21,7 +21,7 @@
#ifndef lint #ifndef lint
static const char rcsid[] = static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.71 1999-10-30 05:30:20 itojun Exp $ (LBL)"; "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.72 1999-10-30 07:36:37 itojun Exp $ (LBL)";
#endif #endif
#include <sys/param.h> #include <sys/param.h>
@ -400,6 +400,9 @@ ip_print(register const u_char *bp, register u_int length)
again: again:
switch (nh) { switch (nh) {
#ifndef IPPROTO_AH
#define IPPROTO_AH 51
#endif
case IPPROTO_AH: case IPPROTO_AH:
nh = *cp; nh = *cp;
advance = ah_print(cp, (const u_char *)ip); advance = ah_print(cp, (const u_char *)ip);
@ -407,6 +410,9 @@ again:
len -= advance; len -= advance;
goto again; goto again;
#ifndef IPPROTO_ESP
#define IPPROTO_ESP 50
#endif
case IPPROTO_ESP: case IPPROTO_ESP:
{ {
int enh; int enh;

View File

@ -30,7 +30,7 @@
#ifndef lint #ifndef lint
static const char rcsid[] = static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.5 1999-10-30 05:37:35 itojun Exp $ (LBL)"; "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.6 1999-10-30 07:36:37 itojun Exp $ (LBL)";
#endif #endif
#include <string.h> #include <string.h>
@ -206,11 +206,15 @@ cookie_record(cookie_t *in, const u_char *bp2)
sizeof(cookiecache[ninitiator].raddr)); sizeof(cookiecache[ninitiator].raddr));
sin = (struct sockaddr_in *)&cookiecache[ninitiator].iaddr; sin = (struct sockaddr_in *)&cookiecache[ninitiator].iaddr;
#ifdef HAVE_SOCKADDR_SA_LEN
sin->sin_len = sizeof(struct sockaddr_in); sin->sin_len = sizeof(struct sockaddr_in);
#endif
sin->sin_family = AF_INET; sin->sin_family = AF_INET;
memcpy(&sin->sin_addr, &ip->ip_src, sizeof(ip->ip_src)); memcpy(&sin->sin_addr, &ip->ip_src, sizeof(ip->ip_src));
sin = (struct sockaddr_in *)&cookiecache[ninitiator].raddr; sin = (struct sockaddr_in *)&cookiecache[ninitiator].raddr;
#ifdef HAVE_SOCKADDR_SA_LEN
sin->sin_len = sizeof(struct sockaddr_in); sin->sin_len = sizeof(struct sockaddr_in);
#endif
sin->sin_family = AF_INET; sin->sin_family = AF_INET;
memcpy(&sin->sin_addr, &ip->ip_dst, sizeof(ip->ip_dst)); memcpy(&sin->sin_addr, &ip->ip_dst, sizeof(ip->ip_dst));
break; break;
@ -223,11 +227,15 @@ cookie_record(cookie_t *in, const u_char *bp2)
ip6 = (struct ip6_hdr *)bp2; ip6 = (struct ip6_hdr *)bp2;
sin6 = (struct sockaddr_in6 *)&cookiecache[ninitiator].iaddr; sin6 = (struct sockaddr_in6 *)&cookiecache[ninitiator].iaddr;
#ifdef HAVE_SOCKADDR_SA_LEN
sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_len = sizeof(struct sockaddr_in6);
#endif
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
memcpy(&sin6->sin6_addr, &ip6->ip6_src, sizeof(ip6->ip6_src)); memcpy(&sin6->sin6_addr, &ip6->ip6_src, sizeof(ip6->ip6_src));
sin6 = (struct sockaddr_in6 *)&cookiecache[ninitiator].raddr; sin6 = (struct sockaddr_in6 *)&cookiecache[ninitiator].raddr;
#ifdef HAVE_SOCKADDR_SA_LEN
sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_len = sizeof(struct sockaddr_in6);
#endif
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
memcpy(&sin6->sin6_addr, &ip6->ip6_dst, sizeof(ip6->ip6_dst)); memcpy(&sin6->sin6_addr, &ip6->ip6_dst, sizeof(ip6->ip6_dst));
break; break;
@ -259,7 +267,9 @@ cookie_sidecheck(int i, const u_char *bp2, int initiator)
switch (ip->ip_v) { switch (ip->ip_v) {
case 4: case 4:
sin = (struct sockaddr_in *)&ss; sin = (struct sockaddr_in *)&ss;
#ifdef HAVE_SOCKADDR_SA_LEN
sin->sin_len = sizeof(struct sockaddr_in); sin->sin_len = sizeof(struct sockaddr_in);
#endif
sin->sin_family = AF_INET; sin->sin_family = AF_INET;
memcpy(&sin->sin_addr, &ip->ip_src, sizeof(ip->ip_src)); memcpy(&sin->sin_addr, &ip->ip_src, sizeof(ip->ip_src));
break; break;
@ -267,7 +277,9 @@ cookie_sidecheck(int i, const u_char *bp2, int initiator)
case 6: case 6:
ip6 = (struct ip6_hdr *)bp2; ip6 = (struct ip6_hdr *)bp2;
sin6 = (struct sockaddr_in6 *)&ss; sin6 = (struct sockaddr_in6 *)&ss;
#ifdef HAVE_SOCKADDR_SA_LEN
sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_len = sizeof(struct sockaddr_in6);
#endif
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
memcpy(&sin6->sin6_addr, &ip6->ip6_src, sizeof(ip6->ip6_src)); memcpy(&sin6->sin6_addr, &ip6->ip6_src, sizeof(ip6->ip6_src));
break; break;

View File

@ -21,7 +21,7 @@
#ifndef lint #ifndef lint
static const char rcsid[] = static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.9 1999-10-30 05:11:19 itojun Exp $ (LBL)"; "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.10 1999-10-30 07:36:38 itojun Exp $ (LBL)";
#endif #endif
#include <sys/param.h> #include <sys/param.h>
@ -44,7 +44,7 @@ static const char rcsid[] =
#include <netinet6/pim6.h> #include <netinet6/pim6.h>
#else #else
struct pim { struct pim {
#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN) #if defined(WORDS_BIGENDIAN) || (defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN))
u_char pim_type:4, /* the PIM message type, currently they are: u_char pim_type:4, /* the PIM message type, currently they are:
* Hello, Register, Register-Stop, Join/Prune, * Hello, Register, Register-Stop, Join/Prune,
* Bootstrap, Assert, Graft (PIM-DM only), * Bootstrap, Assert, Graft (PIM-DM only),

View File

@ -24,7 +24,7 @@ static const char copyright[] =
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\ "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\
The Regents of the University of California. All rights reserved.\n"; The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] = static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.132 1999-10-30 05:11:23 itojun Exp $ (LBL)"; "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.133 1999-10-30 07:36:39 itojun Exp $ (LBL)";
#endif #endif
/* /*
@ -430,7 +430,7 @@ default_print_unaligned(register const u_char *cp, register u_int length)
putchar('\n'); putchar('\n');
while (nshorts >= 0) { while (nshorts >= 0) {
snprintf(line+20+i*5, 7, "%02x%02x ", cp[0], cp[1]); sprintf(line+20+i*5, "%02x%02x ", cp[0], cp[1]);
if(isprint(cp[0])) { if(isprint(cp[0])) {
line[62+i*2]=cp[0]; line[62+i*2]=cp[0];