summaryrefslogtreecommitdiff
path: root/print-geneve.c
Commit message (Collapse)AuthorAgeFilesLines
* Put "}" at beginning of line with "else" to keep a consistent styleFrancois-Xavier Le Bail2023-04-211-2/+1
| | | | [skip ci]
* Geneve: Add a bounds checkFrancois-Xavier Le Bail2023-04-111-1/+2
|
* Geneve: update format_opt_classDror Eiger2022-04-031-0/+52
| | | | | Per https://www.iana.org/assignments/nvo3/nvo3.xhtml Also add test for GCP
* Update the ND_LCHECK*() macros to ND_ICHECK*() macrosFrancois-Xavier Le Bail2021-12-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | ICHECK like Invalid-Check. Reminder: If the checked expression is true an error message is printed and a 'goto invalid' is executed. This change adds the parameter 'operator'. Before this change, '<' comparison was hard coded. We can do now: ND_ICHECK_U(length, <, HEADER_LEN); ND_ICHECK_U(length, ==, 24); ND_ICHECK_U(length, !=, 8); ND_ICHECK_ZU(length, <, sizeof(struct my_struct)); ND_ICHECKMSG_U("message length", msg_tlen, <, 4); ... (Any comparison operator) Remark: The change of names from ND_LCHECK*() to ND_ICHECK*() is because something else than a length(L) can be checked. Moreover: Place the 'message' parameter at the beginning of ND_ICHECKMSG_U() and ND_ICHECKMSG_ZU() paramaters lists.
* Try the new ND_LCHECK*() macros. [skip ci]Denis Ovsienko2021-01-171-8/+2
|
* Geneve: Modernize packet parsing style.Denis Ovsienko2021-01-061-22/+38
| | | | | | | | | Enable ND_LONGJMP_FROM_TCHECK. Remove one redundant ND_TCHECK_*() instance and make another one conditional. Report invalid packets as invalid. Test that a non-Ethernet payload is fully within the packet buffer. Add a length check to geneve_opts_print() and have it indicate invalid tunnel options. Constify an argument. Update the packet diagrams and refer to the RFC rather than the draft.
* Rework "Update more link-layer dissectors to void functions"Francois-Xavier Le Bail2020-08-061-1/+1
| | | | | | | | | | It's a follow-up to commit 81dbf4a0b05092760d0ff0cdd48c692e4769ba99. There is no need to update ether_print(), ether_common_print() and ether_switch_tag_print() to void functions: back to u_int functions. There is also no need to add a flag parameter to ether_print(), ether_common_print() and ether_switch_tag_print(): Remove it.
* Update more link-layer dissectors to void functionsFrancois-Xavier Le Bail2020-07-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | brcm_tag_if_print() brcm_tag_prepend_if_print() dsa_if_print() edsa_if_print() ether_if_print() netanalyzer_if_print() netanalyzer_transparent_if_print() Update ether_print(), ether_common_print() and ether_switch_tag_print() to void functions. Add a flag parameter to ether_print(), ether_common_print() and ether_switch_tag_print() to increment the link-layer header length field of the netdissect_options when needed. The calls use TRUE when the return value of the funtions was used. The calls with FALSE avoid increments when the calls are nested. Moreover: Remove trailing "_if" from some protocol names.
* Geneve: Add a length checkFrancois-Xavier Le Bail2019-06-091-0/+6
|
* 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-9/+9
| | | | | | | 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 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.
* 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.
* 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-23/+23
|
* Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)Francois-Xavier Le Bail2017-12-111-1/+1
| | | | | 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 (33/n)Francois-Xavier Le Bail2017-11-291-1/+1
|
* Use more ND_TCHECK_n()/ND_TTEST_n() macrosFrancois-Xavier Le Bail2017-11-241-1/+1
|
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-8/+8
| | | | | | | | | | | | | | | | 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 (18/n)Francois-Xavier Le Bail2017-11-211-1/+1
| | | | | | Assignment, *(p op e) Partial list.
* More EXTRACT_8BITS() changes. Use ND_CHECK_nBITS() more as well.Guy Harris2017-11-191-3/+3
|
* Rename EXTRACT_nBITS() macros to EXTRACT_BE_nBITS()Francois-Xavier Le Bail2017-11-181-4/+4
| | | | | It indicates clearly that these macros are used to extract big-endian integral values.
* pass correct caplen to other functions as wellDenis Ovsienko2017-01-181-1/+1
| | | | | | | | | | In ethertype_print(), isoclns_print() and snap_print() adjust the length arithmetics along the same lines as for ether_print() in the previous commit. Where done, the current pointer is not greater than snapend so that the difference (i.e. caplen) is never negative. This does not fix a reported issue but the problem was very likely to be there.
* CVE-2017-5342/pass correct caplen value to ether_print()Denis Ovsienko2017-01-181-1/+1
| | | | | | | | | | | | | | | In that function the "length" parameter means off-the-wire length, that is, the length declared inside the outer header. The "caplen" parameter means the amount of bytes actually available in the captured packet. gre_print_0() and the functions modelled after it passed the value of "length" instead of the value of "caplen", this could make ether_print() access beyond the memory allocated for the captured packet. Brian Carpenter had demonstrated this for the OTV case. Fix the involved functions that call ether_print() to pass the correct value and leave a comment to dismiss "caplen" later as its value can be reliably derived from the other ether_print() parameters.
* CVE-2016-7985,7986/Change the way protocols print link-layer addresses.Guy Harris2017-01-181-1/+1
| | | | | | | | | | | | | | | If a protocol that runs under a link-layer protocol would print the link-layer addresses for the packet as source and destination addresses for the packet, don't have it blithely assume those link-layer addresses are present or are at a particular offset from the beginning of that protocol's data; Ethertypes, for example, are used by a number of protocols, not all of which have Ethernet headers and not all of which have any MAC headers. Instead, pass the printers for those protocols structures with a pointer to the address data and a pointer to a routine that prints the address. Fixes some heap overflows found with American Fuzzy Lop by Hanno Böck.
* Add a summary comment in all other printersFrancois-Xavier Le Bail2016-08-151-0/+2
| | | | | | | Moreover: Remove some redundant comments Update some summary comments Update the specification URL for ATA over Ethernet (AoE) protocol
* Update list of Geneve option classes.Jesse Gross2016-07-111-7/+20
| | | | | | Newer versions of the Geneve protocol draft have defined additional option classes. This updates the list so we can show the class name instead of unknown.
* Fix error message with invalid Geneve option length.Jesse Gross2016-07-111-1/+1
|
* Don't rely on uint being defined.Guy Harris2015-09-141-1/+1
|
* 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
|
* Avoid colliding with a tcpdump routine's name.Guy Harris2015-08-311-3/+3
| | | | | Just call the variable "data", not "print_data"; we're obviously printing it.
* Fix a bunch of de-constifications.Guy Harris2015-04-261-1/+1
|
* 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.
* Add support for Generic Network Virtualization Encapsulation (Geneve).Jesse Gross2014-11-051-0/+223
Defined in http://tools.ietf.org/html/draft-gross-geneve-02