summaryrefslogtreecommitdiff
path: root/print-isakmp.c
Commit message (Collapse)AuthorAgeFilesLines
* IKEv2: add missing notification typesMatthias St. Pierre2023-03-051-43/+310
| | | | | | | | The notification type entries were crafted from the CSV files provided by IANA for the [error types] resp. [status types]. [error types]: https://www.iana.org/assignments/ikev2-parameters/ikev2-parameters-14.csv [status types]: https://www.iana.org/assignments/ikev2-parameters/ikev2-parameters-16.csv
* ISAKMP: Use GET_U_1() to replace a direct dereferenceFrancois-Xavier Le Bail2022-02-191-3/+3
| | | | | Moreover: Remove an unnecessary cast and an & operator.
* Put a space between type and '*' in pointer declarators (style)Francois-Xavier Le Bail2021-12-301-1/+1
|
* Remove useless 'return' at end of void functions (style)Francois-Xavier Le Bail2020-09-281-1/+0
|
* Remove 96 assorted ND_TCHECK calls.Denis Ovsienko2020-09-081-1/+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-9/+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.
* ESP: Rename two printersFrancois-Xavier Le Bail2020-03-081-3/+3
| | | | | | Rename esp_print_decodesecret() to esp_decodesecret_print() and esp_print_decrypt_buffer_by_ikev2() to esp_decrypt_buffer_by_ikev2_print() with _print suffix like in most similar cases.
* More bounds checking when fetching addresses and converting to strings.Guy Harris2020-01-191-8/+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.
* Don't use <ctype.h> macros.Guy Harris2019-09-011-2/+4
| | | | | | | | | | | | | | Some of them are locale-dependent, and all of them run the risk of failing if you hand them a char with the 8th bit set. Move our replacements to a new netdissect-ctype.h file, and, for the ones that check for particular character types, add _ASCII to the name, to indicate that only ASCII characters pass the check. Do the same for the ones that map between cases, to indicate that they only map ASCII letters. For isspace(), explicitly check for the characters we care about, to make it clearer what we're doing.
* Remove more old-compiler compensation.Guy Harris2019-08-081-1/+1
| | | | | | | | | | | | 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_ipv6 rather than struct in6_addrFrancois-Xavier Le Bail2019-06-101-1/+1
|
* Use nd_ipv4 rather than struct in_addrFrancois-Xavier Le Bail2019-06-101-1/+1
|
* Treat the length field in an Ethernet header as such.Guy Harris2019-04-221-1/+1
| | | | | | | | | | | | | | If we have an Ethernet packet where the last 2 octets of the header are a length rather than an Ethernet type, and it's less than the remaining length of the packet, shorten the length and captured length, update the snapshot end. Turn the buffer stack into a "packet information" stack, so that, if we *do* update the snapshot end, we push the old end onto the stack, and pop it off as soon as we're done dissecting the Ethernet packet, in case there's more data in the packet after the Ethernet packet. Use the stack when we use the IPv4 and IPv6 length fields as well.
* Introduce a buffer stack, and use it for ESP decryption.Guy Harris2019-03-301-0/+7
| | | | | | | | | | | | | | | If a dissector has to process its input - decryption, decompression, etc. - rather than dissect the raw input, it should push the processed input onto the buffer stack. As soon as the dissection is done, the stack should be popped, to free the buffer into which the processing was done, and restore the "pointer to packet data" and "pointer to end of packet data" members of the netdissect_options structure, so the code can go back to dissecting the original data. The stack will get everything popped off it when dissection is done. Use this mechanism in the ESP decryption code rather than scribbling on top of the input packet data.
* Have esp_print() handle printing its payload.Guy Harris2019-03-281-11/+7
| | | | | | That cleans things up a bit, including removing some duplicate code. Clean up some other things, and add a length check, while we're at it.
* Put IPv4/IPv6 protocol demultiplexing into a common routine.Guy Harris2019-03-271-2/+2
| | | | | | | That means less duplication of functionality - and less chance that XXX-over-IPv4 will be handled but XXX-over-IPv6 won't be handled, or *vice versa*. (CARP and VRRP were being handled over IPv4 but not over IPv6; this fixes that.)
* Fix typo in comment.Guy Harris2019-03-261-1/+1
| | | | [skip ci]
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-103/+116
| | | | | | | 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-7/+7
| | | | This parameter will be needed at the next step.
* ISAKMP: Simplify an expressionFrancois-Xavier Le Bail2019-02-271-2/+1
|
* Clean up whitespacesFrancois-Xavier Le Bail2019-02-271-1/+1
|
* Fix spacesFrancois-Xavier Le Bail2018-09-031-1/+1
|
* Add more nd_print_trunc() callsFrancois-Xavier Le Bail2018-06-061-4/+4
| | | | Update the output of some tests accordingly.
* 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.
* Remove a no more used 'volatile' qualifierFrancois-Xavier Le Bail2018-02-231-1/+1
|
* Rename some printer functions to *_printFrancois-Xavier Le Bail2018-02-221-1/+1
| | | | | Moreover: Fix spaces.
* Don't decrement an unsigned zero value below zero.Guy Harris2018-02-011-2/+4
| | | | | | | | | In fact, don't waste time incrementing the pointer or decrementing the count until we know that we're going to go through another trip through the loop. (This isn't a PDP-11 and probably isn't a VAX or 68k, so *p++ isn't going to be done by an addressing mode.) This should fix an undefined-behavior warning.
* Remove unneeded '&' when getting a pointer to a nd_ipv6 typeFrancois-Xavier Le Bail2018-01-311-4/+6
|
* Remove unneeded '&' when getting a pointer to a nd_ipv4 typeFrancois-Xavier Le Bail2018-01-311-4/+6
|
* Use nd_ipv6 rather than struct in6_addr in packet-layout structures.Guy Harris2018-01-301-12/+12
| | | | Also, use it, and nd_ipv4, in sizeof() operations.
* Add nd_{v}snprintf() routines/wrappers.Guy Harris2018-01-291-1/+1
| | | | | | | | Some versions of the MSVC runtime library have a non-C99-compliant vsnprintf(), which we want to avoid. On Windows, use snprintf() and vsnprintf() for VS 2015 and later, where they both exist in C99-compliant forms, and wrap _{v}snprintf_s() otherwise (they're guaranteed to do the null termination that we want).
* 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-255/+255
|
* Use ND_TTEST_SIZE()/ND_TCHECK_SIZE() macros (1/n)Francois-Xavier Le Bail2018-01-031-32/+32
|
* Put a variable only used if we have libcrypto under HAVE_LIBCRYPTO.Guy Harris2017-12-301-0/+2
|
* Fix decryption code path.Guy Harris2017-12-171-1/+4
| | | | | | | Thanks for making this hard to test on macOS, Apple. You *could* continue to ship the headers for libcrypto even if you want to get everybody to use your Shiny New SSL code rather than Boring Old OpenSSL - just don't ship the headers for the SSL library - but nooooooo.
* Clean up ISAKMP dissection, use nd_ types and EXTRACT_ macros.Guy Harris2017-12-171-412/+393
| | | | | | | | | | | | | | | | | | | | Add some RFC numbers. Structures with nd_ types work well if you overlay them on top of the packet buffer, but not as well with an on-the-stack structure into which you copy from the packet, which is ugly if you do *both* with the same structure. Use overlaying uniformly. Add EXTRACT_ macros as necessary for the nd_ types. Make stuff unsigned if it's appropriate. Use unsigned formats for unsigned values. A number of routines are passed the length of a payload, so they don't have to re-fetch that length themselves. That length has been pre-checked to make sure it's big enough for the payload header; note that in comments.
* Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)Francois-Xavier Le Bail2017-12-111-11/+11
| | | | | ND_TTEST2(var, l) -> ND_TTEST_LEN(p, l) ND_TCHECK2(var, l) -> ND_TCHECK_LEN(p, l)
* Use more the EXTRACT_U_1() macro (52/n)Francois-Xavier Le Bail2017-12-091-1/+1
| | | | Assignment, p[n]
* Use more the ND_TCHECK_1() macroFrancois-Xavier Le Bail2017-12-041-4/+4
|
* Use more the EXTRACT_U_1() macro (46/n)Francois-Xavier Le Bail2017-12-031-4/+4
| | | | In: if (... p[n] ...) ...
* Use more the EXTRACT_U_1() macro (43/n)Francois-Xavier Le Bail2017-12-031-2/+3
| | | | In: if (... p[n] ...) ...
* Simplify some expressionsFrancois-Xavier Le Bail2017-12-031-4/+4
|
* Use more the EXTRACT_U_1() macro (40/n)Francois-Xavier Le Bail2017-12-011-1/+1
| | | | | In some macros and functions calls. p[n], unsigned char *p.
* Use more the EXTRACT_U_1() macro (39/n)Francois-Xavier Le Bail2017-12-011-3/+4
| | | | In some macros and functions call, p[n]
* Use more the EXTRACT_U_1() macro (28/n)Francois-Xavier Le Bail2017-11-261-6/+7
| | | | | | In ND_PRINT() macro call(s) (step 7). p[n] ...
* Use pointer expressions like in most similar casesFrancois-Xavier Le Bail2017-11-231-5/+5
|