Commit Graph

51 Commits

Author SHA1 Message Date
guy
625ce5e12d Add -Wpointer-arith to the list of warnings we enable with GCC. 2005-11-08 02:59:40 +00:00
guy
e549a22820 Use pcap_dump_ftell() rather than casting a pcap_dumper_t * to a FILE *
and using ftell(); that won't necessarily work on Windows (if libpcap
was built with a different version of the C runtime library than tcpdump
is), and, even on UN*X, would break if a pcap_dumper_t * were ever made
something other than a FILE *.

Provide a pcap_dump_ftell() implementation that does that cheating cast
for use if libpcap doesn't have it (a pcap_dumper_t * is just a FILE *
on those older versions of libpcap).
2005-06-03 22:08:51 +00:00
guy
674ca18295 Fix to work with autoconf 2.59. 2005-06-03 21:36:41 +00:00
guy
d4290ae435 AC_TRY_COMPILE works only for code that fits inside "main()"; the test
for __attribute__ doesn't fit inside "main()" with GCC 4.0, as it
defines a function.
2005-04-21 03:50:29 +00:00
guy
d26090f659 Put back AC_LBL_C_INLINE; it turns out that wasn't the cause of the
inline problem, and AC_LBL_C_INLINE checks for a case that some versions
of the HP C compiler don't handle, and only uses inline if that case
succeeds.
2005-04-21 02:21:47 +00:00
guy
caf503e482 From Albert Chin:
1. aclocal.m4 patch required by Tru64 UNIX which has
     inttypes.h in a non-standard location so gcc cannot find
     the PRI types. So, use <sys/bitypes.h> to get u_int#_t
     types for help detecting %llx, etc.
  2. Help gcc on aix find ether_ntohost declaration.
2005-04-20 09:49:52 +00:00
guy
e1db53eeb7 From Albert Chin:
1. On AIX, AC_LBL_C_INLINE detected the compiler supported
     the inline keyword which is wrong. AC_C_INLINE from
     autoconf-2.59 worked.
  2. AC_CHECK_TYPE from autoconf-2.5x is no longer broken.
     Replaced AC_LBL_CHECK_TYPE with it, mainly to use
     <sys/bitypes.h> for Tru64 UNIX where some of the u_int#_t
     types are defined.
  3. Tru64 UNIX 4.0D doesn't support %llx; however, it does support %lx.
  4. Added <stdint.h> to interface.h for int#_t types on
     Tru64 UNIX 4.0D (required for missing/snprintf.c).
  5. Reworked includes in tcpdump-stdinc.h for int#_t types.
2005-04-20 09:44:30 +00:00
guy
b2eeaa3e02 When testing whether "inline" works, use the V_CCOPT flags, because some
of those might disable inlining; otherwise, the test for inlining will
succeed, but inlining won't work with the options we're using when
compiling.
2005-03-27 03:31:01 +00:00
guy
faf8160c18 Second stage of adding support for 64-bit integral data types - this
causes the configure script to attempt to define the PRI[doux]64 macros
if they're not defined by including <inttypes.h>, and causes
"missing/bittypes.h" to attempt to define them, if undefined, in a
fashion that should, with any luck, work on MSVC++ and various flavors
of GNU C on Windows.

Fix the spelling of "Mac OS X".
2004-04-17 08:44:49 +00:00
guy
1875b8ffe1 First stage of adding support for 64-bit integral data types - this
causes "int64_t" and "u_int64_t" to be defined by the configure script,
and causes "missing/bittypes.h" to attempt to define "u_int64_t" in a
fashion that should, with any luck, work on MSVC++ and various flavors
of GNU C on Windows.
2004-04-17 04:33:16 +00:00
guy
e4e20350aa AC_LIBOBJ takes the name of an object file without the extension (as the
extension is platform-dependent).
2004-01-31 05:26:50 +00:00
guy
b0aae8584b Autoconf 2.5x won't let you modify LIBOBJS directly; use AC_LIBOBJ to
modify it.

AC_LIBOBJ isn't supported by pre-2.50 autoconf; require 2.50.

2.5x apparently does quoting, or dnl, or something differently from
2.13; fix AC_EGREP_CPP calls.
2004-01-14 03:14:29 +00:00
guy
0cf35b497d Print both the name and the description of a link-layer type (the name
isn't always very suggestive - for example, somebody might think
"EN10MB" is always 10 MB/s, and might not know that "IEEE802" is Token
Ring), using "pcap_datalink_val_to_description()".  Supply our own
"pcap_datalink_val_to_description()" if libpcap doesn't have it (even if
it has "pcap_datalink_name_to_val()").
2003-11-18 23:09:42 +00:00
guy
2683dab266 From Brian Ginsbach: add the Cray NV1 CPU to the list of CPUs that don't
support unaligned accesses.
2003-11-16 09:44:20 +00:00
guy
bbc1cfa669 Have the configure script arrange that the Makefile define _U_
appropriately, and that GNUmakefile and the MSVC++ project file define
it apppriately, as we do with libpcap, rather than defining it in
"interface.h".

Undo the rcsid-shuffling and addition of extra #includes, as we no
longer need to arrange that "interface.h" be included before using _U_
in an RCS ID or copyright.
2003-11-16 09:36:07 +00:00
guy
8f34a01034 Check whether we have "pcap_breakloop()", and use it if we do - it's a
safer way to terminate "pcap_loop()" in a signal handler (it just sets a
flag, it doesn't muck with data structures that might have been in the
middle of being updated).

Have "setsignal()" not request SA_RESTART, so that if we call
"pcap_breakloop()" in a signal handler and then return, we don't restart
a call that was waiting for captured packets, we just make that call
EINTR out.
2003-11-04 07:29:15 +00:00
guy
e49c5476b9 Quote "$d" when testing it in "AC_LBL_LIBPCAP", so that if it's empty -
i.e., if no extraneous pcap header directory is found when using an
installed libpcap - we don't die.
2003-05-02 08:41:01 +00:00
guy
423dfbff62 "if ! {command}" works in the Almquist shell (as used by FreeBSD), and
is also documented to work in Bash, but is not documented to work in the
real Bourne shell, and doesn't appear to work in the real Bourne shell.
Don't use it.
2003-05-01 21:20:52 +00:00
guy
f3fa4cfd2d From Paul Mundt <lethal@linux-sh.org>: add SuperH to the list of CPUs
where we wire in the idea that it can't handle unaligned accesses.  (I
don't know why the test program doesn't work - but perhaps the test
program is the wrong answer anyway, as it doesn't work when
cross-compiling.)
2003-03-28 08:36:34 +00:00
guy
79dbf39ec6 Check for libpcap in directories under $srcdir, so that if you're
doing the compile in a directory other than the source directory, by
using the "--srcdir=" option, it finds libpcap if it's in a directory at
the same level as the tcpdump source directory or in a libpcap
subdirectory of that directory.
2003-03-13 08:04:25 +00:00
guy
b85e959f16 On AIX, we have to link with "-lodm" and "-lcfg", as libpcap now uses
routines from those libraries on AIX (in order to load the BPF driver
and create the BPF devices).
2003-02-12 10:17:08 +00:00
guy
9aa840d2d3 Use AC_CHECK_FUNC, not AC_CHECK_LIB, to look for
"pcap_list_datalinks()", "pcap_set_datalink()", and
"pcap_datalink_name_to_val()" in the version of libpcap we're using -
AC_CHECK_LIB can't check the local version, if that's what we're using,
but AC_CHECK_FUNC can (it just uses the current LIBS setting).
2003-01-11 20:51:41 +00:00
guy
6076158547 NetBSD support for multiple data link types on an interface, from David
Young <dyoung@ojctech.com>, with some minor changes by Jason R. Thorpe
<thorpej@netbsd.org>, and further changes by me to:

	use "-y" rather than "-D" to set the link type ("-D" was already
	taken);

	use libpcap APIs to map between data link type names and values;

	supply stub versions of missing-but-needed libpcap APIs.

Update Jason Thorpe's e-mail address (Zembu is going away, if it hasn't
done so already).
2002-12-19 09:27:54 +00:00
guy
c284d10cf4 If we're not using a local libpcap, check to see whether "pcap.h" is
hidden in a "pcap" subdirectory of "/usr/include" or
"/usr/local/include" and, if so, add a "-I" flag to search in that
subdirectory, so we manage to find "pcap.h", as Red Hat decided to
"improve" things by putting "pcap.h" in "/usr/include/pcap" (that's
probably where libpcap should have put it originally, but moving it now
just breaks source compatibility).
2002-12-17 09:55:14 +00:00
guy
c422d3ab0f Get rid of the "-Wno-unused" flag, and fix up most of the
unused-parameter problems reported by GCC.  Add an _U_ tag to label
parameters as unused if the function is called through a pointer (so
that you can't change its signature by removing parameters) or if there
are unused parameters only because the function isn't complete.

Add some additional bounds checks the necessity for which was revealed
while cleaning up unused-parameter problems.

Make some routines static.

"lcp_print()", defined in "print-lcp.c", isn't called anywhere -
"print-ppp.c" has the code to dissect LCP.  Get rid of "print-lcp.c".
2002-09-05 21:25:34 +00:00
guy
edb0e92cdc Add a few more GCC warnings on GCC >= 2 for ".devel" builds.
From Neil T. Spring: fixes for many of those warnings:

	addrtoname.c, configure.in: Linux needs netinet/ether.h for
	ether_ntohost

	print-*.c: change char *foo = "bar" to const char *foo = "bar"
	to appease -Wwrite-strings; should affect no run-time behavior.

	print-*.c: make some variables unsigned.

	print-bgp.c: plen ('prefix len') is unsigned, no reason to
	validate by comparing to zero.

	print-cnfp.c, print-rx.c: use intoa, provided by addrtoname,
	instead of inet_ntoa.

	print-domain.c: unsigned int l; (l=foo()) < 0 is guaranteed to
	be false, so check for (u_int)-1, which represents failure,
	explicitly.

	print-isakmp.c: complete initialization of attrmap objects.

	print-lwres.c: "if(x); print foo;" seemed much more likely to be
	intended to be "if(x) { print foo; }".

	print-smb.c: complete initialization of some structures.

In addition, add some fixes for the signed vs. unsigned comparison
warnings:

	extract.h: cast the result of the byte-extraction-and-combining,
	as, at least for the 16-bit version, C's integral promotions
	will turn "u_int16_t" into "int" if there are other "int"s
	nearby.

	print-*.c: make some more variables unsigned, or add casts to an
	unsigned type of signed values known not to be negative, or add
	casts to "int" of unsigned values known to fit in an "int", and
	make other changes needed to handle the aforementioned variables
	now being unsigned.

	print-isakmp.c: clean up the handling of error/status indicators
	in notify messages.

	print-ppp.c: get rid of a check that an unsigned quantity is >=
	0.

	print-radius.c: clean up some of the bounds checking.

	print-smb.c: extract the word count into a "u_int" to avoid the
	aforementioned problems with C's integral promotions.

	print-snmp.c: change a check that an unsigned variable is >= 0
	to a check that it's != 0.

Also, fix some formats to use "%u" rather than "%d" for unsigned
quantities.
2002-09-05 00:00:07 +00:00
guy
72898542e5 Explain why "AC_LBL_CHECK_LIB" isn't used any more. 2002-08-04 21:20:29 +00:00
guy
0431ce571f Note that "AC_LBL_CHECK_LIB" isn't used any more. 2002-08-03 22:32:36 +00:00
guy
03cfed6821 Make static the structure to which the test program checking what to use
for "inlines", so that we don't get tripped up by compilers complaining
that we're returning a pointer to an automatic variable.
2002-07-13 09:36:36 +00:00
guy
84dbd61af9 Fix up AC_LBL_C_INLINE to put all of the test code into the "inlines"
section - the other section gets stuck in the middle of "main()", and,
although GCC lets you define functions inside functions, other C
compilers don't.

Pick a name more likely to be unique to use as the iterator variable in
AC_LBL_C_INLINE.

Make AC_LBL_C_INLINE print "no" rather than "not supported" if inline
isn't supported, to match what AC_C_INLINE does.
2002-07-02 02:22:36 +00:00
guy
cb0c77819f Put variables in quotes when testing them in "test" commands, so that
the test doesn't get a syntax error if the variable isn't set or is set
to a null string.
2002-06-29 04:24:25 +00:00
guy
b1263c69c5 Some versions of the HP C compiler can handle inlines, but not if they
return a structure pointer.  Check whether the C compiler can handle
inline functions that return a structure pointer, not whether they can
handle inline functions that return an int, as at least some versions of
autoconf's AC_C_INLINE do.
2002-06-28 10:45:40 +00:00
guy
c51ad6a636 Nobody seemed to know why we preferred sigset() to sigaction(); the
latter is a POSIX standard, and you don't have to include some
additional header file to get it declared, so we'll prefer the it.
2002-04-24 06:34:18 +00:00
guy
ea54ca7605 Replace "target_cpu", "target_os", and AC_CANONICAL_SYSTEM with
"host_cpu", "host_os", and AC_CANONICAL_HOST, as per Maciej W.
Rozycki's patch.
2001-12-10 08:41:15 +00:00
guy
2566537526 From Maciej W. Rozycki <macro@ds2.pg.gda.pl>: treat all MIPS and SPARC
platforms as always requiring strict alignment, rather than doing
configure-time testing with a sample program.
2001-11-25 02:26:34 +00:00
mcr
dc985bea39 fixed quoting of [] in m4 file 2001-10-08 17:31:44 +00:00
mcr
2cbc8130c0 patch to pcap.h search routine. 2001-10-08 17:18:51 +00:00
fenner
83106450bc Don't turn on massive debugging by default. 2001-10-08 16:43:44 +00:00
fenner
d57c77a1ed Don't include <net/ethernet.h> when checking for buggy ether_ntohost.
Don't check for getipnodebyname(), since we don't use it.
Use AC_SEARCH_LIBS instead of AC_CHECK_LIB for -lnsl, so that it
 doesn't get included when not needed.
Redo AC_LBL_LIBRARY_NET to use AC_SEARCH_LIBS extensively.
2001-10-08 16:17:02 +00:00
torsten
35d5f3e9cd Added ia64 to the list of systems were unaligned memory accesses fail.
In fact they don't fail but generate kernel warnings on Linux and
probably performance suffers as well. See also http://bugs.debian.org/112154
2001-09-14 08:11:33 +00:00
guy
5494ba2282 Fix indentation. 2001-01-02 22:18:27 +00:00
guy
9c1c90781a The current "config.guess" may give different Alpha processors different
names, e.g. "alphaev56", rather than just "alpha", so, in
"AC_LBL_UNALIGNED_ACCESS", we should check for "alpha*", rather than
"alpha", in our test for platforms we *know* shouldn't do unaligned
accesses (Digital^H^H^H^H^H^H^HTru64 UNIX, by default, may just catch
the alignment trap, complain on the console, and then simulate the
unaligned access, but that's slow - and, in one test, didn't appear to
prevent all the faults from unaligned accesses).
2000-09-19 04:01:25 +00:00
assar
4bfc434ed7 use a more liberal regular expression when looking for matching libpcap 2000-07-30 10:53:20 +00:00
assar
c292559287 add arm to the list of cpus that dislike unaligned access. apparently
it does something weird with them.  from cgd@netbsd.org (Chris G. Demetriou)
2000-06-10 14:17:38 +00:00
assar
0deef60390 (AC_C___ATTRIBUTE__): add 2000-04-01 12:09:13 +00:00
itojun
b9947fc471 split checks for struct addrinfo and NI_xxx.
From: Juergen Schoenwaelder <schoenw@ibr.cs.tu-bs.de>
2000-01-21 04:06:17 +00:00
itojun
70fbff8d34 HP-UX 10.20 build fix <http://www.sics.se/~assar/tcpdump_patches/13>
#ifdef h_errno, snprintf -> sprintf, arpa/inet.h for [hn]to[hn][sl]
1999-10-30 23:45:50 +00:00
itojun
b8037ee961 - 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
1999-10-30 07:36:34 +00:00
itojun
c9d84d15c5 Bring in KAME IPv6 tcpdump. replaces esp/ah/isakmp decoder.
Hope I did not break anything.  Portability on IPv4-only node needs checking,
I'll do this very soon.  (sorry for rather jumbo commit)

XXx what is _FAVOR_BSD?
1999-10-30 05:11:06 +00:00
mcr
f718fc9973 Patches from Assar Westerlund <assar@sics.se> to permit building in different directories 1999-10-09 23:57:18 +00:00