Commit Graph

54 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
Francois-Xavier Le Bail
cc848f1535 Put "{" at end of line with "if" to keep a consistent style
[skip ci]
2023-04-19 22:03:12 +02:00
Denis Ovsienko
19fe0351f2 BFD: Refine the previous commit.
Spell acronyms as they appear in respective specifications, fix a
reference in a comment, add a change log entry and update some tests.
2021-02-16 00:59:17 +00:00
Bill Fenner
6c002d33c0 BFD: add SBFD support (RFC7880 and RFC7881)
Add support for SBFD on UDP port 7784.  SBFD is different
in that packets from the reflector will be sent with *source*
port 7784; in all other BFD mechanisms, it is only the
destination port that matters.  For SBFD print-udp.c has to
check both source and destination port.
2021-02-14 15:08:33 +00:00
Francois-Xavier Le Bail
3ed92cd021 Replace the (void)nd_printn(..., NULL) calls by nd_printjn() calls
Moreover:
Remove a now useless comment.
2021-01-08 17:12:12 +01:00
Francois-Xavier Le Bail
ca8ca82e22 Fix some "Unchecked return value" found by Coverity 2020-11-01 15:50:00 +01:00
Denis Ovsienko
5ea3e24358 BFD: Modernize packet parsing style.
Enable ND_LONGJMP_FROM_TCHECK. In auth_print() let nd_printn() guard the
packet buffer end and make it void. Lose obsolete checks in bfd_print().
2020-10-13 11:32:32 +01:00
Francois-Xavier Le Bail
abc8c2d61c Remove many (762) now redundant ND_TCHECK_n() calls
ND_TCHECK_n(e), n in { 1, 2, 3, 4, 8 }.

They are redundant because they are followed by a GET_.*_n(e) call,
same n, same e, which do the bounds check.

Remove unused 'trunc' labels and most associated codes.

Update the outputs of some tests accordingly.
2020-09-06 20:22:29 +02:00
Bill Fenner
9aa4f490f4 Add BFD multihop and lag decoding
Put back the bfd_port_values, and use it to distinguish
between destination ports for RFC5883 multihop and
RFC7310 lag sessions.  (The destination port is the only
difference between these messages.)
2019-04-26 11:03:34 -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
Guy Harris
a3fa8638e8 Clean up handling of different packet types.
Only look at the header for control packets; we don't know what the
payload contains for other packet types.

This fixes some cases where we fail to check whether we have a full
header before fetching from the header - we only need to fetch from the
header for control packets, so we now only need to check that we have it
for control packets; make sure we *don't* look at the header for other
packet types.

Update the v0 code to match draft-ietf-bfd-base-01, which was the last
draft that discussed v0.
2018-07-10 01:01:32 -07:00
Francois-Xavier Le Bail
00ecef01d7 Add more nd_print_trunc() calls
Update the output of some tests accordingly.
2018-05-06 11:26:45 +02:00
Francois-Xavier Le Bail
3e3e6d2ef4 Rename the fn_printX() functions to nd_printX()
The functions are: nd_print, nd_printztn, nd_printn and nd_printzp.
Trying to make it clearer that they currently have to be used only on part
of the packet buffer.
Update some comments.
2018-04-30 13:35:06 +02:00
Francois-Xavier Le Bail
56e6581c34 Remove useless comments 2018-03-19 15:16:32 +01: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
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
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
0d52da1a96 Use nd_ types, add EXTRACT_ calls, use %u for unsigned values. 2017-12-29 19:17:33 -08:00
Francois-Xavier Le Bail
5cea270318 Remove all storage class specifier 'register'
Let the compiler do the optimizations (or not) based on build options.

Avoid 'value has been optimized out' messages in gdb using '-O0'.
2017-12-13 19:17:47 +01: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
f085c93f59 Use more the EXTRACT_U_1() macro (31/n)
In ND_PRINT() macro call(s) (step 9).

*(p)
2017-11-27 20:57:24 +01:00
Francois-Xavier Le Bail
1a90fd99d2 Use more the EXTRACT_U_1() macro (28/n)
In ND_PRINT() macro call(s) (step 7).

p[n] ...
2017-11-26 15:44:43 +01:00
Francois-Xavier Le Bail
39c8c55aa9 Use more ND_TCHECK_n()/ND_TTEST_n() macros 2017-11-24 22:48:55 +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
Denis Ovsienko
413840cf18 Don't specify struct as "const" within sizeof().
The only difference the const qualifier makes in this context is visual,
make it consistent with the rest of the source code.
2017-09-13 13:33:02 +01:00
Hannes Gredler
ff8464bffd zero change: update Hannes Gredler's email 2017-07-28 17:44:12 +02:00
Francois-Xavier Le Bail
19ea00958b BFD: Update to print optional authentication field
Moreover:
Add test files with 'Simple Password', 'Keyed MD5' and
'Meticulous Keyed SHA1' authentications.
Update specification from draft to RFC 5881 for BFD_CONTROL_PORT and
BFD_ECHO_PORT in udp.h.
Add specification RFC 5881 in print-bfd.c.
2016-08-17 11:46:54 +02:00
Francois-Xavier Le Bail
fd4738e245 BFD: Update specification from draft to RFC 5880
This is for version 1.  The version 0 remain "draft".

Moreover:
Update a flag string ("Reserved" -> "Multipoint").
2016-08-16 15:55:24 +02:00
Francois-Xavier Le Bail
b38f324af9 Add a summary comment in all other printers
Moreover:
Remove some redundant comments
Update some summary comments
Update the specification URL for ATA over Ethernet (AoE) protocol
2016-08-15 22:42:38 +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
c1c3c77463 Printers must include 'netdissect.h', not 'interface.h' 2015-09-05 23:35:58 +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
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
1fe6e66ece make use of NETDISSECT_REWORKED
Update the already converted decoders to define the macro and to include
interface.h instead of netdissect.h. Fix incurred compile errors.
2014-03-15 14:19:49 +04:00
Denis Ovsienko
83bec9d56c refine some past NDO conversions
Don't include unneeded headers and replace a few remaining printf's.
2014-03-12 18:11:23 +04:00
Denis Ovsienko
cf90fd1a84 NDOize ARCNET, BFD and GRE decoders 2014-03-11 17:36:46 +04:00
Denis Ovsienko
69f6f4392a don't include addrtoname.h needlessly 2014-02-25 17:53:08 +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
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
3e49644114 Based on a patch from Marc Binderberger, fix the handling of non-control
packets.
2009-03-27 01:25:39 -07:00
hannes
921ffddf12 shift the state field in the bfdv1 printer correct 2006-02-02 06:35:52 +00:00
hannes
a370efc5ca authentication present flag is 0x04 and not 0x40 2005-04-28 09:27:35 +00:00
hannes
a8c89731f0 do proper masking and shifting of the flag bits 2005-04-28 07:29:13 +00:00
hannes
620d5f1579 boundary check for authentication header 2005-04-27 23:14:02 +00:00
hannes
fe99fbf3b5 add support for BFDv1 as per draft-ietf-bfd-base-02 2005-04-27 23:00:53 +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