summaryrefslogtreecommitdiff
path: root/print-stp.c
Commit message (Collapse)AuthorAgeFilesLines
* Put "{" at end of line with "if" to keep a consistent styleFrancois-Xavier Le Bail2023-04-191-2/+1
| | | | [skip ci]
* Fix some typosFrancois-Xavier Le Bail2022-07-041-1/+1
| | | | [skip ci]
* Fix some typosFrancois-Xavier Le Bail2020-12-121-1/+1
| | | | [skip ci]
* Replace the (void)nd_printzp() calls by nd_printjnp() callsFrancois-Xavier Le Bail2020-12-101-2/+2
|
* STP: Modernize packet parsing style.Denis Ovsienko2020-12-091-46/+22
| | | | | | | Remove all ND_TCHECK*() instances because they are redundant. Let nd_printzp() guard the snapshot end. Report invalid packets as invalid, not truncated. Make functions that always return the same value void. ND_TCHECK_BRIDGE_ID() is not used anymore, so remove it. Update a test.
* Remove 96 assorted ND_TCHECK calls.Denis Ovsienko2020-09-081-5/+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.)
* Remove many (762) now redundant ND_TCHECK_n() callsFrancois-Xavier Le Bail2020-09-061-15/+0
| | | | | | | | | | | 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.
* STP: Remove blank lines in outputFrancois-Xavier Le Bail2019-08-151-1/+1
| | | | Update the output of a test accordingly.
* Remove more old-compiler compensation.Guy Harris2019-08-081-1/+1
| | | | | | | | | | | | We require an environment with a C99-compatible snprintf(), so we don't need to work around older implementations. Make the configuration process fail if we don't have snprintf() and vsnprintf(). We require at least VS 2015, so we don't have to check for _MSC_VER >= 1400. Make the build fail if we don't have at least VS 2015. We apparently do, however, have to use __inline, as the VS 2015 documentation doesn't meaning plain old "inline". Update a comment.
* Add some needed '&' when using a nd_byte type array struct member ...Francois-Xavier Le Bail2019-06-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... with the ND_TCHECK_SIZE() macro. The ND_TCHECK_SIZE() macro is defined by: #define ND_TCHECK_SIZE(p) ND_TCHECK_LEN(p, sizeof(*(p))) Example (in print-pptp.c): struct pptp_msg_sccrp { [...] nd_byte hostname[64]; [...] } nd_byte is defined in netdissect.h: typedef unsigned char nd_byte; ptr is defined as: struct pptp_msg_sccrp *ptr. As pointer values, ptr->hostname and &ptr->hostname are the same. Thus the first parameter of ND_TCHECK_LEN() is the same with or without '&'. When doing: ND_TCHECK_SIZE(ptr->hostname); The sizeof(*(p)) gives sizeof(*(ptr->hostname)), Thus sizeof(unsigned char) is 1. The check is wrong. When doing: ND_TCHECK_SIZE(&ptr->hostname); The sizeof(*(p)) gives sizeof(*(&ptr->hostname)), Thus sizeof(unsigned char [64]) is 64. The check is right. Thus, when using ND_TCHECK_SIZE with a nd_byte type array struct member, we need the '&'. This change revert partially 1b081ef03b1880d40813807589dc966e2549b4c5.
* Remove some unneeded '&' when getting a pointer to a nd_ typeFrancois-Xavier Le Bail2019-04-211-5/+5
| | | | | Moreover: Remove some unneeded casts.
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-60/+62
| | | | | | | 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 ndo parameter to some functionsFrancois-Xavier Le Bail2019-03-261-7/+7
| | | | This parameter will be needed at the next step.
* Add a nd_print_trunc() callFrancois-Xavier Le Bail2018-05-171-1/+1
| | | | Update the output of some tests accordingly.
* 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.
* Add nd_{v}snprintf() routines/wrappers.Guy Harris2018-01-291-1/+1
| | | | | | | | Some versions of the MSVC runtime library have a non-C99-compliant vsnprintf(), which we want to avoid. On Windows, use snprintf() and vsnprintf() for VS 2015 and later, where they both exist in C99-compliant forms, and wrap _{v}snprintf_s() otherwise (they're guaranteed to do the null termination that we want).
* STP: Replace ND_TCHECK call(s) by ND_TCHECK_SIZE call(s)Francois-Xavier Le Bail2018-01-231-1/+1
|
* 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
|
* STP: Use more ND_TCHECK_n() macrosFrancois-Xavier Le Bail2018-01-071-11/+11
|
* Update ND_PRINT() as a variadic macroFrancois-Xavier Le Bail2018-01-071-48/+48
|
* Use nd_ types, add EXTRACT_ calls, clean up signed vs. unsigned.Guy Harris2017-12-301-50/+59
|
* Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)Francois-Xavier Le Bail2017-12-111-1/+1
| | | | | ND_TTEST2(var, l) -> ND_TTEST_LEN(p, l) ND_TCHECK2(var, l) -> ND_TCHECK_LEN(p, l)
* Use more the ND_TCHECK_1() macroFrancois-Xavier Le Bail2017-12-041-1/+1
|
* Use more the EXTRACT_U_1() macro (39/n)Francois-Xavier Le Bail2017-12-011-1/+3
| | | | In some macros and functions call, p[n]
* Use more ND_TCHECK_n() macrosFrancois-Xavier Le Bail2017-11-291-1/+1
|
* Use more the EXTRACT_U_1() macro (28/n)Francois-Xavier Le Bail2017-11-261-13/+13
| | | | | | In ND_PRINT() macro call(s) (step 7). p[n] ...
* Use more the EXTRACT_U_1() macro to fetch a one-byte value (24/n)Francois-Xavier Le Bail2017-11-231-1/+1
| | | | In bittok2str() calls (step 3).
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-37/+37
| | | | | | | | | | | | | | | | 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
* Rename ND_TCHECK_/ND_TTEST_ macrosFrancois-Xavier Le Bail2017-11-221-7/+7
| | | | | | | | Now all the macros have a name meaning a count in bytes. e.g.: ND_TCHECK_32BITS -> ND_TCHECK_4 ND_TTEST_32BITS -> ND_TTEST_4
* Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()Francois-Xavier Le Bail2017-11-181-39/+37
| | | | | It indicates clearly that these macros are used to extract big-endian integral values.
* CVE-2017-11108/Fix bounds checking for STP.Guy Harris2017-07-221-0/+2
| | | | | | | | | | | Check whether the flags are in the captured data before printing them in an MSTP BPDU. Check whether V4 length is in the captured data before fetching it. This fixes a vulnerability discovered by Kamil Frankowicz. Include a test for the "check whether the V4 length is..." fix, using the capture supplied by Kamil Frankowicz.
* STP: Remove trailing spaces in outputFrancois-Xavier Le Bail2017-01-181-8/+7
|
* STP: Filter out non-printable charactersFrancois-Xavier Le Bail2017-01-181-11/+18
| | | | | | | | | Use fn_printzp(). Moreover: Add a missing comma in output. Use ND_TCHECK_32BITS instead of ND_TTEST_32BITS. Add a test for spb_bpduv4.pcap with verbose output.
* CVE-2016-7940/Add a bunch of bounds checks, and fix some printing.Guy Harris2017-01-181-14/+52
| | | | | | | | | | | | | The bounds checks fix some heap overflows found with American Fuzzy Lop by Hanno Böck. Add some ND_TTEST_/ND_TCHECK_ macros to extract.h to simplify writing bounds checks for code that uses the other macros in that file. Fix the printing of the SPB BPDU agreement digest - I don't think the intent was to print the value of the first 4 bytes, that value + 4, that value + 8, etc., I suspect it was to print the first 4 bytes, the next 4 bytes, etc..
* Add a summary comment in all other printersFrancois-Xavier Le Bail2016-08-151-1/+0
| | | | | | | Moreover: Remove some redundant comments Update some summary comments Update the specification URL for ATA over Ethernet (AoE) protocol
* Move the printer summaries from INSTALL.txt to each printerFrancois-Xavier Le Bail2016-08-141-0/+2
| | | | | | | | 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
* 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
|
* Fix a bunch of de-constifications.Guy Harris2015-04-261-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.
* u_intN_t is dead, long live uintN_t.Guy Harris2014-04-231-16/+16
| | | | | | | | | 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.
* NDOize EIGRP, ICMP, L2TP, STP and UDP decodersDenis Ovsienko2014-03-151-58/+60
|
* don't include addrtoname.h needlesslyDenis Ovsienko2014-02-251-1/+0
|
* remove tcpdump's own CVS keywordsDenis Ovsienko2014-01-031-5/+0
| | | | | | 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.
* whitespace changesMichael Richardson2014-01-011-11/+11
|
* justify declarations of struct tok arraysDenis Ovsienko2013-09-241-4/+4
| | | | | | 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.
* Don't print the SPB stuff in non-verbose mode.Guy Harris2013-03-271-2/+8
| | | | | | | Before the previous change, we didn't print it; restore that behavior. Also update a comment - DEFAULT_SNAPLEN is now pretty large, so we should capture the entire packet by default.