Commit Graph

99 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
c1c3c77463 Printers must include 'netdissect.h', not 'interface.h' 2015-09-05 23:35:58 +02:00
Guy Harris
486704db7c Avoid collison with error(), clean up code a bit.
Rename the variable to "error_status", as that's what it represents, and
as that doesn't collide with the error() function.  Don't set it and
then not use the resulting value.
2015-08-31 16:57:07 -07:00
Francois-Xavier Le Bail
b1c65c20a7 Fix warnings as "declaration of 'x' shadows a previous local" 2015-07-12 20:32:35 +02:00
Guy Harris
69cb46af91 Fix a bunch of de-constifications. 2015-04-26 17:24:42 -07:00
Denis Ovsienko
38700c7f24 dismiss NETDISSECT_REWORKED macro
The purpose of this macro was to enable the file-by-file switch to NDO,
after which only tcpdump.c had a use of it and the definitions guarded
by it. Update tcpdump.c not to require them any more and dismiss the
unused definitions.
2015-03-22 10:06:15 +00:00
Guy Harris
37a4aa82a9 Clean up configure check for libsmi.
First, check for smi.h.  If we don't have it, don't check for anything
else.

If we do have it, check for libsmi containing smiInit.  If we don't have
it, don't check for anything else.

If we do have it, check, with our test program, whether we can use it.

If that succeeds, prepend -lsmi to LIBS, and set USE_LIBSMI.  Otherwise,
don't do either of those.

Check, in source, *only* for USE_LIBSMI.  If it's set, use libsmi,
otherwise don't - don't even include smi.h, even if we happened to have
found it, and don't print the libsmi version string.
2014-08-31 11:57:04 -07:00
Guy Harris
572d63471c Clean up the first-item handling a bit.
This makes it look a bit more like the handling of other items.
2014-07-08 03:26:18 -07:00
Guy Harris
b6a3595a55 Squelch a Coverity warning.
If you pass in a value of oidlen and oidsize such that we can't store
*anything* into OID, this would be a problem; that *shouldn't* ever
happen, but this makes the code a bit more obviously correct.
2014-07-08 03:23:09 -07:00
Guy Harris
ed85e20e4d u_intN_t is dead, long live uintN_t.
And, as we require at least autoconf 2.61, and as autoconf 2.61 and
later have AC_TYPE_UINTn_T and AC_TYPE_INTn_T macros, we use them to
define the uintN_t and intN_t macros if the system doesn't define them
for us.

This lets us get rid of bitypes.h as well.
2014-04-23 00:20:40 -07:00
Denis Ovsienko
24598ce6b7 NDOize the rest of util.c 2014-04-14 10:53:46 +04:00
Denis Ovsienko
0015471d7d amend previous commit to fix compiling with libsmi 2014-03-30 10:48:43 +04:00
Denis Ovsienko
157d13fe56 NDOize SNMP decoder 2014-03-29 15:39:31 +04:00
Denis Ovsienko
69f6f4392a don't include addrtoname.h needlessly 2014-02-25 17:53:08 +04:00
Guy Harris
3454732513 Do our own isascii(), isprint(), isgraph(), and toascii().
We do *not* want the behavior of isprint() and isgraph() to be
locale-dependent - we want both of them to return "true" only for ASCII
characters.

We have to do our own isascii() and toascii() on non-UN*X systems
anyway, so let's just do all of them ourselves.
2014-02-02 15:17:06 -08:00
Denis Ovsienko
fe3253b9b8 remove tcpdump's own CVS keywords
Remove lots of $Header's and a few $Id's that all belong to the former
CVS repository of tcpdump itself. These keywords have been frozen since
the migration to git in late 2008.
2014-01-03 00:59:08 +04:00
Denis Ovsienko
d8acd8f5d0 make consistent use of the "tstr" idiom
For each decoder that has more than one instance of truncation signaling
and prints the same string in each instance make sure that the string is
declared as "static const char tstr[]" right after the initial includes
block. Where necessary, replace fputs(s, stdout) with equivalent
printf("%s", s).
2013-12-26 18:19:50 +04:00
Denis Ovsienko
d8b3af528a make more array declarations static/const 2013-12-19 14:25:01 +04:00
guy
6191f36146 Add an "fn_printzp()" routine for printing null-padded strings (strings
with a maximum length, where a string shorter than that length is padded
with NULs), as "fn_print()" won't handle the maximum length *and* the
snapshot length and "fn_printn()" won't stop on a null string.  Use it
where appropriate.

Always pass "snapend" to "fn_print()" and "fn_printn()" if they're
passed a pointer into the packet data; only pass NULL if they're being
handed a pointer into a buffer that's not part of the packet data.

Always check the return value of "fn_print()", "fn_printn()", and
"fn_printzp()" if they're passed "snapend", and do the appropriate
string termination and "packet truncated" indication if they return 1.
2005-05-06 07:56:51 +00:00
guy
a03ba28e19 Boost size of buffers so that they can handle a 32-bit integer; from
OpenBSD.
2005-04-18 00:07:31 +00:00
guy
3b42d632cf From Gisle Vanem: fix some signed vs. unsigned and truncation warnings. 2005-01-05 04:05:04 +00:00
guy
72e501f3cf Don't pass in "asn1_parse()" a packet length cut short by the snapshot
length; explicitly check against the snapshot length, instead.

In "asn1_parse()", always check against the length passed in before
fetching anything from the packet.
2004-12-27 22:14:12 +00:00
guy
5750d1c023 From Gisle Vanem: undefine OPAQUE, as it's defined by <wingdi.h>, which
is included if we compile with at least some Windows compilers, and
add a default case to "smi_check_a_range()".
2004-11-04 07:53:56 +00:00
guy
cbb5972bee Enterprise-specific traps have a generic trap number of 6, not 7; thanks
to kin1@sourceforge.net to finding this.
2004-03-23 06:59:15 +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
3824a6c041 From Neil Spring:
use "_U_" in the definitions of "rcsid[]", to eliminate
	complaints about those variables being unused;

	move the definitions after the include of "interface.h", or add
	an include of "interface.h", so that "_U_" is defined.

Include "config.h" before including "tcpdump-stdinc.h" in
"missing/datalinks.c".
2003-11-15 00:39:12 +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
risso
3d932490b8 Added support for Win32, based on WinPcap. 2002-08-01 08:52:55 +00:00
guy
350d1266b6 From Phil Wood <cpw@lanl.gov>: fix the test for a community of "public"
to check the length of the community name before doing a length-limited
comparison.
2002-07-20 23:31:18 +00:00
itojun
111ff8a61d whitespace cleanup 2002-06-11 17:08:37 +00:00
fenner
1b721ed3a1 Fix spacing with -v 2002-05-07 18:27:40 +00:00
guy
6005907268 From Juergen Schoenwaelder <schoenw@ibr.cs.tu-bs.de> - fix for the
following problem:

	According to the ASN.1 documents, OIDs of the form 2.100.3 are
	correctly encoded as 0x0603813403.  tcpdump fails to properly
	decode them - it displays the value 4.20.3 instead of 2.100.3.
2002-05-07 07:39:05 +00:00
fenner
a16302e6bd Update makemib and print-snmp.c license, via OpenBSD: jakob got
update from John LoVerso.
2001-09-17 22:16:52 +00:00
fenner
982b17b225 print "outOfRange" instead of "wrongLength" when an object's value is
out of the range specified by the MIB.
2001-06-15 21:06:59 +00:00
fenner
b720b1080b Juergen's fix for buffer overflow, posted to tcpdump-workers with
Message-Id: <200104231431.QAA25904@henkell.ibr.cs.tu-bs.de>
2001-04-23 19:29:21 +00:00
itojun
cc172ef123 remove "|%.2x" appeared on -v, which seemed purely for debugging. 2001-03-22 02:06:43 +00:00
itojun
c0781576e1 avoid trigraph 2001-03-17 04:41:49 +00:00
fenner
2028db4d8d Get rid of libsmiV1 API compatibility. The configure script already
requires the v2 API, so this attempt at compatibility just caused
 problems.
2001-01-24 21:50:58 +00:00
fenner
2576276449 Some verbose format diffs from Juergen Schoenwaelder 2000-11-10 17:34:10 +00:00
fenner
721bd3430d Update for libsmi v0.2.x . Attempt to retain libsmi v0.1.x compatibility
(but didn't test it).
2000-11-04 22:50:23 +00:00
guy
406f61ca54 Remove erroneous semicolon from "for()" clause; patch from Michael T.
Stolarchuk.
2000-10-06 05:54:50 +00:00
assar
3cd171317f remove non-STDC code 2000-07-01 03:38:59 +00:00
itojun
dff10c7f70 s/sprintf/snprintf/.
there seem to be couple of unsafe use of strcat and strcpy - we should
bring in strl{cat,cpy}.
2000-01-17 06:24:23 +00:00
itojun
c4521bbf47 * print-rt6.c: make IPv6 routing header printing work with new 2292bis
API.
* print-bgp.c: improve options printing.  ugly code exists for
  unaligned option parsing (need some fix).
* const poisoning in SMB decoder.
* make dump format back to original.  someone may want to add an
  option to do ascii printing, but keep the default behavior as is
  for scripts used in many places.
* -Wall -Werror clean checks.
1999-12-22 06:27:19 +00:00
mcr
dee93c3eab From: Juergen Schoenwaelder <schoenw@ibr.cs.tu-bs.de>
Here is a new version of the libsmi patch for tcpdump. It provides
	some bug fixes and some enhancements such as access checking and
	better range checking. The patch also fixed a few bugs in the
	print_snmp.c module of tcpdump itself (unrelated to the usage of
	libsmi).
1999-12-13 18:06:13 +00:00
fenner
b9ac23ce92 Switch to config.h instead of passing defines in DEFS. 1999-11-21 09:36:43 +00:00
mcr
5c4f91da94 compilable AH/ESP patches 1999-10-17 22:18:00 +00:00
mcr
f6fa6a40d4 patches to help build on Linux 2.2 1999-10-17 21:37:10 +00:00
mcr
2373cb681b SNMP v2c patches from http://www.ibr.cs.tu-bs.de/ietf/snmpv3/tcpdump.shtml 1999-10-17 21:12:42 +00:00
mcr
f555c163f9 Initial revision 1999-10-07 23:47:09 +00:00