Commit Graph

65 Commits

Author SHA1 Message Date
Guy Harris
bef667db65 Clean up types to squelch narrowing warnings. 2019-04-17 19:53:00 -07:00
Francois-Xavier Le Bail
ee68aa3646 Use the new GET_ macros instead of the EXTRACT_ ones
The exceptions are currently:
Some EXTRACT_ in print-juniper.c, not used on packet buffer pointer.
An EXTRACT_BE_U_3 in addrtoname.c, not always used on packet buffer
pointer.
2019-03-26 21:06:24 +01:00
Francois-Xavier Le Bail
61857ddd22 Add two ndo_protocol reassignments after xxx_print() calls 2019-02-27 12:26:10 +01:00
Francois-Xavier Le Bail
cc734973ea Clean up whitespaces/indentation 2019-02-27 12:12:34 +01:00
Antonin Décimo
0b3880c91e Fix small misspellings 2019-01-23 17:28:14 +01:00
Francois-Xavier Le Bail
40ae3ad744 Add more nd_print_trunc() calls
Update the output of some tests accordingly.

Moreover:
Add a ndo_protocol field assignment.
2018-05-10 18:05:56 +02:00
Francois-Xavier Le Bail
546558eabd Add the ndo_protocol field in the netdissect_options structure
Update this field in printer entry functions.
It will be used for some printings.
2018-03-16 19:44:47 +01:00
Guy Harris
0dad1934af Have ip{6}addr_string take a u_char * as the second argument.
Fix warnings that introduces.
2018-01-31 00:43:45 -08:00
Francois-Xavier Le Bail
944e93fa4c Remove function specifier 'inline' in printers
It was mostly used with large functions.

Moreover:
Put some function definition names at the beginning of line.
Fix a space.
2018-01-26 20:59:32 +01:00
Guy Harris
fb2479d733 Always include <config.h> rather than "config.h".
This can prevent bizarre failures if, for example, you've done a
configuration in the top-level source directory, leaving behind one
config.h file, and then do an out-of-tree build in another directory,
with different configuration options.  This way, we always pick up the
same config.h, in the build directory.
2018-01-21 12:27:28 -08:00
Francois-Xavier Le Bail
513f782ae1 Use quoted include netdissect-stdinc.h instead of angle-bracketed one 2018-01-21 10:28:15 +01:00
Francois-Xavier Le Bail
9eca8c4ed2 Remove unneeded '&' when getting a pointer to an nd_uintN_t type 2018-01-08 19:59:56 +01:00
Francois-Xavier Le Bail
e2982e7f6f Update ND_PRINT() as a variadic macro 2018-01-07 13:36:41 +01:00
Francois-Xavier Le Bail
d526e47658 Use ND_TTEST_SIZE()/ND_TCHECK_SIZE() macros (1/n) 2018-01-03 21:32:07 +01:00
Guy Harris
b79d5a4941 Use nd_ types, add EXTRACT_ calls, clean up signed vs. unsigned. 2017-12-30 18:30:05 -08:00
Francois-Xavier Le Bail
84ef17ac0e Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)
ND_TTEST2(var, l)  -> ND_TTEST_LEN(p, l)
ND_TCHECK2(var, l) -> ND_TCHECK_LEN(p, l)
2017-12-11 22:11:01 +01:00
Francois-Xavier Le Bail
da20bc56d6 Rename EXTRACT_ macros
Now all the macros have a name meaning a count in bytes.

With _S_: signed, _U_: unsigned

e.g.:
EXTRACT_BE_32BITS -> EXTRACT_BE_U_4
EXTRACT_LE_32BITS -> EXTRACT_LE_U_4
...
EXTRACT_BE_INT32 -> EXTRACT_BE_S_4

and have:
EXTRACT_8BITS -> EXTRACT_U_1
EXTRACT_INT8  -> EXTRACT_S_1
2017-11-22 23:54:09 +01:00
Francois-Xavier Le Bail
577621026d Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()
It indicates clearly that these macros are used to extract big-endian
integral values.
2017-11-18 13:56:40 +01:00
Francois-Xavier Le Bail
45c9c5e5c2 Put some function definition names at the beginning of line 2017-11-16 08:46:28 +01:00
Francois-Xavier Le Bail
28e2edb735 Remove parenthesis following immediately a #if
This avoid Coccinelle warning "Unable to parse #if condition"
2016-09-01 14:16:52 +02: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
Guy Harris
354638fa02 Do more bounds checking.
Step through the SCTP packet with the bp variable, and keep a packet
data remaining variable and use that for bounds checking.  For each
chunk, keep a chunk data remaining variable and use that as well.  If
there's not enough room for a full item, that gets reported as an error.

While we're at it, fix an error printout.
2015-12-15 19:12:00 -08:00
Guy Harris
11f73ad248 Don't require IPv6 library support in order to support IPv6 addresses.
Have our own routines to convert between IPv4/IPv6 addresses and
strings; that helps if, for example, we want to build binary versions of
tcpdump for Windows that can run both on NT 5 (W2K/WXP), which doesn't
have inet_ntop() or inet_pton(), and NT 6 (Vista/7/8/10), which do.  It
also means that we don't require IPv6 library support on UN*X to print
addresses (if somebody wants to build tcpdump for older UN*Xes lacking
IPv6 support in the system library or in add-on libraries).

Get rid of files in the missing directory that we don't need, and
various no-longer-necessary autoconf tests.
2015-09-17 14:56:44 -07: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
b638c78b40 Remove obsolete comments 2015-09-07 15:01:46 +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
1cd6519c4e M3UA: improve code style
Merge m3ua.h into the only file that includes it (print-m3ua.c). Make
M3UA functions follow naming pattern, constify some of their arguments
and switch to ND_PRINT(). Make use of tok2str() and ternary conditional.
Eliminate declarations in the middle of code (C89).
2014-04-21 18:56:55 +04:00
Vyacheslav Trushkin
a97e56cb11 M3UA support added (GH #342)
SCTP's payload protocol identifiers added.

M3UA tests provided by wireshark
http://wiki.wireshark.org/SampleCaptures#Sigtran_Protocol_Family
But RFC4666 tells that parameter 0x0002 aren't carried by M3UA, so
it's OK that tcpdump doesn't know about this identifier.

Conflicts:
	Makefile.in
	interface.h
	print-sctp.c
	sctpConstants.h

-----------------------------------------------------------------------
The change to sctp_print() does three things:
* makes detection of ForCES consider PPID, not just port number
* verifies chunk length of all SCTP_DATA chunks, not just of ForCES
* adds PPID-specific dispatching with a particular case of M3UA

-- Denis
2014-04-21 18:53:40 +04:00
Denis Ovsienko
5e0e95aaf5 SCTP: use tok2str() 2014-04-10 16:41:39 +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
525875a63e fixup a few ND_DEFAULTPRINT() use cases 2014-04-02 18:36:05 +04:00
Denis Ovsienko
5797b57c44 improve some recent conversions 2014-03-29 08:35:54 +04:00
Denis Ovsienko
62a5184ed4 NDOize ForCES, MPLS LSP ping and OLSR decoders 2014-03-27 14:58:23 +04:00
Denis Ovsienko
b6303af682 NDOize AODV, IPv4 and SCTP decoders 2014-03-26 15:49:27 +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
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
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
Denis Ovsienko
f1261458ff SCTP: remove an unused variable (compiler warning) 2013-09-07 15:26:29 +04:00
jamal
d3e9af76c3 RESEND: [PATCH 1/1] ForCES fix SCTP TML port
The old ports for SCTP TML ports were replaced at RFC editor
publication time. Caught by folks preparing for an Interop
tommorow.
While we could add a backward compat support it seems meaningless
if those ports will never ever be used in production.
I will send new test/pcaps at a later point and remove the existing
ones once this patch goes in.

cheers,
jamal

commit 40ecad0e866e7567716e6e57158c5274c0786a21
Author: Jamal Hadi Salim <hadi@mojatatu.com>
Date:   Thu Feb 3 22:00:23 2011 -0500

    Conform to new IANA assignment of ForCES SCTP TML

    Signed-off-by: Jamal Hadi Salim <hadi@mojatatu.com>
2011-03-31 09:41:04 +02:00
Guy Harris
19b5602a0c Use EXTRACT_16BITS to extract big-endian 16-bit quantities from the packet.
There's no guarantee that those quantities will be properly aligned, nor
is there any guarantee that fetching an improperly-aligned quantity will
work as desired.
2010-01-26 18:35:53 -08:00
Michael Richardson
d0e01819c0 IETF FORCES protocol printer, from Jamal Hadi Salim <hadi at cyberus.ca. 2010-01-10 14:49:46 -05:00
guy
735692ad42 From Chris Larson: don't cut off the last byte of the chunk payload. 2007-09-13 18:03:49 +00:00
guy
d953299b94 Add a flag to suppress the "default_print()" call made in various
link-layer print routines if no other print routine claimed the packet.
Test whether that flag is set rather than testing whether neither of -x
or -q were specified, and have -x, -q, *and* -X set that flag, so that
-X suppresses it just as -x does.  That way you don't get those pckets
dumped twice if -X was specified.
2005-07-07 01:22:15 +00:00
guy
d022b3377f Fix the bounds check for the chunk. 2005-05-06 10:53:01 +00:00
guy
1324704138 Add more bounds checks, and check for bogus chunk lengths (too short). 2005-05-05 23:08:43 +00:00
guy
6b5bfdd688 Don't use "u_long", as its length is not guaranteed to be 4 bytes. In
fact, don't even use "u_int32_t", as we're just pointing into a packet,
which is made up of bytes - use "u_char", and bump the pointer by 4 for
each item.
2005-04-13 08:30:41 +00:00
guy
262a263f75 Print all of the SCTP information, except for the payload, if "-vv"
isn't specified.
2004-12-15 08:43:23 +00:00