Commit Graph

44 Commits

Author SHA1 Message Date
Hannes Gredler
a0275861d3 modularize ip6 nextlayer checksum generation and
change tcp6 and pim6 to use it.
2009-10-12 10:16:58 +02:00
hannes
26b97700bf add support for PIMv2 checksum verification, Null Register messages and Register Flag resolution 2006-02-13 01:31:35 +00:00
hannes
67eb31b994 code cosmetics:
at places where the entity to print / or increment
  shares the semantics of an IPv4 or IPv6 address
  use sizeof(in_addr) and sizeof(in6_addr),
  rather than a hardcoded 4 or 16
2005-07-11 20:15:31 +00:00
guy
002a7752d0 Get rid of an unused variable. (It should be possible to tell the type
of address from the way it's printed.)
2005-04-20 22:08:27 +00:00
guy
1dc1256f0e Add a comment asking about the address and mask length fields in
join/prune requests.
2005-04-20 22:05:08 +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
hannes
18c020c000 -display cosmetics: make the output more conistent:
- consistent use of length field (not payload-len)
 - no message type number given in PIM/OSPF printers

as those changes affect only verbose mode and/or
routing protocols we hope not to break existing scripts;
2004-09-29 16:49:31 +00:00
guy
c37418ccbc Add bounds checks. 2004-03-24 02:51:10 +00:00
hannes
5c77a341d4 provide multiline output for PIM Joins/Grafts/Graft-Acks 2004-03-18 14:12:18 +00:00
hannes
a408761e83 make PIMv2 use tok2str(), change to multiline output 2003-12-15 13:15:25 +00:00
guy
259cb9ad02 Add missing bounds checking to the DVMRP and PIM print routines.
Instead of checking that there are 8 bytes available at the beginning of
an IGMP packet - which there might not be, e.g. with some DVMRP packets
- do the checks as necessary before fetching values.
2003-11-19 09:42:04 +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
itojun
0b314a0fc8 my address list option, from suz@kame.net 2003-10-29 02:07:57 +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
guy
c03b15431e From Pavlin Radoslavov <pavlin@icir.org>: print the PIM "LAN Prune
Delay" option.
2002-10-19 02:43:04 +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
itojun
111ff8a61d whitespace cleanup 2002-06-11 17:08:37 +00:00
fenner
7395945540 Handle old DR-priority and old Bidir-capable option values. 2002-05-07 18:28:38 +00:00
fenner
f7297f584b Update location of auto-RP spec.
Print reserved fields if they're non-zero.
2001-07-04 21:36:15 +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
fenner
b3794ce8b7 Parse State-Refresh Hello option properly. 2001-05-11 02:12:32 +00:00
fenner
339f6a65b2 Don't print multiple lines for a single packet unless -vv 2001-05-10 05:30:20 +00:00
fenner
525194da30 Update PIM Hello options with IANA-registered values. 2001-04-27 02:18:27 +00:00
itojun
6e8c0f9cc8 style 2001-01-28 08:27:28 +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
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
fenner
1c332d9947 Set frpcnt to the right value.
Submitted by:	Ravi Puvvala <ravi@iprg.nokia.com>
2000-08-17 18:38:24 +00:00
itojun
c9c414df15 style. s/switch(/switch (/. 2000-04-24 12:59:39 +00:00
fenner
ef2875607d Fix nybble-order bug: version is top, type is bottom.
Make sure to print "pim" in front of the PIM version.
Reduce ep to the end of the IP packet if we captured some padding.
2000-02-16 21:49:23 +00:00
itojun
5ad0c5d0f5 remove unnecessary header files. 2000-01-19 04:58:09 +00:00
itojun
d8b8acfc78 fix pim printing. type/version field is 4bit+4bit in 8bit.
- using u_int for this bitfield would make them occupy 32bits.
- use of char as bitfield type is illegal either
so I've avoided use of bitfield (use mask and shift).
2000-01-19 04:57:12 +00:00
fenner
46f2e90662 Updated PIMv2 parser:
- include RFC2117-style address formats
- parse more Hello options
- parse the Prune-Refresh packet type
- use standard truncation checks
- use EXTRACT_* macros to handle unaligned data access
- Don't print the netmask if it's all bits on
1999-12-14 16:58:03 +00:00
fenner
814765d31c Enhanced PIMv1 support.
Cisco Auto-RP support.
1999-11-22 07:25:26 +00:00
fenner
b9ac23ce92 Switch to config.h instead of passing defines in DEFS. 1999-11-21 09:36:43 +00:00
itojun
7ac4698a8b corrected offset check and calculation for the RP holdtime and
priority fields of Bootstraps.

(sync with KAME)
1999-11-17 14:58:13 +00:00
assar
bf782e5566 fixes to make ansi-pedantic compilers happier. no char types for bit fields and minor type correctness 1999-11-17 04:14: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
f6fa6a40d4 patches to help build on Linux 2.2 1999-10-17 21:37:10 +00:00
mcr
f555c163f9 Initial revision 1999-10-07 23:47:09 +00:00