Commit Graph

24 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
94a3708f00 Include <config.h> unconditionally
Builds using Autotools or CMake generate config.h, thus remove the
'#ifdef HAVE_CONFIG_H'/'#endif'.

Remove also the 'add_definitions(-DHAVE_CONFIG_H)' in CMakeLists.txt.
2024-03-28 05:34:34 +00:00
Ahmed Abdelsalam
1103418a18 Add support for ethernet IP protocol
The SRv6 network programming defines a new IP protocol number [1].

The new protocol number is used in the Next Header field of an IPv6 header
or any extension header indicates that the payload is an Ethernet.

IANA has assigned 143 as the protocol number of ethernet [2].

The SRv6 packet has the following format:
IPv6 HDR + SRH + Ethernet HDR + IPv4/IPv6 packet

This patch allows TCPDUMP to dissect such SRv6 packets.

[1] https://tools.ietf.org/html/draft-ietf-spring-srv6-network-programming-16#section-9.1
[2] https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml

Signed-off-by: Ahmed Abdelsalam <ahabdels@gmail.com>
2020-08-07 16:11:20 +00: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
Guy Harris
3f3f2505f2 Make nd_uint8_t and nd_int8_t arrays, to catch direct references.
This catches direct references, so we can change them to use EXTRACT_U_1
or EXTRACT_S_1.

Also, change some structures to use the nd_ types that weren't already
using them.

Then make the appropriate EXTRACT_{U,S}_1() changes.
2017-12-10 16:23:34 -08:00
Denis Ovsienko
2f7c41dda8 Fixup the previous commit. 2017-08-27 21:11:43 +01:00
Denis Ovsienko
b3fb6a6c61 Use a table instead of getprotobynumber().
On Linux getprotobynumber() returns different results for the same
argument depending on the contents of /etc/protocols at runtime
(expectedly but gets in the way of reproducible test cases). On FreeBSD
it returns results that are irrelevant of the contents of /etc/protocols
at runtime (unexpectedly). Other implementations exist and may expose
interesting properties too. And if the host uses LDAP instead of
/etc/protocols for name services, a call to that function may cause LDAP
handle the request. All of the above is not right for the specific task
of network protocols decoding, which needs to be fast and deterministic.

As the protocol number space is just 8-bit, add a 256-element array of
strings/NULLs for the translation and a wrapper function around it for
index range enforcement. Change the code to use the new function instead
of getprotobynumber().

Fix a typo while at it.
2017-08-27 14:19:25 +01:00
Denis Ovsienko
1b17a8cc5e Dismiss unused IPPROTO_CARP.
In ipproto_values[] IPPROTO_CARP never matched because of IPPROTO_VRRP,
which matched earlier. Remove the array element and the macro and leave
some comments instead.
2017-08-27 14:16:34 +01:00
Hannes Gredler
ff8464bffd zero change: update Hannes Gredler's email 2017-07-28 17:44:12 +02:00
Francois-Xavier Le Bail
f5fe14663d libnetdissect code must include 'netdissect.h', not 'interface.h'
Moreover:
Remove netdissect.h include in interface.h
Move thiszone declaration in netdissect.h
Update a comment
2015-09-11 13:22:56 +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
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
5cdf53e257 Define NETDISSECT_REWORKED in a bunch of files, and fix the issues it finds.
The only one it found was that routines in sigsecret.c needed to refer
to ndo->ndo_sigsecret, not just sigsecret.
2014-04-04 00:53:03 -07: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
Denis Ovsienko
5937079df9 unset executable bit on a few .h and .c files 2013-04-20 09:49:06 +04:00
George Neville-Neil
5d52dbf4c7 Add a CARP dissector and a command-line option to dissect proto 112 as CARP.
CARP and VRRP both use IP protocol number 112, so there needs to be a -T
flag to specify that protocol 112 be dissected as CARP rather than VRRP.

Also update the man page.
2011-11-23 11:53:13 -08:00
Kovarththanan Rajaratnam
08696c5fab ipproto.h/c: mark several structs as const 2010-02-20 08:45:56 +01:00
guy
1c902dcdf3 From Ian McDonald and Arnaldo Carvalho de Melo: DCCP support. 2005-09-20 06:01:20 +00:00
hannes
a5370b71fe from Andy Heffernan <ahh@juniper.net>:
add PGM upport as per rfc3208
2005-05-20 21:02:29 +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
bcfa754589 Fix a typo. 2004-12-15 08:41:26 +00:00
mcr
795db2fe9b temporary patch for "EIGP" protocol. 2004-04-29 02:16:40 +00:00
hannes
b4709d5e6f add infrastructure for host-OS indep. ipproto name resolution 2004-04-26 17:49:44 +00:00