Commit Graph

37 Commits

Author SHA1 Message Date
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
f149d769de Split the OSPFv3 header and bodies into separate structures.
Some compilers appear to put some padding before the ospf6_un union, so
the OSPFv3 packets aren't dissected correctly.  Pull the members of
that union into separate structures, and find the pointer to the OSPFv6
body by adding the header length to the pointer to the beginning of the
header.
2014-05-01 19:48:10 -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
Guy Harris
20ecf8fafe Squelch a Coverity warning.
Make the lsa_p_prefix field as large as the largest possible prefix, so
that Coverity doesn't complain about going past the end of an array.
2014-04-18 17:43:09 -07:00
Denis Ovsienko
50905f4d0a OSPFv3: fix SEGV on SPARCv9 (concurs with 8f6bca3)
This bug arose on the OpenCSW build farm:

    ospf3_auth-vv                 : TEST FAILED

Dagobert Michelsen had helped to use the farm servers to debug.
2014-04-11 13:18:20 +04:00
Guy Harris
1cde6435df Netdissectify the to-name resolution routines.
Have them take a netdissect_options * argument, and get the "no name
resolution" flag from it.

Move the declaration of dnaddr_string to addrtoname.h, along with the
other XXX-to-string routines.
2014-04-04 00:43:46 -07:00
Denis Ovsienko
2b753f8058 NDOize DECnet, OSPF and TCP decoders 2014-04-02 14:24:56 +04:00
Denis Ovsienko
b46194277a spell "%s" format strings (complements 708a68a)
Make "%s" format string always reside in the print function call
explicitly such that the reader doesn't have to assess its safety.
2014-03-31 15:43:22 +04:00
Denis Ovsienko
c91ffeae22 NDOize OSPFv3 decoder 2014-03-27 10:21:14 +04: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
Michael Richardson
ad7a38341c Merge branch 'master' of git+ssh://bpf.tcpdump.org/tcpdump/master/git/tcpdump
Conflicts:
	enc.h
2014-01-01 21:32:05 -05:00
Michael Richardson
ac910c086e ndo-ize print-ascii: hex_print_with_offset() 2014-01-01 21:31:18 -05:00
Michael Richardson
a97fb2f3ae whitespace changes 2014-01-01 21:31:18 -05:00
Guy Harris
27d428c0a1 Pull a bunch of headers into the only source file that includes them.
For headers included in only one source file, put the header contents in
the source file in question, and get rid of a bunch of stuff from the
header not used in the source file.
2013-12-30 22:52:15 -08:00
Denis Ovsienko
35c5cd9911 OSPFv3: add crypto authentication (RFC6506) support
* Update ospf6_print() to distinguish packet length and OSPFv3 data
  length.
* Fix ospf6_print_lshdr(), ospf6_print_lsa() and ospf6_decode_v3() to
  print the variable-sized part of DBDesc, LS-Upd and LS-Ack packets
  with the declared length of the OSPFv3 data in mind.
* Implement as little LLS decoding in ospf6_print_lls() as necessary to
  indicate and skip an LLS data block.
* Implement normal AT decoding in ospf6_decode_at().
* Add ospf6_decode_v3_trailer() to couple the above with ospf6_print().

This commit doesn't include a sample capture as the only existing RFC6506
implementation is not yet ready to serve as a reference.
2013-12-29 18:02:29 +04:00
Denis Ovsienko
47cd247bea OSPFv3: fix more minor issues
* Add 3 more LS types and the M6-bit.
* Print multicast LS type and prefix option as deprecated.
* Remove needless forward declarations.
* Make ospf6_decode_v3() consider vflag for every packet type and raise
  the margin from "> 0" to "> 1" because it is already "> 0" that far.
* Fix a message to refer to packet type instead of LS type.
* Remove irrelevant comment.
* Don't print unknown protocol version 2nd time.
2013-12-28 13:01:58 +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
ae1fdebb64 OSPFv3: refresh options and flags 2013-12-23 21:04:46 +04:00
Denis Ovsienko
7de355927b justify declarations of struct tok arrays
Make sure all of them are declared const and most of them -- static.
Proper declaration of token arrays is a common review point for new code
that is based on existing decoders. Thus fix the issue at its root.
2013-09-24 20:54:03 +04:00
Guy Harris
a16fe011b1 Use __inline with MSVC for all source files. 2013-06-09 18:05:37 -07:00
Guy Harris
36b75f7121 Redo length checks in ospf6_print_lsa().
Check to make sure we haven't run past the end of the LSA by doing
length checks - and be a bit fussier about length checks.  Do more
end-of-packet checks as well.
2011-10-13 21:59:57 -07:00
guy
d7da1619b5 Cast "sizeof" to a "u_int"; it's not guaranteed to be "int" in size (it
could be "long", for example, and probably *is* "long" on LP64
platforms), so you can't print it with "%u", but, in this particular
case, it's going to fit in a 32-bit quantity.
2006-09-13 06:31:11 +00:00
hannes
603d00791c -rework the OSPFv3 printer:
-share the grace and TE LSA printer with the OSPFv2 printer
 -change to multiple line output (behind vflag)
 -unambiguate datastructures such that the OSPFv3 printer can
  include OSPFv2 header files.
2006-09-05 15:50:26 +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
3c252e8be0 Fix up some errors from the previous checkin.
Fix up some const and unsigned issues.

Make static some routines unused outside the file in which they're
defined.
2002-12-11 22:29:21 +00:00
guy
fcc82f451d The "__attribute__((packed))" tag on structures causes some files not to
compile with Sun C, as "interface.h" isn't being included before the
structures are being declared.

Furthermore, in the files that Sun C *can* compile, it doesn't cause Sun
C to generate code that's safe with unaligned accesses, as
"__attribute__" is defined as a do-nothing macro with compilers that
don't support it.

Therefore, we get rid of that tag on the structures to which it was
added, and instead use "EXTRACT_16BIT()" and "EXTRACT_32BIT()" to fetch
16-bit and 32-bit big-endian quantities from packets.  We also fix some
other references to multi-byte quantities to get rid of code that tries
to do unaligned loads on platforms that don't support them.

We also throw in a hack that makes those macros use
"__attribute__((packed))" on structures containing only one 16-bit or
32-bit integer to get the compiler to generate unaligned-safe code
rather than doing it by hand.  (GCC on SPARC produces the same code that
doing it by hand does; I don't know if GCC on any other big-endian
strict-alignment processor generates better code for that case.  On
little-endian processors, as "ntohs()" and "ntohl()" might be functions,
that might actually produce worse code.)

Fix some places to use "%u" rather than "%d" to print unsigned
quantities.
2002-12-11 07:13:49 +00:00
risso
3d932490b8 Added support for Win32, based on WinPcap. 2002-08-01 08:52:55 +00:00
itojun
111ff8a61d whitespace cleanup 2002-06-11 17:08:37 +00:00
fenner
f968977edf Quiet down gcc -Wall 2001-05-09 01:08:03 +00:00
guy
cf53dc05f1 Get rid of includes of <netinet/in_systm.h>, and replace "n_short",
"n_long", and "n_time", defined in that file, with other types.
2000-09-29 04:58:33 +00:00
guy
536f512583 Add an "ip.h" header, to declare the IP stuff needed by dissectors, and
have dissectors include them rather than <netinet/ip.h> or
<netinet/ip_var.h>, if they actually need that stuff.

Put the declarations of the ICMP stuff directly into "print-icmp.c".

Remove all unnecessary includes of <netinet/ip*.h> files.

Copy the byte-order stuff from "nameser.h" into "tcp.h".
2000-09-23 08:54:24 +00:00
itojun
37a7b57f5e correct ospf6 AS external LSA printing.
From: jinmei@kame.net
2000-05-12 13:01:01 +00:00
itojun
6e4415eb9f avoid extra space. 2000-03-15 18:32:09 +00:00
fenner
b9ac23ce92 Switch to config.h instead of passing defines in DEFS. 1999-11-21 09:36:43 +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