Commit Graph

85 Commits

Author SHA1 Message Date
Guy Harris
e462b975e2 Clean up handling of -g and -O flags.
AC_PROG_CC adds -g and -O2 to CFLAGS if you're using GCC; don't bother
adding either of them, or -O, ourselves if we're using GCC.

Add -O for all non-GCC compilers.
2013-10-17 16:50:43 -07:00
Guy Harris
a6c16ed8ab Fix build issues with the OpenFlow printer on some systems.
Don't assume we have <stdint.h>.  Instead, use the AC_TYPE_ macros to
ensure we have the C99 intN_t and uintN_t types; we already include
<inttypes.h> in tcpdump-stdinc.h iff we have it.

Get rid of the structure declarations in openflow-1.0.h, as they have
zero-length arrays (not supported by all the compilers people might be
using) and as

	1) they're only used in sizeof()

and

	2) after each one there's an assertion to check that sizeof()
returns a specific numerical value

so, instead, just #define various _LEN items to those numerical values
and use them.

Add an openflow.h header with a #define for the length of the basic
header, and move the declaration of of10_header_body_print() there.
2013-06-23 14:03:38 -07:00
Guy Harris
94bf5a24bf Avoid some warnings from Sun C.
Some versions of Sun C support __attribute__ but don't support the
"unused" or "format" attributes - they don't fail, but they whine a lot.
They also support the "noreturn" attribute, but don't allow it to be
applied to function pointers, only to functions.

Check whether they can be used without warnings, and use them only if
they can.
2013-06-22 14:06:33 -07:00
Guy Harris
a332503d7d Get rid of acconfig.h. 2013-05-12 15:28:28 -07:00
Guy Harris
985ad5e359 Require autoconf 2.61 as a minimum, and eliminate stuff that does for you.
autoconf 2.61 and later do, in AC_PROG_CC, tests to figure out how to
beat non-GCC compilers into doing the closest thing to ANSI C of which
they're capable, so we don't need to do them ourselves.
2013-05-12 12:35:43 -07:00
Guy Harris
9daf436721 Handle systems with getrpcbynumber() but no header file for it.
Glibc 2.14 doesn't install the ONC RPC headers, but it installs the ONC
RPC routines, presumably for binary compatibility.  Don't use
getrpcbynumber() unless we have it *and* the header file to declare it.
2011-09-02 21:31:09 -07:00
Guy Harris
687b442022 Get rid of unnecessary configure script tests and missing/XXX.h headers.
This also fixes configure-script problems on OSes that have IPv6 support
but don't have <netinet6/in6.h> - no standard I could find requires that
header for IPv6 support (the Single UNIX Specification speaks of
<netinet/in.h> for both IPv4 and IPv6, and RFCs 2292 and 3542 don't
mention <netinet6/in6.h>, just <netinet/in.h> and <netinet6/ip6.h>).
2011-02-01 02:08:41 -08:00
Guy Harris
d8252d0c05 Add support for nommu systems.
Rather than hardcode the WIN32 define, add proper fork checks to the
configure script and check those.  This fixes building for nommu systems
which lack the fork function.

While we're here though, add support for this functionality via vfork
so that it does work on nommu systems.  And fix an old bug where we
exit properly in the forked child when the exec failed instead of just
returning to the calling code (which isn't expecting it).

Reviewed-By: Guy Harris <guy@alum.mit.edu>
2010-11-30 16:18:32 -08:00
Guy Harris
a20a6126fc Add support for setting the time stamp type for a capture.
Based on a patch from Scott Mcmillan <scott.a.mcmillan@intel.com>.

While we're at it, make some error messages a bit less geeky.
2010-08-22 17:32:26 -07:00
Guy Harris
e97d5ed3c2 Add a comment to the AC_DEFINE for _SUN, matching what we do in libpcap. 2010-04-16 03:31:33 -07:00
Guy Harris
9b2d37151d Don't define any of the SIZEOF_ values. 2010-04-04 13:41:27 -07:00
Guy Harris
ce952c7dc4 Get rid of some autoconf macros not used, or no longer used, with
tcpdump.

Check whether __attribute__((format)) can be applied to function
pointers and, if not, don't apply it to function pointers; some older
versions of GCC appear to support applying it to functions, but not
pointers to functions.

As we've gotten rid of missing/getaddrinfo.c, don't use it.
2009-07-08 01:22:27 -07:00
Guy Harris
9076e3c01a Add a comment to the AC_DEFINE call for const, just as we did for
libpcap; that eliminates the need to list it in acconfig.h, so get rid
of that.
2009-07-02 19:28:34 -07:00
Guy Harris
0491b33dc0 Expand another AC_DEFINE comment. 2009-07-02 19:01:20 -07:00
Guy Harris
4cf4925027 Pick up some AC_DEFINE comments from libpcap's aclocal.m4.
Remove unused items, and items for which we now have AC_DEFINE() calls
that supply a comment, from acconfig.h.

Note that a host OS that matches "osf*" is assumed to be DEC
OSF1/Digital UNIX/Tru64 UNIX.
2009-07-02 18:59:24 -07:00
Guy Harris
2c28d8f466 From Bert Vermeulen: add a USB printer, and fix the error message
printed when trying to print packets for a DLT_ for which we don't have
a printer to indicate that you can still save to a capture file in that
case.  (Slightly changed not to require DLT_USB_LINUX_MMAPPED to be
defined, for older libpcaps that only define DLT_USB_LINUX.)
2009-04-04 12:30:27 -07:00
guy
2fa88fe1a3 We support building tcpdump with versions of libpcap other than the one
with which it was released, and DLT_BLUETOOTH_HCI_H4_WITH_PHDR might be
defined by pcap-bpf.h without pcap/bluetooth.h being present (as appears
to be the case on Fedora 9, for example), so check whether
<pcap/bluetooth.h> is usable.

Update a comment - F9 appears to have a "/usr/include/pcap.h" if you
install the libpcap headers.

When adding -I flags when running a compiler-based test, add them to
CPPFLAGS, not CFLAGS - the latter doesn't work right with
AC_CHECK_HEADERS, as the "gcc -E" run doesn't have the -I flags added.
2008-09-25 21:45:50 +00:00
guy
bca64a2755 Use the new libpcap API's if available; that means we can support "-B"
on all platforms in that case.  Also, add a "-I" flag to turn on monitor
mode.
2008-04-04 19:42:11 +00:00
guy
411c7e7f10 Run ranlib on libnetdissect.a if necessary. Remove it before building
it, so we discard any stuff already in the archive.
2008-02-04 20:42:09 +00:00
guy
7e5e89df69 From Max Laier: check whether the system has <net/pfvar.h> and:
if it does, use that for the pf definitions;

	if it doesn't, don't compile in pf support;

as both OpenBSD and FreeBSD have changed the pf definitions and header
format without changing the DLT value, so you can't reliably read
pflog-format libpcap files on a machine running an OS version other than
the one on which the file was generated.
2007-09-12 19:36:18 +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
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
794a52c42c Some systems (*cough*Irix*cough) not only don't declare
"ether_ntohost()" but don't even declare "struct ether_addr"; on those
systems, declare "struct ether_addr".
2005-04-20 11:17:18 +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
969f75a107 Fix a typo.
Don't bother checking whether ether_ntohost() is declared if it exists
but is buggy so we won't be using it.
2005-03-27 22:44:22 +00:00
guy
0b6991cfd5 Do the same sort of checks whether ether_ntohost() is declared that we
do in libpcap for ether_hostton().  Include <netinet/ether.h> only if it
declares ether_ntohost().  If nothing declares it, declare it ourselves,
as we do in libpcap.

Don't cast the second argument to ether_ntohost() to a const pointer, as
some systems don't modify it but don't declare that argument as a const
pointer.  (This is similar to what we do on libpvap for
ether_hostton().)

Fix indentation.
2005-03-27 22:38:09 +00:00
guy
128d636bc2 Regenerate. 2004-12-27 01:15:06 +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
fenner
3f07fce716 Regenerate. 2004-03-23 18:59:23 +00:00
guy
5f9a33d806 Regenerate. 2004-03-11 23:53:33 +00:00
guy
ea83407f9f Regenerate. 2004-01-26 00:51:31 +00:00
guy
d88193ac89 From Gisle Vanem:
When saving to a file with "-w", have the "-v" flag make tcpdump
	report, every 10 seconds, the number of packets captured.

	Include <smi.h> if we're building with libsmi, to declare
	"smiInit()" and "smiLoadModule()".
2004-01-15 19:53:48 +00:00
guy
c8e5cd1da7 Regenerate with autoconf 2.57. 2004-01-14 03:15:08 +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
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
71c6fb6191 Regenerate. 2003-08-06 04:51:23 +00:00
itojun
37cba74a72 regen 2003-07-17 13:45:33 +00:00
guy
8f758e65ff Use AC_TRY_LINK, not AC_TRY_COMPILE, when looking for
inet_ntop/inet_pton/inet_aton, and don't use AC_REPLACE_FUNCS to set
LIBOBJS to include the replacement module, as that does the full check
for the routine again, not just the simple replacement.

Move the tests in question after AC_LBL_LIBPCAP, so that we link with
the appropriate libraries (e.g., "-lsocket -lnsl" on Solaris) to use
when using those routines.
2003-05-02 08:48:25 +00:00
guy
24f5540899 From Gisle Vanem: make print-esp.c work with more (maybe all?) OpenSSL
versions, and changes to make it work on DOS/Windows with various
compilers and C support libraries.
2003-03-02 23:19:33 +00:00
guy
0f4f08e620 Use "pcap_lib_version()" to get the libpcap version number if it's
available in the libpcap we're using.
2003-02-11 07:41:52 +00:00
guy
b8e2c3bead From Andrew Brown <atatat@atatdot.net>: add a "-U" flag, which causes
the output stream for "-w" to be flushed after each packet is dumped.

Add checks for "pcap_dump_flush()", and only enable the "-U" flag if
it's present.  Clean up the handling of the "getopt()" argument and the
usage message to get rid of the pile of #ifdefs.

Add documentation for the "-L" and "-y" flags.

Tweak the description of "-r" to properly format "-w" in the text.
2002-12-22 00:15:26 +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
5c9aea35c4 We're using int8_t now, so we need to declare it ourselves if the OS
header files don't do so for us.
2002-12-11 05:00:05 +00:00
guy
c2bfaa8575 Check for "pcap_version" in libpcap in the configure scripts; apparently
the libpcap that comes with some platforms doesn't define it.

Check for "pcap_debug" and "yydebug" in libpcap in the configure
scripts, so that whichever one is present (which might depend on whether
libpcap was built with standard YACC or Berkeley YACC/Bison), if any is
present, will be used by the "-Y" flag (if none is present, "-Y" won't
be supported).
2002-09-05 01:31:41 +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
04333b4868 Check for "pcap_findalldevs()" in libpcap in the configuration script;
only use it if we find it.

Define DHAVE_PCAP_FINDALLDEVS in the Windows GNU Makefile and project
file, as WinPcap has "pcap_findalldevs()".
2002-08-03 22:37:01 +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
6aa353579f From Maciej W. Rozycki <macro@ds2.pg.gda.pl>:
Here is a patch that addresses a few SSL-related issues noticed:

	1. The "/usr" directory is not the best choice to start looking
	   for SSL libraries when cross-compiling.  The patch adds
	   "/usr/${host_alias}" at the front.  Actually the test is quite
	   bogus anyway -- there might be no libcrypto.a library at all
	   (but e.g. libcrypto.so), so a better approach would be trying to
	   link against -lcrypto and seeing if that works.  First with no
	   additional options (it might be in the default compiler/linker's
	   search patch, like on sane systems), then with the -L<dir>
	option.

	2. The "cast.h" and "rc5.h" headers should include the
	   "openssl/" path as that is what is used throughout the code.
	   Right now they are simply not found by configure.

	3. The buggy CAST128 test should use a cache variable to permit
	   overriding by an educated user.

	I think I may actually rewrite the test as described in #1 above
	one day, but my time is quite limited and tcpdump is not my
	priority task, so it might not happen soon.  I won't mind if
	someone does it earlier.
2002-04-07 02:16:03 +00:00
guy
0c39e2bdaa From Maciej W. Rozycki <macro@ds2.pg.gda.pl>:
DECnet support currently assumes certain conditions instead of
	checking for them explicitly.  The following code checks if
	dnet_htoa() is available, possibly in libdnet and also verifies
	there is no declaration for the function in <netdnet/dnetdb.h>
	before it decides to provide a substitute.
2002-04-07 02:09:04 +00:00