Commit Graph

43 Commits

Author SHA1 Message Date
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
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
14e71ce55a From Mark Ellzey Thomas <mark@ackers.net>: check the length of a data
chunk before printing it.
2003-08-06 05:02:12 +00:00
guy
c4aa80257a The SCTP dissector is only called for SCTP packets, so there's no reason
for it to check the protocol number in the IP header.

Have the IPv6 dissector call the SCTP dissector for SCTP packets.

Get rid of the definition of IPPROTO_SCTP in sctpConstants.h, so we
don't have problems if <netinet/in.h> also defines it.
2003-06-03 23:49:22 +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
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
guy
a7aa2961a4 Constify.
Make "payloadPtr" a "u_char *" rather than a "char *", to eliminate some
signed vs. unsigned complaints from some compilers.
2002-04-25 04:45:59 +00:00
guy
153e205db7 The payload of an SCTP DATA chunk is *not* necessarily ASCII text, so it
shouldn't be printed by directly sending it to the standard output;
print it with "default_print()" if neither the "-x" nor the "-q" flag
were set.
2001-12-12 07:16:40 +00:00
guy
b6971d45d8 Don't switch between using standard I/O and raw writes; just use
"fwrite()" instead of "write()".
2001-12-11 09:41:54 +00:00
guy
a9f1b2876e "print-sctp.c" doesn't have to include <net/if.h>, and, if it doesn't do
so, it doesn't need to provide incomplete definitions of "struct mbuf"
or "struct rtentry", either.  If it *does* include <net/if.h>, it
appears to fail to compile on at least some versions of AIX; remove the
include and the incomplete definitions.
2001-08-01 03:31:55 +00:00
itojun
0d427b24a7 size_t may not fit into int 2001-06-27 02:48:45 +00:00
itojun
06201e8b52 ntohl() is typed to return unsigned long on old 4.[34]BSD-based OS
(i guess this i freebsd only among *BSD these day), and u_int32_t on some os.
do not rely upon OS decl and cast away to u_int32_t, and use %lu.
2001-05-09 02:42:50 +00:00
fenner
f78e1e25bd Quiet down gcc -Wall 2001-05-09 01:25:44 +00:00
fenner
52332d0132 SCTP printing from Armando L. Caro Jr. <acaro@mail.eecis.udel.edu>
Modified to print IP/IPv6-level addresses like TCP does,
 and to not print multi-line detail unless -vv by fenner.
2001-05-09 00:34:34 +00:00