summaryrefslogtreecommitdiff
path: root/print-isoclns.c
Commit message (Collapse)AuthorAgeFilesLines
* Switch print-isoclns.c to AFNUM_ code points. [skip ci]Denis Ovsienko2023-02-221-12/+13
| | | | | Same as in other printers just before, since this use case is neither the OS API nor the wire encoding,
* Spell "indent" where it belongs.Denis Ovsienko2021-03-281-41/+41
|
* Replace ND_TCHECK_/memcpy() pairs with GET_CPY_BYTES().Guy Harris2021-01-051-4/+1
| | | | | | | | | For BGP, this eliminates some cases where routines return -1 on truncation; clean up after that. This also means that some memcpy()s get replaced by UNALIGNED_MEMCPY(), which may fix some issues on processors that don't support unaligned accesses.
* ISIS: Replace the 'if (nd_printzp()) goto trunc' by nd_printjnp() callsFrancois-Xavier Le Bail2020-12-101-6/+3
| | | | | Moreover: Use the sizeof operator.
* Use MAC_ADDR_LEN in a few more places. [skip ci]Denis Ovsienko2020-09-191-1/+1
|
* Remove 7 more ND_TCHECK calls.Denis Ovsienko2020-09-081-4/+0
|
* Remove some now redundant ND_TCHECK_LEN(e, sizeof(nd_ipv4)) callsFrancois-Xavier Le Bail2020-09-081-4/+0
| | | | | | | They are redundant because they are followed by a GET_IPADDR_STRING(e) call, same e, which do the bounds check. Remove unused 'trunc' label(s) and associated code(s).
* Remove 96 assorted ND_TCHECK calls.Denis Ovsienko2020-09-081-10/+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 some now redundant ND_TCHECK_LEN(e, sizeof(nd_ipv6)) callsFrancois-Xavier Le Bail2020-09-071-2/+0
| | | | | | | They are redundant because they are followed by a GET_IP6ADDR_STRING(e) call, same e, which do the bounds check. Remove unused 'trunc' label(s) and associated code(s).
* Remove many (762) now redundant ND_TCHECK_n() callsFrancois-Xavier Le Bail2020-09-061-35/+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.
* esis: explain why we're doing ND_TTEST_LEN(pptr, 1).Guy Harris2020-05-271-0/+4
|
* isis: add some additional length checks.Guy Harris2020-05-261-0/+4
| | | | | Make sure the length in question is big enough before fetching data and subtracting from it.
* esis: use ND_TTEST_LEN() and ND_BYTES_BETWEEN() on pointers.Guy Harris2020-05-261-2/+2
| | | | | | | Using ND_TTEST_LEN() makes the check a bit more stringent. Using ND_BYTES_BETWEEN() casts the difference to a u_int, so it's 1) unsigned and 2) not 64-bit on LP64 or LLP64 platforms.
* clnp: use ND_BYTES_BETWEEN() to get the bytes between two packet pointers.Guy Harris2020-05-261-2/+2
| | | | | That'll cast it to a u_int, so it's 1) unsigned and 2) not 64-bit on LP64 or LLP64 platforms.
* IS-IS: Add LAN Adjacency Segment Identifier subTLVckishimo2020-05-251-0/+47
| | | | | | | | | | | | | | Adapted from GitHub pull request #798. Print " (invalid)" when combinations of V-Flag and L-Flag are invalid. Update comments (draft -> RFC). Remove some ND_TCHECK_LEN because GET_ use. Update the output of isis_sid test because commit b09710dfcdd50251efd487e800cd1b9fd01eaf96 updated the output format of the IS-IS dissector.
* IS-IS: Add support for Node/Prefix SIDs as per rfc 8667Hannes Gredler2020-04-071-6/+157
| | | | (pull request #845)
* Parse the IS-IS Instance Identifier TLV from RFC8202Manoharan Sundaramoorthy2020-02-211-24/+20
|
* More bounds checking when fetching addresses and converting to strings.Guy Harris2020-01-191-25/+25
| | | | | | | | | | | | | | Replace more calls to ipaddr_string()/ip6addr_string() with calls to GET_IPADDR_STRING()/GET_IP6ADDR_STRING() macros performing bounds checking. Add similar bounds-checking inline functions and macros to wrap linkaddr_string(), etheraddr_string(), and isonsap_string() and convert calls to them to use the macros as well. Shuffle the inline functions in addrtoname.h around a bit, so that the inline functions, external declarations, and macros are all in the same order.
* IS-IS: Use %zu to print sizeof valuesFrancois-Xavier Le Bail2019-11-091-1/+1
|
* IS-IS: Fix some undefined behaviors at runtimeFrancois-Xavier Le Bail2019-11-081-6/+13
| | | | | | | | | | | The error were like: print-isoclns.c:2583:20: runtime error: unsigned integer overflow: 20 - 27 cannot be represented in type 'unsigned int' print-isoclns.c:2525:20: runtime error: unsigned integer overflow: 0 - 20 cannot be represented in type 'unsigned int' Update the output of two tests accordingly.
* Cleaning spacesFrancois-Xavier Le Bail2019-11-071-6/+6
| | | | [skip ci]
* add isis router capability TLVckishimo2019-09-041-0/+23
|
* Use more HTTPS in URLsFrancois-Xavier Le Bail2019-08-191-1/+1
| | | | [skip ci]
* More use of %zu to print sizeof values.Guy Harris2019-08-111-12/+12
|
* Remove more old-compiler compensation.Guy Harris2019-08-081-5/+5
| | | | | | | | | | | | 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.
* Use nd_print_protocol_caps() to print the protocol name in capsFrancois-Xavier Le Bail2019-06-231-1/+1
|
* Fix trailing spacesFrancois-Xavier Le Bail2019-05-231-1/+1
|
* Clean up TLV processing.Guy Harris2019-05-141-123/+195
| | | | | | | | | | | | | | | Do more checks for running past the TLV or subTLV length. For errors where we go past the TLV or subTLV length, report that as a separate error from just "ran past the end of the packet". When looping over TLVs or subTLVs, loop as long as there's data available and, if there isn't *enough* data available within the TLV or subTLV, report that as a "ran past the end of the TLV/subTLV" error. In isis_print_ext_is_reach(), correctly calculate the number of bytes we process - that amount is smaller for the Alias TLV than for other TLVs, as the Alias TLV doesn't have a Metric field.
* Squelch more warnings.Guy Harris2019-04-171-14/+14
|
* Clean up types to squelch narrowing warnings.Guy Harris2019-04-171-2/+3
|
* IS-IS: Simplify some expressionsFrancois-Xavier Le Bail2019-04-091-37/+37
|
* ISOCLNS: Replace printf by ND_PRINT even when "#if 0"ed-outFrancois-Xavier Le Bail2019-04-091-1/+1
|
* IS-IS: Fix some loops for undefined behavior at runtimeFrancois-Xavier Le Bail2019-04-081-21/+50
| | | | | | | | | Same bugfixes than in previous commit, based on a code inspection. Update the output of a test accordingly. Moreover: Clean up whitespaces/indentation.
* IS-IS: Fix a loop for undefined behavior at runtimeFrancois-Xavier Le Bail2019-04-081-4/+9
| | | | | | | | | | | The error was: print-isoclns.c:2822:7: runtime error: unsigned integer overflow: 4 - 6 cannot be represented in type 'unsigned int' Update the output of a test accordingly. Moreover: Clean up whitespaces/indentation.
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-212/+220
| | | | | | | 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-27/+27
| | | | This parameter will be needed at the next step.
* IS-IS: Fix inaccurate variable namesFrancois-Xavier Le Bail2019-03-101-98/+98
|
* Clean up whitespaces/indentationFrancois-Xavier Le Bail2019-02-271-20/+20
|
* IS-IS: Replace some ND_TTEST_*() calls with ND_TCHECK_*() callsFrancois-Xavier Le Bail2019-02-251-24/+18
|
* Fix small misspellingsAntonin Décimo2019-01-231-2/+2
|
* Clean up some narrowing warnings.Guy Harris2018-09-231-7/+7
| | | | | | | Cast pointer differences, widen some variables, make some function returns unsigned as they never return a negative number. Fix a format while we're at it.
* Fix the variable for the packet length.Guy Harris2018-09-231-1/+2
| | | | | The length passed in is a u_int, so we should assign it to a u_int, not a u_short.
* Add the nd_print_invalid() functionFrancois-Xavier Le Bail2018-09-111-1/+2
| | | | | | | It prints " (invalid)", used for malformed or corrupted packets. Moreover: Update CONTRIBUTING.
* CLNP: Squelch a cppcheck warning (GH #629)Denis Ovsienko2018-07-301-1/+1
| | | | | | | | | See also commit f944e1e39. [print-isoclns.c:906] -> [print-isoclns.c:910]: (warning) Opposite inner 'if' condition leads to a dead code block. [skip ci]
* CLNP: squelch a fall-through warning (GH #618)Denis Ovsienko2018-07-261-1/+13
| | | | | | | | | | | | | | This change addresses one of the warnings listed in the bug report. ./print-isoclns.c: In function ‘clnp_print’: ./print-isoclns.c:1054:16: warning: this statement may fall through [-Wimplicit-fallthrough=] if (EXTRACT_U_1(pptr) == NLPID_CLNP) { ^ ./print-isoclns.c:1061:9: note: here case CLNP_PDU_DT: ^~~~ [skip ci]
* ES-IS,IS-IS: Add two missing returnFrancois-Xavier Le Bail2018-05-251-0/+3
| | | | Update the output of some tests accordingly.
* Add a nd_print_trunc() callFrancois-Xavier Le Bail2018-05-181-4/+4
| | | | | Replace a ND_TTEST_*() with ND_TCHECK_*(). Update the output of some tests accordingly.
* Print truncations with nd_print_trunc() instead of tstr[] stringsFrancois-Xavier Le Bail2018-05-041-11/+10
| | | | | | | | 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-3/+3
| | | | | | | 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
|