summaryrefslogtreecommitdiff
path: root/print-olsr.c
Commit message (Collapse)AuthorAgeFilesLines
* Rename min() and max() to ND_MIN() and ND_MAX(). [skip ci]Denis Ovsienko2020-08-241-1/+1
| | | | | As discussed on tcpdump-workers, it was a place for a potential clash with non-macros.
* More bounds checking when fetching addresses and converting to strings.Guy Harris2020-01-191-11/+11
| | | | | | | | | | | | | | 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.
* Fix some narrowing warnings on LP64/LLP64 platforms.Guy Harris2019-04-181-2/+2
| | | | | | | | | | | | Add a ND_BYTES_AVAILABLE_AFTER() macro to find the number of bytes available in the captured data, starting at the byte pointed to by the argument. It returns a u_int rather than a ptrdiff_t, so it'll be 32 bits on LP64 and LLP64 platforms as well as on ILP32 platforms. Use that macro. Make size-of-buffer arguments size_t. Cast some size_t and ptrdiff_t values to u_int or int.
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-29/+29
| | | | | | | 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.
* OLSR: Replace the ND_TTEST_*() calls with ND_TCHECK_*() callsFrancois-Xavier Le Bail2019-02-231-6/+9
|
* Add more nd_print_trunc() callsFrancois-Xavier Le Bail2018-05-101-1/+1
| | | | | | | Update the output of some tests accordingly. Moreover: Add a ndo_protocol field assignment.
* Rename the fn_printX() functions to nd_printX()Francois-Xavier Le Bail2018-04-301-1/+1
| | | | | | | 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.
* Don't decrement an unsigned value past zero.Guy Harris2018-02-011-1/+2
| | | | | | That also means we do one less decrement, so it's not as if testing exp-- rather than testing exp and separately decrementing it is an optimization.
* Use nd_ipv6 rather than struct in6_addr in packet-layout structures.Guy Harris2018-01-301-6/+6
| | | | 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-41/+41
|
* Use ND_TTEST_SIZE()/ND_TCHECK_SIZE() macros (1/n)Francois-Xavier Le Bail2018-01-031-2/+2
|
* Use nd_ types, add EXTRACT_ calls.Guy Harris2017-12-301-51/+52
|
* Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)Francois-Xavier Le Bail2017-12-111-12/+13
| | | | | ND_TTEST2(var, l) -> ND_TTEST_LEN(p, l) ND_TCHECK2(var, l) -> ND_TCHECK_LEN(p, l)
* Use more ND_TCHECK_n()/ND_TTEST_n() macrosFrancois-Xavier Le Bail2017-11-241-2/+2
|
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-13/+13
| | | | | | | | | | | | | | | | 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 EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()Francois-Xavier Le Bail2017-11-181-13/+13
| | | | | It indicates clearly that these macros are used to extract big-endian integral values.
* CVE-2017-13688/OLSR: Do bounds checks before we fetch data.Guy Harris2017-09-131-9/+12
| | | | | | | | | | | While we're at it, clean up some other bounds checks, so we check that we have a complete IPv4 message header if it's IPv4 and a complete IPv6 message header if it's IPv6. This fixes a buffer over-read discovered by Bhargava Shastry, SecT/TU Berlin. Add tests using the capture files supplied by the reporter(s).
* zero change: update Hannes Gredler's emailHannes Gredler2017-07-281-1/+1
|
* 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
* Don't require IPv6 library support in order to support IPv6 addresses.Guy Harris2015-09-171-23/+2
| | | | | | | | | | | | | 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
|
* Fix warnings as "ISO C90 does not support the '%lf' gnu_printf format"Francois-Xavier Le Bail2015-08-181-7/+7
| | | | | The complete warnings were: ISO C90 does not support the '%lf' gnu_printf format [-Wformat=]
* OLSR: Fix indent and commentsFrancois-Xavier Le Bail2015-05-041-15/+29
| | | | | Avoid too long lines. Not all C compilers accept C++/C99 comments by default.
* olsr: fix printing of smart-gateway HNAs in IPv4Ferry Huberts2015-05-031-4/+76
| | | | Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
* olsr: fix 'Advertised networks' countFerry Huberts2015-05-031-2/+8
| | | | Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
* Fix a bunch of de-constifications.Guy Harris2015-04-261-15/+15
|
* 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.
* OLSR: fix "Unchecked return value" found by CoverityFrancois-Xavier Le Bail2014-12-081-1/+1
| | | | | | | The bounds check is already done before by ND_TCHECK2(*msg_data, addr_size + name_entry_len + name_entry_padding). So we are deliberately ignoring the return values of fn_printn with last argument NULL (no bounds check).
* Do more bounds checking and length checking.Guy Harris2014-11-111-13/+43
| | | | | | | Don't run past the end of the captured data, and don't run past the end of the packet (i.e., don't make the length variable go negative). Also, stop dissecting if the message length isn't valid.
* don't reinvent ND_TCHECK2()Denis Ovsienko2014-06-121-23/+11
|
* u_intN_t is dead, long live uintN_t.Guy Harris2014-04-231-38/+38
| | | | | | | | | 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 the rest of util.cDenis Ovsienko2014-04-141-1/+1
|
* Netdissectify the to-name resolution routines.Guy Harris2014-04-041-12/+12
| | | | | | | | 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.
* OLSR: work around MSVC preprocessor (re 48d8b05)Gisle Vanem2014-04-031-3/+6
|
* convert some stray printf()'sDenis Ovsienko2014-04-021-6/+2
|
* NDOize ForCES, MPLS LSP ping and OLSR decodersDenis Ovsienko2014-03-271-64/+65
|
* justify MIN()/min() further (complements dbfdf97)Denis Ovsienko2014-03-151-1/+1
|
* ndo-ize print-ascii: hex_print_with_offset()Michael Richardson2014-01-011-1/+1
|
* 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.
* Fix up length checking for the MID message to check before *each*Guy Harris2009-06-281-20/+32
| | | | | | | | | | | | interface address, not just the *first* interface address. For the name service message: add length checking, both against truncated packets and bogus lengths; use fn_printn to print the name, to protect against control characters, etc. in the name.
* Just use u_int, even for values that fit in 16 bits; that squelches aGuy Harris2009-05-211-3/+3
| | | | | (irrelevant, but true for the way C works) signed vs. unsigned comparison warning. It also probably produces better machine code.
* print-olsr: Add basic IPv6 support.Florian Forster2009-05-211-80/+257
| | | | | | | | | | | | | | | | | | | Unfortunately OLSR uses the same IDs for IPv4 and IPv6 packets, even though the size of "messages" differ. The version of the internet protocol is therefore handed to the "olsr_print" function. The code isn't very nice, due to a high density of #ifdef INET6'es. If IPv6-support really should be optional, I'm afraid this is inevitable. Both, compilation with and without IPv6 support has been tested. The patch addresses fixes other issues, too. The length given in the packet was used for pointer arithmetic without checking if the value was in a reasonable range first in several places. It should now be possible to decode more than one "namespace message" within a single packet. Other changes remove trailing whitespace or fix lines indented with tabs (the majority of the file is indented using spaces). Signed-off-by: Florian Forster <octo@leeloo.lan.home.verplant.org>
* Get rid of trailing whitespace.Guy Harris2009-05-211-10/+10
|
* print-olsr: Don't trust the package payload.Florian Forster2009-05-211-2/+11
| | | | | | | | | | Especially not to do pointer arithmetic. This is a real problem even without malicious people around if you use OLSR via IPv6, because the message IDs didn't change but addresses are now longer than four bytes. Signed-off-by: Florian Forster <octo@leeloo.lan.home.verplant.org>
* add support for the nameservice plugin messages generated by www.olsr.orghannes2008-08-161-2/+33
|