summaryrefslogtreecommitdiff
path: root/print-ospf.c
Commit message (Collapse)AuthorAgeFilesLines
* OSPF: Remove two unnecessary dereferencesFrancois-Xavier Le Bail2022-02-181-4/+2
| | | | Remove also two unnecessary ND_TCHECK_SIZE().
* OSPF: Update more router properties bits. [skip ci]Denis Ovsienko2021-01-231-2/+3
|
* ospf: add support bit Nt RFC3101ckishimo2021-01-231-0/+1
|
* Replace the (void)nd_printzp() calls by nd_printjnp() callsFrancois-Xavier Le Bail2020-12-101-1/+1
|
* OSPF: Use %zu to print sizeof valuesFrancois-Xavier Le Bail2020-11-041-2/+2
|
* OSPF: Modernize some code.Denis Ovsienko2020-10-061-23/+14
| | | | | | | | | | | | | | | Make a few one-byte fetches use GET_U_1(). In ospf_print_tos_metrics() lose an excess ND_TCHECK_SIZE() and make the function void. Make ospf_decode_lls() void -- the only case when it returned a non-zero value was if the LLS block is invalid, and it already signals that with a message. It is a separate matter if the invalid packet is also truncated, and since there is no proper check for that, just return without printing a misleading message. Switch ospf_print() to nd_trunc_longjmp().
* OSPF: Update the option bit props.Denis Ovsienko2020-10-021-2/+2
| | | | | | | Bit 0x10 was once going to be EA-bit, but eventually was allocated to L-bit instead, so remove the EA-bit. Bit 0x01 was allocated to T-bit, which was later renamed to MT-bit, so rename it. Make some indentation consistent.
* Remove some now redundant ND_TCHECK_4() callsFrancois-Xavier Le Bail2020-09-081-9/+0
| | | | | | | | | | | ND_TCHECK_4(e). They are redundant because they are followed by a GET_IPADDR_STRING(e) call, same e, which do the bounds check. Remove unused 'trunc' labels and associated codes. Update the output of a test accordingly.
* Remove 96 assorted ND_TCHECK calls.Denis Ovsienko2020-09-081-4/+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-30/+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.
* ospf: make more variables unsigned.Guy Harris2020-05-271-8/+14
| | | | | | | | Make lengths unsigned, and note some cases where it's known that subtracting an item size from the length will not underflow. Redo a loop so that it stops as soon as the count goes to zero and doesn't decrement, and thus underflow, its value once it goes to zero.
* ospf: clean up some length checks.Guy Harris2020-05-261-1/+16
| | | | | | | | | | | | In the loop for LS_OPAQUE_TE_TLV_LINK, loop until the remaining TLV length is 0; we're already checking, first thing in the loop, that the remaining length is at least 4, so we can process the T and the L. For each sub-TLV of LS_OPAQUE_TE_TLV_LINK, make sure the sub-tlV doesn't go past the end of the TLV. If we compute the padded TLV or sub-TLV length, redo the check, to make sure the padded length isn't too big.
* ospf: when processing LS_OPAQUE_TYPE_RI, don't modify ls_length.Guy Harris2020-05-261-8/+9
| | | | | | Modifying it means that the "print the LSA in hex" code will only print what remains of the LSA - unlike other LSAs, where it's printed in its entirety.
* More bounds checking when fetching addresses and converting to strings.Guy Harris2020-01-191-31/+31
| | | | | | | | | | | | | | 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.
* More use of %zu to print sizeof values.Guy Harris2019-08-111-2/+2
|
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-98/+101
| | | | | | | 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.
* 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 safeputs() functionFrancois-Xavier Le Bail2018-05-021-1/+1
| | | | Use the nd_printzp() function instead.
* 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.
* Rename some printer functions to *_printFrancois-Xavier Le Bail2018-02-221-4/+4
| | | | | Moreover: Fix spaces.
* Remove unneeded '&' when getting a pointer to a nd_ipv4 typeFrancois-Xavier Le Bail2018-01-311-1/+1
|
* Have ip{6}addr_string take a u_char * as the second argument.Guy Harris2018-01-311-15/+15
| | | | Fix warnings that introduces.
* Use EXTRACT_IPV4_TO_NETWORK_ORDER() when checking an address against 0.Guy Harris2018-01-301-3/+3
| | | | | It may do less work than EXTRACT_IPV4_TO_HOST_ORDER(), and the byte order doesn't matter when comparing against 0.
* Use nd_ipv4 rather than struct in_addr.Guy Harris2018-01-301-29/+29
| | | | | | This ensures that we have no purportedly-aligned-but-not-necessarily- unaligned values that we access; we have to use EXTRACT_ macros/functions to get at IPv4 address values.
* OSPF: Use more ND_TCHECK_SIZE() macrosFrancois-Xavier Le Bail2018-01-241-4/+4
|
* OSPF: Use more ND_TCHECK_n() macrosFrancois-Xavier Le Bail2018-01-241-9/+9
|
* Use more ND_TCHECK_n() macrosFrancois-Xavier Le Bail2018-01-221-18/+18
|
* 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
|
* Clean up signed vs. unsigned.Guy Harris2018-01-111-10/+10
|
* Update ND_PRINT() as a variadic macroFrancois-Xavier Le Bail2018-01-071-165/+165
|
* Use ND_TTEST_SIZE()/ND_TCHECK_SIZE() macros (1/n)Francois-Xavier Le Bail2018-01-031-5/+5
|
* Use 'u_char *' type for input buffer pointer like in most similar casesFrancois-Xavier Le Bail2018-01-021-4/+4
|
* Make 1-element arrays for fields that may repeat.Guy Harris2017-12-231-3/+3
| | | | | | | | | | | For various opaque LSAs, not only is the value of the TLV a "may repeat", the TLVs *themselves* may repeat. Also, pass a pointer to the TLV to ospf_print_grace_lsa() and ospf_print_te_lsa(), rather than a pointer to the type field, as they dissect a sequence of TLVs. Hopefully, that will address Coverity CID 1426916, 1426917, and 1426920.
* OSPF: Fix two bounds checksFrancois-Xavier Le Bail2017-12-171-2/+2
| | | | | ND_TCHECK(*lp) test for only one byte. A test for four bytes is needed.
* Use nd_ types for OSPF and OSPF6 packets.Guy Harris2017-12-141-69/+73
| | | | | | And add EXTRACT_ calls as required. Remove no-longer-necessary & operators in EXTRACT_ calls.
* Remove all storage class specifier 'register'Francois-Xavier Le Bail2017-12-131-29/+29
| | | | | | 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-4/+4
| | | | | 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 (31/n)Francois-Xavier Le Bail2017-11-271-3/+3
| | | | | | In ND_PRINT() macro call(s) (step 9). *(p)
* Use more ND_TCHECK_n()/ND_TTEST_n() macrosFrancois-Xavier Le Bail2017-11-241-6/+6
|
* Use more ND_TCHECK_n() macrosFrancois-Xavier Le Bail2017-11-241-5/+5
|
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-63/+63
| | | | | | | | | | | | | | | | 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 (2/n)Francois-Xavier Le Bail2017-11-191-5/+5
| | | | In tok2str() 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-57/+57
| | | | | It indicates clearly that these macros are used to extract big-endian integral values.
* OSPF: refine unknown packet type handlingDenis Ovsienko2017-02-021-9/+1
| | | | | | As far as modern OSPF implementations are concerned, packet type 0 is not a valid value, so let's print it as such. Also for an invalid packet type tell its decimal value.
* Add a bounds check.Guy Harris2017-01-181-0/+1
| | | | The bounds check for the Hello packet options was missing.
* 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