Commit Graph

57 Commits

Author SHA1 Message Date
Denis Ovsienko
d6af516cbc finalize some previous NDO conversions
Eliminate a number of fputs(), putchar() and fflush() uses. Justify
preprocessor directives. Don't typecast ND_PRINT() to void and fix some
indentation.
2014-03-26 15:49:27 +04:00
Denis Ovsienko
d57e945e5e NDOize EIGRP, ICMP, L2TP, STP and UDP decoders 2014-03-15 23:25:06 +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
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
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
94a4b46080 Go with Wireshark's Internet checksum routine.
The Wireshark routine is based on the BSD in-kernel portable checksum
routine (thus BSD-licensed); it takes a vector of pointers and lengths
and checksums the concatenation of the buffers in question (just as the
BSD in-kernel routine checksums a chain of mbufs).

This simplifies the "with a pseudo-header" checksums; hopefully it'll
fix up the problems being seen on some big-endian platforms, which might
be due to hand-calculating some or all of the checksum and doing so
incorrectly.  It also gets rid of some code that might be dereferencing
unaligned pointers.
2011-06-13 14:08:51 -07:00
guy
d67e2a90f1 Propagate from the x.9 branch:
revision 1.81.2.6
	date: 2007-09-13 17:40:18 +0000;  author: guy;  state: Exp;  lines: +1 -6
	Completely remove that unused "structure".
	----------------------------
	revision 1.81.2.5
	date: 2007-09-13 17:34:20 +0000;  author: gianluca;  state: Exp;  lines: +3 -1
	Commented out a 0-length structure that is not used.
2007-09-13 17:42:31 +00:00
hannes
3a8496e3db squelch compiler warnings 2007-08-09 18:53:26 +00:00
hannes
92d2311423 apply some heuristics to detect MPLS ICMP extension headers because
not all implementations correctly set the length field in the
ICMP header as per draft-bonica-internet-icmp-08.

if the length field is not set then simply check the checksum.
2006-12-12 14:31:51 +00:00
hannes
196bff58cd rework on the ICMP MPLS extension code:
- preserve the snapend pointer as it may get overwritten by calling the IP printer
- protect against infinite loops inside the MPLS extension printer.
- detect present of an MPLS extension header by introducing a length field to the ICMP header
  as per draft-bonica-internet-icmp-08.
2006-12-12 10:48:43 +00:00
hannes
5d53191ea2 print the id field in the echo/echo-reply message 2005-07-01 16:10:02 +00:00
hannes
d763ce820b print the timestamp in the icmp tstamp reply message in human readable form 2005-06-22 13:43:24 +00:00
mcr
4189fb7df6 refactored ip_print() so that chained header parser (ESP/AH) can
more easily call the inner parts.
2005-04-06 21:32:38 +00:00
guy
5561f2117c Add some bounds checking and other sanity checking. 2004-12-23 10:51:47 +00:00
hannes
77523329c3 remove duplicates 2004-06-15 07:43:03 +00:00
hannes
8823045524 only call into ICMP_MPLS_EXT dissector for ICMP TIMXCEDD and UNREACH messages, do some extra header sanity checking 2004-06-15 07:34:22 +00:00
hannes
05913a0700 add support for ICMP MPLS extensions as per draft-bonica-icmp-mpls-02 2004-06-14 15:08:08 +00:00
guy
9bf8133f8d Add bounds checking. 2004-03-24 00:56:11 +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
c90e936060 Add a new "ipproto.h" header file, with definitions of IP protocol type
values.  Use that rather than private definitions in various files.

Add "gmpls.h" to the list of files in FILES, and add it and "ipfc.h" to
the list of files in INSTALL.
2003-06-07 11:57:51 +00:00
hannes
0bda4e776b don't attempt checksumming in ICMP if the packet is a fragment 2003-05-15 16:58:03 +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
itojun
10afb02ac8 put __attribute__((packed)) to packet headers. s/u_short/u_int16_t/ and so
forth while i'm here
2002-11-09 17:19:16 +00:00
risso
3d932490b8 Added support for Win32, based on WinPcap. 2002-08-01 08:52:55 +00:00
guy
8633096f7d From Kevin Steves: handle ICMP_ECHO and ICMP_ECHOREPLY with common code. 2002-07-30 08:15:44 +00:00
guy
fd1ef53ef6 For packets with a bad ICMP checksum, show the bad checksum and what it
should have been.
2002-07-21 21:03:07 +00:00
fenner
fd7a77e3d4 Include the ICMP length 2002-07-05 15:58:20 +00:00
itojun
111ff8a61d whitespace cleanup 2002-06-11 17:08:37 +00:00
guy
4c6bada758 Get rid of unneeded incomplete definitions of "struct mbuf" and "struct
rtentry", and unneded includes of <sys/uio.h>, <sys/file.h>, and
<sys/ioctl.h>.
2002-06-01 23:50:30 +00:00
guy
d6068502c2 From Nathaniel Couper-Noles <Nathaniel@isi1.tccisi.com>: print the
sequence number in ICMP echo requests and replies.
2001-10-27 07:21:34 +00:00
fenner
cb36c76c6f Fix description of ICMP_REDIRECT_TOSHOST to say "host" and not "net". 2001-07-24 16:56:11 +00:00
itojun
c0937b0b98 backout 1.60 2001-07-19 19:37:31 +00:00
itojun
07fd1db95f no real need to pass char * to printf format string. 2001-06-28 19:53:42 +00:00
fenner
a11713da52 Remove #if 0 sections
Finish converting over to having the caller print the IP address
 (except for UDP, TCP and SCTP).  This consists mostly of removing
 places where the IP address is printed, both in the big "case"
 in ip_print() and in the individual printers.
Also fix a couple of spacing bugs.
2001-06-15 22:17:31 +00:00
itojun
f3022fbcbc style 2001-01-28 09:52:47 +00:00
guy
afdea7aeac The infinite diversity of UNIX platforms is an eternal source of joy.
On some platforms (e.g., Solaris 2.5.1 and 2.6, at least), you have to
include <netdb.h> to get MAXHOSTNAMELEN defined, including <sys/param.h>
doesn't do it (on others, <netdb.h> doesn't help, and you have to
include <sys/param.h>.

Include <netdb.h> in some files, but, for "timed.h", just use 256 rather
than MAXHOSTNAMELEN - the Berkeley time daemon protocol spec (in the
timed source directory in various BSDs) says the packet includes "A
zero-terminated string of up to 256 ASCII characters with the name of
the machine sending the message."
2000-10-10 05:03:32 +00:00
itojun
535dd007b3 some sprintf fixes, from kris@freebsd.org (patches@tcpdump.org #89)
pedant.
2000-10-05 04:10:00 +00:00
guy
4dcccc8aba Use "u_int8_t", "u_int16_t", and "u_int32_t" rather than "u_char",
"u_short", and "u_int".
2000-10-03 09:30:37 +00:00
itojun
fb75d3cd5a always use u_intXX_t for protocol format declaration. char/short/int may not
come with exact size.  while at it, correct signedness of ip/udp header field.
nuke most of the use of bitfield.
TODO: bitfield in namser.h
2000-10-03 02:54:54 +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
8b67f77134 Get rid of unneeded includes of <net/if.h>. 2000-09-28 06:42:55 +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
guy
7b50febe28 Add "tcp.h" and "udp.h" headers, to declare the TCP and UDP stuff needed
by dissectors, and have dissectors include them rather than
<netinet/udp.h>, <netinet/udp_var.h>, or <netinet/tcp.h>, if they
actually need that stuff.

Remove all unnecessary includes of <netinet/udp*.h> or <netinet/tcp*.h>
files.
2000-09-23 08:26:30 +00:00
guy
e894092542 Add definitions of Ethernet types from
"linux-includes/netinet/if_ether.h" to "ethertype.h".

Move other stuff used by dissectors from <netinet/if_ether.h> to
"ether.h", along the lines of "fddi.h" and "token.h".

Move ARP declarations from BSD include files to "print-arp.c".

Remove from dissectors includes of <netinet/if_ether.h>, and add
includes of "ethertype.h" and/or "ether.h" as necessary.

Get rid of configuration options that test declarations now made in
"ether.h" or "print-arp.c", as those declarations are now under our
control, not the OS's control.
2000-09-23 08:03:27 +00:00
assar
3cd171317f remove non-STDC code 2000-07-01 03:38:59 +00:00
assar
21db1cb110 add printing of timestamp request and reply. From Frank Volf
<volf@oasis.IAEhv.nl>
2000-06-10 13:41:19 +00:00
assar
117d3b0966 (icmp_print): step through all advertised routers for a router
advertisement.  From <aandres@mfom.es>
2000-05-15 00:59:41 +00:00
itojun
69eb95b8e3 random cleanups. add some parens for clarity. 2000-04-28 11:46:11 +00:00