Commit Graph

71 Commits

Author SHA1 Message Date
Guy Harris
40185ca67a Discard result of fn_printn() calls.
We've already done checks to see whether we'll run past the end of the
packet, so there's no need to see whether fn_printn() did so.

Squelches some Coverity complaints.
2017-01-18 09:16:42 +01:00
Guy Harris
e7f2e5fdab Make sure we have the entire option before printing it. 2017-01-18 09:16:42 +01:00
Guy Harris
d33705dab6 Use fn_printn() to print strings.
Don't just use %.*s - that's not robust in the presence of non-printable
characters in the string.
2017-01-18 09:16:42 +01:00
Guy Harris
6d28d4f426 Don't cast away constness.
While we're at it, clean up white space, and cast a size_t to u_int,
rather than int, when passeing it to a routine that expects a u_int.
2017-01-13 20:46:46 -08:00
Eliot Lear
4b2804bffd Updating to use fn_printn 2016-12-31 08:22:35 +01:00
Eliot Lear
3caf684848 Updated print-bootp.c with corrected options for TZ and added option for MUDURL.
Updated print-dhcpv6.c to process TZ options as well as MUDURL.
2016-12-08 14:18:24 +01:00
Denis Ovsienko
21c80eab75 fix alignment issues with GCC on Solaris 10 SPARC
When compiled with the Solaris Studio 12.3 compiler (as in the OpenCSW
buildbot system at the time), tcpdump passed all the tests. When
compiled with GCC 5.2.0 on the same host, the following tests failed
because tcpdump terminated with SIGILL (Bus Error - core dumped):
icmpv6, icmpv6_opt24-v, dhcpv6-aftr-name, dhcpv6-ia-na, dhcpv6-ia-pd,
dhcpv6-ia-ta, dhcpv6-ntp-server, dhcpv6-sip-server-d,
dhcpv6-domain-list, kday1. This change fixes the issue with the method
suggested in commit 1376682.
2016-10-09 11:44:19 +01:00
Francois-Xavier Le Bail
11d3a01319 Move the printer summaries from INSTALL.txt to each printer
with the tag '\summary:' for greping.
Remark: Currently some printers have no summary line.

Moreover:
Summarize all printers with a single line in INSTALL.txt
2016-08-14 17:03:43 +02:00
Francois-Xavier Le Bail
99c91c3aec Rename 'tcpdump-stdinc.h' to 'netdissect-stdinc.h'
Get the full log via: git log --follow netdissect-stdinc.h
2015-09-10 08:50:40 +02:00
Francois-Xavier Le Bail
08989170ad DHCPv6: Update Status Codes with RFCs/IANA names 2015-09-06 14:20:37 +02:00
Francois-Xavier Le Bail
c1c3c77463 Printers must include 'netdissect.h', not 'interface.h' 2015-09-05 23:35:58 +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
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
a580d11dca DHCPv6: make use of tok2str() 2014-04-10 14:47:31 +04:00
Denis Ovsienko
b070a491c6 DHCPv6: axe a couple invariant expressions
The "type > 65535" condition in dhcp6opt_name() was always false because
the function is given a 16-bit argument.

The "dh6->dh6_msgtype" condition in dhcp6_print() was always true
because name == NULL only when none of the preceding switch block cases
matched.
2014-04-10 14:23:17 +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
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
59690cf6b7 NDOize BOOTP, DHCPv6, DNS, PIM and sFlow decoders
Also add/remove tabs in a few involved functions to justify indentation.
2014-03-25 23:27:23 +04:00
Guy Harris
8f854105c8 Fix typo. 2014-01-18 11:57:45 -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
Michael Richardson
a97fb2f3ae whitespace changes 2014-01-01 21:31:18 -05:00
fxlb
e3e04d2c8c DHCPv6 decoder fix
- fix the tests for DH6OPT_SIP_SERVER_D, DH6OPT_DOMAIN_LIST and DH6OPT_NTP_SERVER,
- add missing ")".
2013-05-31 15:25:29 +02:00
fxlb
c86e4bd09c DHCPv6 decoder update (RFC3646, DNS options)
- Add decoder for option 24 (DOMAIN_LIST)
- Rename option 23 as DNS_SERVERS
- Rename option 24 as DOMAIN_LIST
- In dhcp6opt_print() constify dh6o
2013-05-06 17:44:01 +02:00
fxlb
b674109a41 DHCPv6 decoder update
- In dhcp6opt_print() constify tp
- Add decoder for option 21 (SIP_SERVER_D - RFC3319)
2013-04-29 14:33:18 +02:00
fxlb
af7a65c643 DHCPv6 decoder update
- Rename option 31 as SNTP_SERVERS (see RFC4075)
- Add decoder for option 56 (NTP_SERVER) from RFC5908
2013-04-25 17:44:14 +02:00
Gisle Vanem
a42db1cd0f Get rid of declarations in the middle of code; they're not valid C.
Reviewed-By: Guy Harris <guy@alum.mit.edu>
2013-03-26 10:34:33 -07:00
fxlb
94c2f0115b print-dhcp6.c: update of the references RFC with their titles 2012-12-05 15:46:29 +01:00
fxlb
2c4de02c06 print-dhcp6.c: Fix bugs in DH6OPT_IA_NA, DH6OPT_IA_PD, DH6OPT_IA_TA, DH6OPT_IA_ADDR and DH6OPT_IA_PD_PREFIX option cases. Add test files 2012-11-26 17:39:09 +01:00
fxlb
ec610bbc73 print-dhcp6.c: add TCHECK(*dh6o) in dhcp6opt_print() 2012-11-26 10:37:20 +01:00
FXLB
d174b282ed Decode DHCPv6 AFTR-Name option (RFC6334) 2012-11-20 17:59:36 +01:00
Steinar Haug
705328c505 Improve printout of DHCPv6 options.
Reviewed-By: Guy Harris <guy@alum.mit.edu>
2010-11-13 10:34:49 -08:00
Guy (Core OS) Harris
7e6045579a From Francois-Xavier Le Bail: use hyphens, rather than spaces, in DHCPv6
option names, so that the "-v" display, which prints options separated
by spaces, isn't ambiguous.  (The BOOTP dissector has hyphens in the
BOOTP/DHCP option names.)
2009-06-03 13:58:27 -07:00
Guy Harris
4049e2eafc Don't use structures to define the layout of DHCP options. For one
thing, there's no guarantee that __attribute__ ((__packed__)) works.
2009-05-24 15:47:38 -07:00
guy
488187db5c From Francis Dupont: update the DHCPv6 printer to handle newer features. 2008-02-06 10:26:09 +00:00
guy
3fa6ec70c3 From Shinsuke Suzuki:
Some of the options in print-dhcp6.c are declared as
"unassigned ones". but it is no longer true due to an
IETF standardization activities.

Here's the patch to catch up with the latest IANA
assignment, including an removal of the old Prefix-
Delegation option used in the NTT-communications.
(AFAIK they no longer uses this old option).
2006-10-25 22:02:36 +00:00
guy
f59615e6d1 Squelch some signed-vs-unsigned comparison warnings. 2004-07-06 22:16:03 +00:00
itojun
de60933267 DHCPv6 authentication stuff. jinmei@kame 2004-07-05 07:49:30 +00:00
guy
22cc33aea8 From Shinsuke Suzuki <suz@kame.net>: a patch to support some DHCPv6
options.  It includes the following two features:

	- decode the names of all the DHCPv6 Options defined in
	  RFC3315
	- support DHCPv6-Lifetime option, as defined in
	  draft-ietf-dhc-lifetime-00.txt

Note that the latter doesn't have an official DHCPv6 type number, so
it's subject to change.
2004-06-16 00:12:35 +00:00
itojun
b8fdb599f3 use official assigned numbers for DHCPv6 prefix delegation options. suz@kame 2004-01-21 03:53:08 +00:00
guy
8a42f11ab0 Get rid of unused arguments to "dhcp6_print()". 2003-11-18 23:26:37 +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
7d83ad1ef8 Escape question marks, to avoid warnings about trigraphs. 2003-11-15 01:08:37 +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
9a5f197f7a update from suz@kame.net
* RFC3315: DHCPv6
* supported DHCPv6 options:
*  RFC3319,
*  draft-ietf-dhc-dhcpv6-opt-dnsconfig-04.txt,
*  draft-ietf-dhc-dhcpv6-opt-prefix-delegation-05.txt
*  draft-ietf-dhc-dhcpv6-opt-timeconfig-02.txt,
2003-10-29 03:54:14 +00:00
itojun
58b83f6ad4 use snprintf 2003-08-13 02:26:52 +00:00
itojun
96d5cdd506 decode dhcp6 relay message. from jinmei@kame 2003-07-16 16:15:53 +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
1f583a0234 Get rid of an argument to "printf()" that didn't have a matching format
item.
2002-08-02 04:05:51 +00:00