summaryrefslogtreecommitdiff
path: root/print-ldp.c
Commit message (Collapse)AuthorAgeFilesLines
* ldp: use a constant 2, not LDP_TLV_ADDRESS_LIST_AFNUM_LEN.Guy Harris2020-05-261-2/+2
| | | | | | We already use GET_BE_U_2(), and use 2 in the TLV_TCHECK() call; this makes it a bit more obvious (if you read TLV_TCHECK()) that the test makes sure we can subtract from tlv_tlen without underflowing.
* LDP: Add some missing bounds checksFrancois-Xavier Le Bail2020-01-181-5/+5
| | | | | | | | | | | | | | Replace calls to ipaddr_string()/ip6addr_string() with calls to GET_IPADDR_STRING()/GET_IP6ADDR_STRING() macros performing bounds checking. Fix a regression in 78a4ee82226a3fe19981841dfe24d5e9cb437524. This fixes a buffer over-read in ldp_tlv_print() discovered by Jason Xiaole. Add a test using the capture file supplied by the reporter updated to keep only the packet showing the buffer over-read.
* LDP: Fix a length checkFrancois-Xavier Le Bail2019-10-211-4/+8
| | | | | | | | | | | | | | | | | | In ldp_tlv_print(), the FT Session TLV length must be 12, not 8 (RFC3479) Moreover: Update the TLV_TCHECK() macro to remove the useless ND_TCHECK_LEN() call with the GET_ macros. Thus remain the length check giving a more accurate output. Rename a label. Update the output of a test accordingly. Add a comment. Partial update from aa5c6b710dfd8020d2c908d6b3bd41f1da719b3b in 4.9 branch.
* LDP: Fix an undefined behavior at runtimeFrancois-Xavier Le Bail2019-08-181-3/+8
| | | | | | The error was: print-ldp.c:557:13: runtime error: unsigned integer overflow: 32 - 34 cannot be represented in type 'unsigned int'
* Squelch a compiler warning.Guy Harris2019-04-261-1/+1
| | | | | All hail the integer promotions, which stick signedness into the middle of otherwise-unsigned expressions!
* Squelch more warnings.Guy Harris2019-04-171-1/+1
|
* Clean up types to squelch narrowing warnings.Guy Harris2019-04-171-2/+3
|
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-45/+45
| | | | | | | 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.
* Print truncations with nd_print_trunc() instead of tstr[] stringsFrancois-Xavier Le Bail2018-05-041-3/+2
| | | | | | | | Remove the tstr[] strings. Update the output of some tests accordingly. Moreover: Add or update some ndo_protocol fields.
* Remove the safeputchar() functionFrancois-Xavier Le Bail2018-05-021-1/+1
| | | | | | Print the characters filtering out non-printable with fn_print_char(). Update the output of some tests accordingly.
* 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/+2
| | | | | Update this field in printer entry functions. It will be used for some printings.
* Add and use tstr[]Francois-Xavier Le Bail2018-02-131-2/+4
| | | | Update the output of some tests accordingly.
* Have ip{6}addr_string take a u_char * as the second argument.Guy Harris2018-01-311-1/+1
| | | | Fix warnings that introduces.
* Use nd_ipv6 rather than struct in6_addr in packet-layout structures.Guy Harris2018-01-301-8/+8
| | | | Also, use it, and nd_ipv4, in sizeof() operations.
* 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-58/+58
|
* Use ND_TTEST_SIZE()/ND_TCHECK_SIZE() macros (1/n)Francois-Xavier Le Bail2018-01-031-2/+2
|
* Use nd_ types.Guy Harris2017-12-301-17/+17
|
* Remove all storage class specifier 'register'Francois-Xavier Le Bail2017-12-131-4/+4
| | | | | | Let the compiler do the optimizations (or not) based on build options. Avoid 'value has been optimized out' messages in gdb using '-O0'.
* Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)Francois-Xavier Le Bail2017-12-111-5/+5
| | | | | ND_TTEST2(var, l) -> ND_TTEST_LEN(p, l) ND_TCHECK2(var, l) -> ND_TCHECK_LEN(p, l)
* More EXTRACT_U_1() replacing direct dereferences.Guy Harris2017-12-081-2/+2
|
* Use more the EXTRACT_U_1() macro (35/n)Francois-Xavier Le Bail2017-11-301-1/+1
| | | | In some safeputchar() calls, *(p).
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-42/+42
| | | | | | | | | | | | | | | | 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 (18/n)Francois-Xavier Le Bail2017-11-211-2/+2
| | | | | | Assignment, *(p op e) Partial list.
* Use more the EXTRACT_8BITS() macro to fetch a one-byte value (12/n)Francois-Xavier Le Bail2017-11-201-2/+2
| | | | 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-2/+2
| | | | In bittok2str() calls.
* Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()Francois-Xavier Le Bail2017-11-181-37/+37
| | | | | It indicates clearly that these macros are used to extract big-endian integral values.
* Don't specify struct as "const" within sizeof().Denis Ovsienko2017-09-131-4/+4
| | | | | The only difference the const qualifier makes in this context is visual, make it consistent with the rest of the source code.
* zero change: update Hannes Gredler's emailHannes Gredler2017-07-281-1/+1
|
* Fix some names for MPLS PW types, and use that table for LDP.Guy Harris2016-10-081-5/+9
|
* Add a summary comment in all other printersFrancois-Xavier Le Bail2016-08-151-0/+2
| | | | | | | Moreover: Remove some redundant comments Update some summary comments Update the specification URL for ATA over Ethernet (AoE) protocol
* Don't require IPv6 library support in order to support IPv6 addresses.Guy Harris2015-09-171-6/+0
| | | | | | | | | | | | | 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.
* 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.
* clean K&R style up in function declarations a bitDenis Ovsienko2015-03-051-6/+6
| | | | The function body should have its opening brace on the next line.
* Strengthen various bounds etc. checks.Guy Harris2014-10-221-17/+42
| | | | | | | | Add more checks, make some checks do a better job of handling too-short lengths, Also, rename ldp_msg_print() to ldp_pdu_print(), as it prints a single PDU, not a single message within a PDU.
* u_intN_t is dead, long live uintN_t.Guy Harris2014-04-231-9/+9
| | | | | | | | | 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.
* Netdissectify the to-name resolution routines.Guy Harris2014-04-041-5/+5
| | | | | | | | 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.
* NDOize safeputs() and safeputchar()Denis Ovsienko2014-04-011-1/+1
|
* NDOize BGP decoderDenis Ovsienko2014-03-261-2/+2
|
* NDOize 7 bigger decodersDenis Ovsienko2014-03-191-82/+80
| | | | | This change converts IGMP, IPv6 mobility options, LDP, Lightweight Access Point, PGM, PPTP and RIP decoders.
* dismiss decode_prefix.hDenis Ovsienko2014-02-261-1/+0
| | | | | The only purpose of that header file was to provide two declarations that now fit interface.h same well.
* 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.
* ndo-ize print-ascii: hex_print_with_offset()Michael Richardson2014-01-011-4/+10
|
* whitespace changesMichael Richardson2014-01-011-12/+12
|
* Add some attribute/TLV length checks.Guy Harris2012-06-081-17/+70
| | | | | | | | | | | | | Make sure we don't run past the end of a BGP attribute or LDP TLV when dissecting the attribute/TLV. Make some of the code do a bit more of a "step the pointer through the data"-style dissection; that was done while debugging the changes in question. It also fixes up some code to not check for more data than should actually be there. Update references to RFC 4906 from the draft, and note that RFC 4447 replaces it.
* Fix a bunch of "sizeof(sizeof(XXX))".Sascha Wildner2011-12-071-1/+1
| | | | | | | | In some places, there was one too many levels of sizeof() - sizeof(sizeof(XXX)) is sizeof(size_t), but we wanted the size of type XXX. Reviewed-By: Guy Harris <guy@alum.mit.edu>