Commit Graph

225 Commits

Author SHA1 Message Date
fxlb
80d2e0ef55 print-icmp6: remove useless break 2014-02-05 14:46:07 +01:00
Guy Harris
89e2444c8b Don't assume snprintf() returns the number of characters formatted.
On some UN*Xes (such as some versions of HP-UX), it doesn't.
2014-02-02 15:02:33 -08:00
Guy Harris
4552271323 Multi-byte fields are in network byte order; fetch them appropriately. 2014-01-15 12:04:39 -08:00
Guy Harris
a403881e82 Various fixes.
Get rid of zero-length arrays; not all compilers support them.

Get rid of __attribute__((packed)); not all compilers support it, so we
can't depend on it.

Use explicit constants for sizes, just in case some compilers pad
structures.

Add some length checks.

Make some ND_TTEST2 calls ND_TCHECK2 calls instead, so they report
truncation if they fail.

Constify some pointers.
2014-01-08 16:59:07 -08:00
Michael Richardson
5637910a9d RPL: test data and fix for printing DAO messages 2014-01-05 11:38:28 -05:00
Michael Richardson
9df6f2ccb4 make sure that DAOACK option printer gets accurate length, and does not indicate truncated spuriously 2014-01-05 00:20:52 -05:00
Michael Richardson
defc20085e added test case for a DAO-ACK with no options 2014-01-04 23:31:47 -05:00
Michael Richardson
1658db5ec3 added decoding of RPL DAO and DAOACK sub-options 2014-01-04 10:56:41 -05:00
Michael Richardson
2f1714e728 added RPL decode for DAO and DAOACK, refactor out option printer 2014-01-04 10:52:11 -05:00
Michael Richardson
87c7396593 switch rpl_dio_print to use tok2str 2014-01-03 11:13:16 -05:00
Michael Richardson
d823987428 clear up errors from more -W options: disambiguate length variables 2014-01-03 11:04:15 -05:00
Michael Richardson
df9a394126 correct typo in RPL DIO PRF mask.
updated 19-pickdag, as this pcap file now has correct PRF/MOP value to show this fault.
2014-01-02 22:39:14 -05:00
Michael Richardson
585ac3db06 Merge branch 'master' of git+ssh://bpf.tcpdump.org/tcpdump/master/git/tcpdump 2014-01-02 22:07:47 -05:00
Michael Richardson
35e21565de added hexprint of suboptions payload on three -v
move rpl dio print to subfunction to keep it at 80columns
2014-01-02 22:07:38 -05:00
Michael Richardson
82ede46025 updated RPL printer from draft-07 to rfc6550 for DIO message.
Decode the DIO suboptions as well, added new test case
2014-01-02 21:33:26 -05: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
0b7b6192c6 fix a few compiler warnings about prototypes
print-ascii.c needs prototypes of ascii_print(),
hex_and_ascii_print_with_offset() and hex_and_ascii_print().

print-icmp6.c needs prototypes of in_cksum_shouldbe() and ns_nprint().
2014-01-02 16:27:14 +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
Gleb Smirnoff
4aec74ccc4 Fix compilation warnings: set but unused variables. 2013-11-26 00:16:47 +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
Stephane Bortzmeyer
0569b61886 Typo in displayed text 2013-06-19 10:18:17 +02:00
Tillmann Karras
7c73910217 Fix display of MLDv2 queries 2013-01-18 02:23:33 +01:00
Denis Ovsienko
e2eff503d6 fix printing of infinite lifetime in ICMPv6
icmp6_opt_print() in the case of ND_OPT_PREFIX_INFORMATION always
appended "s" (seconds) to the returned string result of get_lifetime(),
which could be either a printed number or the "infinite" word. This
change leaves it up to get_lifetime() to decide if "s" is necessary.
This also improves the ND_OPT_ROUTE_INFO case, where route information
lifetime has the same type and semantics.
2012-06-21 17:14:55 +04:00
Denis Ovsienko
8c31bfcebe add DNSSL (RFC6106) support
The most notable difference between RFC5006 and RFC6106 is the addition
of DNSSL RA option. This commit adds DNSSL handling code to make tcpdump
fully RFC6106-aware. This code has been tested against RA packets
generated by Quagga and radvd.
2012-04-13 16:32:40 +04:00
Denis Ovsienko
91045106fb ND_OPT_ADVINTERVAL is in milliseconds, not seconds
RFC 6275 7.3. New Advertisement Interval Option Format

   Advertisement Interval

      32-bit unsigned integer.  The maximum time, in milliseconds,
      between successive unsolicited Router Advertisement messages sent
      by this router on this network interface.
2011-12-29 20:46:02 +04:00
Guy Harris
879217e502 Handle ICMP6 checksums more like TCP checksums.
Instead of printing the result of icmp6_cksum() if it's non-zero, print
the checksum field value and the value it should have had.  That means
that what we print is the same regardless of whether we're running on a
big-endian or little-endian machine.
2011-06-17 01:17:47 -07:00
Guy Harris
d18bb2331d Use nextproto6_cksum() for XXX-over-IPv6 checksums.
Get rid of duplicated checksums with IPv6 pseudo-headers.
2011-06-17 00:51:47 -07:00
Michael Richardson
3e508b0074 mistype of RPL type codes: off by one. fixed 2010-12-31 12:36:24 -05:00
Michael Richardson
d1088041e2 updated RPL type code to RPL-17 draft
added secure bit
updated single test case
2010-12-31 12:28:43 -05:00
Guy Harris
020b16ec4f Correctly check for various values of the ICMP type field.
clang+llvm warnings pointed out some incorrect code - you can't, in C,
check for multiple values for a variable that way.
2010-08-19 19:23:08 -07:00
Guy Harris
e8b5237589 Don't directly fetch multi-byte integers from packets.
Use the EXTRACT_ macros to extract multi-byte integral values from
packets, rather than just dereferencing pointers into the packet; there
is no guarantee that the packet data will be aligned on the right
boundary, and there is no guarantee that, if they're not, a direct
access will work correctly.
2010-02-21 00:27:00 -08:00
David Horn
2a7e2246c7 RFC 5006 support.
Reviewed-By: Guy Harris <guy@alum.mit.edu>
2010-02-07 14:52:07 -08:00
Guy Harris
b050a1e4e0 Squelch a couple of compiler warnings. 2009-11-27 12:03:25 -08:00
Michael Richardson
1a2cbb1112 initial printing of RPL DIO messages 2009-11-14 22:17:12 -05:00
Michael Richardson
27e7cefadd netdisect converted icmp6_print() 2009-11-14 21:36:05 -05:00
Guy Harris
df3cb44f79 On some platforms we appear to get a warning because dnsname_print() is
declared static and later defined without static.  Define it with
static.
2009-09-21 10:16:14 -07:00
guy
947533a7fc "rr_maxdelay" is a 16-bit field, and "rr_reserved" is a 32-bit field, in
a router renumbering message; process them correctly.
2008-02-05 19:36:13 +00:00
guy
167c740563 From Michael Shields <shields@msrl.com> via Roman Francoise: spelling
fixes.
2005-09-05 09:29:00 +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
dcd2814277 "ipproto.h" uses "struct tok", and "interface.h" defines it; always
include "interface.h" before "ipproto.h".
2005-05-14 00:42:28 +00:00
guy
34d2498d7f Get rid of some extra blanks. 2005-04-25 17:29:51 +00:00
guy
30555e8172 Get rid of, or use, unused variables. 2005-04-20 22:30:53 +00:00
guy
655c706df5 Get rid of unused variables. 2005-04-20 22:18:50 +00:00
hannes
932c88e772 rework the ICMP6 decoder:
-replace private flag printers and replace them with bittok2str()
  -remove some flesh from inline printf() statements make more use of tok2str()
  -option printer gets a multiline output (behind vflag)
   -context hexdump for options
  -replace some u_int32 with u_int8[4] to get around compiler padding issues
2005-01-14 10:41:50 +00:00
guy
20d2f6830e From Shinsuke Suzuki: fix a boundary check, and add some additional
boundary checks.
2004-07-28 19:59:24 +00:00
guy
010fcafbc5 From Shinsuke Suzuki <suz@kame.net>: a patch to sync ICMPv6-Type number
with the current IANA assignment (Apr 13 2004).  It consists of the
following four parts:

	- added inverse-neighbor-discovery (RFC3122)
	- shift MTRACE-related type numbers, since it collides
	  with inverse-neighbor-discovery.
	- added MLDv2 (draft-vida-mld-v2-08.txt)
	- shifted Mobile-IPv6 numbers from interim value to the
	  official one. (draft-ietf-mobile-ipv6-24.txt)
2004-06-16 00:06:28 +00:00
guy
33ede7fbea Add bounds checking. 2004-03-24 00:06:26 +00:00
guy
d3d2f39461 "icmp6_rrenum_print()" doesn't use its "icmp6len" argument (and, as that
just reflects the payload length, the snapshot length has been trimmed
to correspond to it, so it doesn't need to check it merely to avoid
running past the end of the IPv6 payload); get rid of it.

Pass "icmp6_print()" the IPv6 payload length (i.e., the length of the
ICMPv6 packet), rather than having it compre the length itself.

Make the length argument to "icmp6_cksum()" unsigned, to match the value
passed to it.

Fix the lengths passed to "sctp_print()", "tcp_print()", and
"udp_print()" (we update "len" in the header-processing loop to
correspond to the remaining payload, so we just pass it to those
routines).
2003-11-19 01:27:54 +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
e2826164d4 unsigned/signed mixup 2003-10-28 03:16:35 +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
itojun
ba8e54bc85 verify/warn icmpv6 checksum. from jinmei@kame 2003-05-02 08:13:54 +00:00
guy
16b938c9e4 From Kazushi Sugyo: print the sequence number in ICMPv6 echo request and
reply packets.
2003-03-13 07:36:56 +00:00
guy
c243fe7be4 From Kazushi Sugyo: update to draft-ietf-mobileip-ipv6-20. 2003-02-05 02:36:25 +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
guy
a38d83eb90 From Kazushi Sugyo: patches for draft-ietf-mobile-ipv6-18. 2002-09-05 00:52:30 +00:00
guy
79877e90f4 Get rid of some unnecessary includes (<time.h>, <netdb.h>, and <ctype.h>
are included by <tcpdump-stdinc.h>, so we don't have to include them
explicitly; <errno.h> isn't needed by print routines).
2002-08-06 04:42:04 +00:00
risso
3d932490b8 Added support for Win32, based on WinPcap. 2002-08-01 08:52:55 +00:00
guy
86cfeae8ab From Kazushi Sugyo <sugyo@pb.jp.nec.com>:
Here is a patch for draft-ietf-mobileip-ipv6-17.
	- print-mobility.c: Mobility header(MIPv6 defines a new IPv6 protocol)
	  printing
	- added Routing header type 2
	- ICMPv6 Home Agent Address Discovery and Mobile Prefix Sol., Adv.
	  message update
2002-06-27 08:21:39 +00:00
itojun
111ff8a61d whitespace cleanup 2002-06-11 17:08:37 +00:00
itojun
2f3fdf1a15 typo, from openbsd 2002-05-30 22:01:34 +00:00
itojun
f0bcafc716 -Wunused 2002-04-02 02:57:39 +00:00
guy
88937a62d9 Updates from Kazushi Sugyo <sugyo@pb.jp.nec.com> for
draft-ietf-mobileip-ipv6-15.
2002-03-28 10:02:34 +00:00
guy
670490dedc Support for Home Agent Information in ICMPv6, from Kazushi Sugyo
<sugyo@pb.jp.nec.com>.
2001-12-09 05:22:27 +00:00
itojun
ac5533eb9e need string.h 2001-06-27 02:48:43 +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
8346a95c66 move router preference decls into icmp6.h 2001-06-01 23:01:04 +00:00
itojun
5d12078039 sync with 2292bis-02/ND_RA_FLAG_HOME_AGENT 2001-06-01 22:59:45 +00:00
itojun
cc7b519792 reject nd6 opts with bad length 2001-06-01 04:08:57 +00:00
itojun
28230fe9af cleanup. do not use recurse for nd option priting. 2001-06-01 03:49:02 +00:00
itojun
ea3df106b5 decode draft-ietf-ipngwg-router-preference, specific route information.
(note: nd option type 9 is not officially assigned yet)
2001-06-01 03:32:27 +00:00
fenner
339f6a65b2 Don't print multiple lines for a single packet unless -vv 2001-05-10 05:30:20 +00:00
itojun
96920d5c73 support draft-draves-ipngwg-router-selection-01.txt router preference.
from jinmei
2001-05-09 02:43:40 +00:00
fenner
f968977edf Quiet down gcc -Wall 2001-05-09 01:08:03 +00:00
itojun
9f850d29f7 typo in message. from netbsd-current 2001-02-20 01:13:56 +00:00
itojun
a85f215bc4 meet 2292bis-02 for RA option decls 2001-01-28 09:09:36 +00:00
itojun
64a0e95995 sync with 2292bis-02: ND_OPT_ADVINTERVAL 2001-01-28 09:02:14 +00:00
itojun
d10c8baa8b sync RR flag bit name with draft-ietf-ipngwg-rfc2292bis-02.txt. 2001-01-22 02:31:18 +00:00
itojun
f3b1a28284 add mobile-ip6 option handling. patches@tcpdump.org #113
from Timo Koskiahde.
2000-12-13 07:57:04 +00:00
itojun
c237b80b77 simplify case statement 2000-11-12 15:16:16 +00:00
itojun
5243609316 always print router renumber sequence number, even without -v. 2000-11-08 13:03:12 +00:00
itojun
a620483952 print sequence number in router renumber message. 2000-11-08 13:01:37 +00:00
itojun
ce233ff12b rrenum minor tweaks (endian conversion for reserved field printing) 2000-11-08 10:10:59 +00:00
itojun
f91a43ad6c RFC2894 (router renumber) decoding. more to go. 2000-11-08 09:28:43 +00:00
itojun
e35056d284 remove #ifdef no longer necessary (due to inclusion of icmp6.h into tcpdump kit) 2000-11-08 07:03:04 +00:00
itojun
01ebeb4600 no need to check struct defs in netinet/icmp6.h 2000-10-07 05:58:06 +00:00
itojun
ce132b307b put stripped-down version of ip6.h and icmp6.h into tcpdump tree.
ip6.h is almost normal RFC2292 header.
icmp6.h has couple of extensions (not covered by RFC2292),
like MLD, ICMPv6 nodeinfo, and router renumber.

XXX how to synchronize with future kame changes?
2000-10-07 05:53:09 +00:00
itojun
b0385536d7 move ah/esp struct declratiaon into separate header (ah.h and esp.h).
they are from KAME.

use ah.h and esp.h where necessary.
2000-10-06 11:32:17 +00:00
itojun
3b1019f08e unused variable 2000-10-06 06:18:35 +00:00
itojun
061c146d5d typo. from jinmei@kame.net 2000-10-03 02:55:39 +00:00
itojun
64b4695379 typo in comment. from jinmei@kame.net 2000-10-03 02:19:04 +00:00
itojun
bbb665b76f grab upper layer protocol by chasing extension header chain.
from jinmei@kame.net
2000-10-03 02:17:50 +00:00
guy
8fed70e6bd Get "udp.h" from the tcpdump source tree, not from a system header file. 2000-09-29 05:46:11 +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
itojun
0e59c1e8d3 need udp.h for handling port unreach 2000-09-28 11:27:35 +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
itojun
c25493a5b5 typo. query/reply mixup. from jinmei@kame.net 2000-08-30 14:28:44 +00:00
itojun
2ccbd10907 icmp6 nodeinfo printing; "node addresses" have TTL field with addresses.
repair boundary check, avoid overrun.
2000-08-29 16:04:55 +00:00
itojun
f99f9eef51 typo in ni query/reply. ICMP6_NI_SUCESS -> SUCCESS 2000-08-03 14:25:57 +00:00
itojun
5b55c55986 beautify node information query printing 2000-07-16 05:25:16 +00:00
assar
2b1907d4d8 handle the case of not having any mld6 struct at all. From Juergen
Schoenwaelder <schoenw@ibr.cs.tu-bs.de>
2000-06-26 20:04:53 +00:00
itojun
e44561cc48 avoid possible infinite loop in relts_print().
move safeputchar() and safeputs() into util.c for better code sharing.
some style.
2000-06-03 16:40:35 +00:00
itojun
abee15c4e9 do not attempt to telnet option chars directly - they usually include
binaries like \001 or \200, and damages screen output.
improve safeputc() - print 0x80 and beyond in \xxx.
2000-05-28 04:23:14 +00:00
itojun
f65f095f61 improve DNS name decoder (termination) 2000-05-17 14:54:03 +00:00
itojun
f411ba42d7 correct NI6 subject name printing (DNS). 2000-05-15 09:23:49 +00:00
itojun
0a222e15b7 more correction to NI6 FQDN printing. 2000-05-15 06:27:02 +00:00
itojun
a78d1e7ca6 correct termination processing for DNS payload decoding (NI6 FQDN).
maybe we should just call ns_nprint().
2000-05-15 06:22:16 +00:00
itojun
befd81a989 icmp6 nodeinfo; DNS decoder will emit "???" for malformed/compressed form 2000-05-10 09:24:15 +00:00
itojun
b341d45273 remove unused variable. 2000-05-10 08:57:22 +00:00
itojun
bb0457a5e2 revise ICMPv6 nodeinfo decoding. based on 03-05 drafts
(there are way too many protocol changes)
2000-05-10 08:20:52 +00:00
itojun
69eb95b8e3 random cleanups. add some parens for clarity. 2000-04-28 11:46:11 +00:00
itojun
c9c414df15 style. s/switch(/switch (/. 2000-04-24 12:59:39 +00:00
assar
a5c28d2bd6 handle both struct icmp6_mld and struct mld6_hdr we have.
fallback definitions for some constants
2000-04-09 19:14:52 +00:00
itojun
2debca7071 don't overrun packet buffer when decoding ICMPv6 FQDN/who-are-you packet. 2000-03-13 05:00:04 +00:00
fenner
34ff77ff43 Unify rcsid[]'s. 2000-01-09 21:34:14 +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