summaryrefslogtreecommitdiff
path: root/print-lisp.c
Commit message (Collapse)AuthorAgeFilesLines
* LISP: don't decrement count variables unless we know they're not zero.Guy Harris2021-11-151-3/+4
| | | | This fixes some undefined behavior warnings.
* Lose some more unnecessary #include lines. [skip ci]Denis Ovsienko2020-11-271-1/+0
| | | | | This trivial change compiles fine with GCC 7.5.0 on Linux and Clang 10.0.1 on FreeBSD, so let's not run the full round of CI this time.
* Include <string.h> only if required.Denis Ovsienko2020-10-171-1/+0
|
* Remove useless 'return' at end of void functions (style)Francois-Xavier Le Bail2020-09-281-3/+0
|
* Remove some now redundant ND_TCHECK_4() callsFrancois-Xavier Le Bail2020-09-081-1/+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 some now redundant ND_TCHECK_16() callsFrancois-Xavier Le Bail2020-09-071-1/+0
| | | | | | | ND_TCHECK_16(e). They are redundant because they are followed by a GET_IP6ADDR_STRING(e) call, same e, which do the bounds check.
* lisp: don't call hex_print_with_offset() with a zero offset.Guy Harris2020-05-251-3/+3
|
* More bounds checking when fetching addresses and converting to strings.Guy Harris2020-01-191-6/+8
| | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | 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-20/+20
| | | | | | | 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.
* Fix space printing with istr[]Francois-Xavier Le Bail2018-05-181-1/+1
| | | | | | | Because istr[] is assign to " (invalid)", avoid adding a space before it. Moreover: Avoid also useless '\n'
* Print truncations with nd_print_trunc() instead of tstr[] stringsFrancois-Xavier Le Bail2018-05-041-2/+1
| | | | | | | | Remove the tstr[] strings. Update the output of some tests accordingly. Moreover: Add or update some ndo_protocol fields.
* 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.
* Remove function specifier 'inline' in printersFrancois-Xavier Le Bail2018-01-261-4/+6
| | | | | | | | It was mostly used with large functions. Moreover: Put some function definition names at the beginning of line. Fix a space.
* 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-31/+31
|
* Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)Francois-Xavier Le Bail2017-12-111-4/+6
| | | | | ND_TTEST2(var, l) -> ND_TTEST_LEN(p, l) ND_TCHECK2(var, l) -> ND_TCHECK_LEN(p, l)
* Make nd_uint8_t and nd_int8_t arrays, to catch direct references.Guy Harris2017-12-101-19/+21
| | | | | | | | | | This catches direct references, so we can change them to use EXTRACT_U_1 or EXTRACT_S_1. Also, change some structures to use the nd_ types that weren't already using them. Then make the appropriate EXTRACT_{U,S}_1() changes.
* Use more ND_TCHECK_n()/ND_TTEST_n() macrosFrancois-Xavier Le Bail2017-11-241-4/+4
|
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-9/+9
| | | | | | | | | | | | | | | | 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-9/+10
| | | | | It indicates clearly that these macros are used to extract big-endian integral values.
* Put some function definition names at the beginning of lineFrancois-Xavier Le Bail2017-11-161-1/+2
|
* LISP: include local netdissect.h firstDenis Ovsienko2017-03-121-1/+1
| | | | | This doesn't fix any known issue, just for consistency with all other decoders.
* Add a summary comment in all other printersFrancois-Xavier Le Bail2016-08-151-2/+3
| | | | | | | Moreover: Remove some redundant comments Update some summary comments Update the specification URL for ATA over Ethernet (AoE) protocol
* call ipaddr_string() instead of getname()Denis Ovsienko2016-07-111-2/+2
| | | | Same as in the previous commit.
* call ip6addr_string() instead of getname6()Denis Ovsienko2016-07-111-2/+2
| | | | | This replaces a few explicit type casts with one type cast in the macro and makes the source code mean one thing with one term instead of two.
* Change istr[] (for invalid string) to be globalFrancois-Xavier Le Bail2016-01-281-1/+0
|
* LISP: Add and use istr[] and tstr[] stringsFrancois-Xavier Le Bail2015-11-211-10/+9
| | | | | | | Update the output of a test accordingly. Moreover: Delete extra blank lines.
* Fix a commentFrancois-Xavier Le Bail2015-10-081-1/+1
| | | | | Moreover: s/tcpdump/netdissect/
* Introduce data types to use for integral values in packet structures.Guy Harris2015-10-061-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | They are defined as arrays of bytes, so 1) no padding is inserted before them to put them on natural boundaries, so they can be used if the values *aren't* so aligned; 2) you have to use EXTRACT_ macros with them - which you should be doing *anyway*, to avoid explicitly or implicitly making assumptions about byte order or alignment safety on the platform for which your code is being built (it'd better work when built for little-endian x86 or for big-endian *and* strict-alignment-requiring SPARC). Use them in the LISP (no, not the programming language!) dissector; UNALIGNED means "this structure is not guaranteed to be aligned as a whole, so don't generate code that assumes it is", not "this structure's individual members shouldn't have padding to put them on natural boundaries", so it's not sufficient to do that. (Using these types *might* suffice to ensure that code that assumes alignment not be generated, but never underestimate SPARC compilers' eagerness to use single load and store instructions to fetch big-endian 16-bit, 32-bit, and 64-bit values from packets that really aren't guaranteed to be aligned.)
* LISP: Fix a Clang warningFrancois-Xavier Le Bail2015-10-051-2/+1
| | | | | | | | | | | | | | | The warning was: ./print-lisp.c:401:11: warning: variable 'xtr_present' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] else if (type == LISP_MAP_NOTIFY) ^~~~~~~~~~~~~~~~~~~~~~~ ./print-lisp.c:404:9: note: uninitialized use occurs here return xtr_present; ^~~~~~~~~~~ Moreover: Remove unused 'interface.h' include.
* LISP: We always support IPv6 addresses nowFrancois-Xavier Le Bail2015-10-051-10/+0
| | | | INET6 is no more used.
* Initial commit for support of Type 3 and Type 4 LISP packets.ritsz2015-10-041-0/+461
Fixing Travis CI build for LISP commit Adding testcases for lisp notify and register Fixing build warnings Added ND_TCHECK for relevant headers Fixing ND_TCHECK2 issues Adding support for multiple LOC records for same EID entry Fixing review issues, adding detailed tests Adding support for verbose outputs Adding RFC information for UDP PORT defination Removing Spaces in type names Print EID record related flags in verbose mode Using tok2str Fixing -Wpedantic issues Negative testcases, Packet structure comments, verbose mode flag printing Printing Map Version Print auth_data, decouple type and xtr_present extraction, handle malformed packets correctly Tests for latest code changes Printing useful info incase not built with IPv6 support