summaryrefslogtreecommitdiff
path: root/print-udld.c
Commit message (Collapse)AuthorAgeFilesLines
* Replace the (void)nd_printn(..., NULL) calls by nd_printjn() callsFrancois-Xavier Le Bail2021-01-081-1/+1
| | | | | Moreover: Remove a now useless comment.
* Replace the nd_printzp(..., NULL) calls by nd_printjnp() callsFrancois-Xavier Le Bail2020-12-101-1/+1
|
* UDLD: Refine and modernize the code.Denis Ovsienko2020-10-031-28/+39
| | | | | | | | | | | | | | | | | | Enable ND_LONGJMP_FROM_TCHECK. Lose a local variable, instead modify the provided pointer and length in sync and always fetch one field at a time. When the packet is declard too short, report it as invalid, not truncated (it may turn out truncated soon thereafter though). Use a named constant. When not decoding the packet completely (whether invalid or not), still check that it is fully within the snapshot. When decoding it completely, add checks at the beginng of the iteration to test that both the TL and the V fit into the remaining part of the declared packet. Move an ND_TCHECK_LEN() into the default case to let the string printing functions guard the snapshot end. Do not declare the remainder of the packet invalid on TLV type 0, as RFC 5171 Section 6 says: "If an implementation does not understand a Type value, it should skip over it using the length field."
* Fix a few bitmap printing bugs.Denis Ovsienko2020-10-011-4/+10
| | | | | | | | | | | | | | | | | | | bittok2str_internal() used to match on a single walking 1, so a bitmap token that had more than one bit set would never "match all" or "match any". Replace the bit-walking loop with a single bitwise test, that's faster and it provides "match all" for multiple-bit tokens if required. Also a 0 token would always match a 0 value, which makes no sense in bitmaps, so fix a 0 token to never match. Update the comment and fixup some indentation. This change had immediately chased a bug out of print-udld.c, where the tokens were wrong in udld_flags_values[]. Fix that, list the MBZ bits and rename the array for clarity. Update output for two tests. In the course of this debugging it became clear that in print-aoe.c I got both the tokens and the labels wrong in aoev1_aflag_str[]. Fix that, rename the listed MBZ bits for brevity and rename the array for clarity. Update output for one test.
* Remove 96 assorted ND_TCHECK calls.Denis Ovsienko2020-09-081-1/+0
| | | | | | | Remove a number of instances that do not match common patterns and have the only substantial effect on the code flow that a truncated packet triggers "goto trunc" instead of longjmp(). (In a few cases this change can increase the number of fields printed before giving up.)
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-9/+9
| | | | | | | 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.
* Add the nd_print_invalid() functionFrancois-Xavier Le Bail2018-09-111-1/+1
| | | | | | | It prints " (invalid)", used for malformed or corrupted packets. Moreover: Update CONTRIBUTING.
* Remove some spaces (style)Francois-Xavier Le Bail2018-05-101-1/+1
|
* Print truncations with nd_print_trunc() instead of tstr[] stringsFrancois-Xavier Le Bail2018-05-041-2/+1
| | | | | | | | Remove the tstr[] strings. Update the output of some tests accordingly. Moreover: Add or update some ndo_protocol fields.
* Rename the fn_printX() functions to nd_printX()Francois-Xavier Le Bail2018-04-301-2/+2
| | | | | | | 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.
* Remove useless commentsFrancois-Xavier Le Bail2018-03-191-7/+0
|
* Add the ndo_protocol field in the netdissect_options structureFrancois-Xavier Le Bail2018-03-161-0/+1
| | | | | Update this field in printer entry functions. It will be used for some printings.
* Always include <config.h> rather than "config.h".Guy Harris2018-01-211-1/+1
| | | | | | | | 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.
* Use quoted include netdissect-stdinc.h instead of angle-bracketed oneFrancois-Xavier Le Bail2018-01-211-1/+1
|
* Update ND_PRINT() as a variadic macroFrancois-Xavier Le Bail2018-01-071-11/+11
|
* Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)Francois-Xavier Le Bail2017-12-111-2/+2
| | | | | ND_TTEST2(var, l) -> ND_TTEST_LEN(p, l) ND_TCHECK2(var, l) -> ND_TCHECK_LEN(p, l)
* Use more the EXTRACT_U_1() macro (31/n)Francois-Xavier Le Bail2017-11-271-1/+1
| | | | | | In ND_PRINT() macro call(s) (step 9). *(p)
* Use more the EXTRACT_U_1() macro (30/n)Francois-Xavier Le Bail2017-11-271-2/+2
|
* Use more ND_TCHECK_n()/ND_TTEST_n() macrosFrancois-Xavier Le Bail2017-11-241-1/+1
|
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-6/+6
| | | | | | | | | | | | | | | | 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
* Use more the EXTRACT_8BITS() macro to fetch a one-byte value (12/n)Francois-Xavier Le Bail2017-11-201-1/+1
| | | | In ND_PRINT() macro calls.
* Use more the EXTRACT_8BITS() macro to fetch a one-byte value (1/n)Francois-Xavier Le Bail2017-11-191-1/+1
| | | | In bittok2str() calls.
* Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()Francois-Xavier Le Bail2017-11-181-4/+4
| | | | | It indicates clearly that these macros are used to extract big-endian integral values.
* Add a summary comment in all other printersFrancois-Xavier Le Bail2016-08-151-2/+4
| | | | | | | Moreover: Remove some redundant comments Update some summary comments Update the specification URL for ATA over Ethernet (AoE) protocol
* Change istr[] (for invalid string) to be globalFrancois-Xavier Le Bail2016-01-281-1/+0
|
* UDLD: Fix "Unchecked return value" found by CoverityFrancois-Xavier Le Bail2015-11-261-1/+1
| | | | | | The bounds check is already done before by ND_TCHECK2(*tptr, len). So we are deliberately ignoring the return value of fn_printn with last argument NULL (no bounds check).
* UDLD: Fix an infinite loopFrancois-Xavier Le Bail2015-11-201-16/+47
| | | | | | | | | | | | | | | Moreover: Update reference from draft to RFC5171. Add bounds and length checks. Fix TLV length printout. It is the length of the type, length, and value fields. Filter out non-printable characters. Print the Echo TLV with fn_printn(). Note: The format of this list of ID pairs is not documented in the RFC. Update the output of a test accordingly. Add and use istr[] and tstr[] strings. Comment on the TLV format. Update some comments.
* Rename 'tcpdump-stdinc.h' to 'netdissect-stdinc.h'Francois-Xavier Le Bail2015-09-101-1/+1
| | | | Get the full log via: git log --follow netdissect-stdinc.h
* Printers must include 'netdissect.h', not 'interface.h'Francois-Xavier Le Bail2015-09-051-1/+1
|
* dismiss NETDISSECT_REWORKED macroDenis Ovsienko2015-03-221-1/+0
| | | | | | | 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.
* don't reinvent ND_TCHECK2()Denis Ovsienko2014-06-121-4/+2
|
* make use of NETDISSECT_REWORKEDDenis Ovsienko2014-03-151-1/+2
| | | | | Update the already converted decoders to define the macro and to include interface.h instead of netdissect.h. Fix incurred compile errors.
* NDOize HSRP, IGRP and UDLD decodersDenis Ovsienko2014-03-041-18/+14
|
* don't include addrtoname.h needlesslyDenis Ovsienko2014-02-251-1/+0
|
* whitespace changesMichael Richardson2014-01-011-20/+20
|
* justify declarations of struct tok arraysDenis Ovsienko2013-09-241-3/+3
| | | | | | 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.
* From Carles Kishimoto <carles.kishimoto@gmail.com>:hannes2007-03-191-0/+173
add support for unidirectional link detection as per http://www.ietf.org/internet-drafts/draft-foschiano-udld-02.txt