summaryrefslogtreecommitdiff
path: root/print-juniper.c
Commit message (Collapse)AuthorAgeFilesLines
* juniper: don't treat known DLT_ types as "Unknown".Guy Harris2022-07-261-0/+20
| | | | | A bunch of DLT_JUNIPER_ values were not being handled in the "DLT_ specific parsing" switch statement; add (empty) cases for them.
* juniper: don't do bounds checking for fields in the cookie.Guy Harris2022-07-211-3/+3
| | | | | | l2info.cookie is not inside the packet - it's a copy of data from the packet, with the copy doing the necessary bounds checking - so we shouldn't use NT_TCHECK or GET macros on it.
* juniper: make the cookie-processing code a little clearer.Guy Harris2022-07-201-48/+52
| | | | | | | | | | In the loop searching through the cookie table, just search for a matching entry and, if we find one, save the entry and break out of the loop. If we found a matching entry, process the cookie using that entry. That way, the cookie processing isn't buried in a loop.
* Update the ND_LCHECK*() macros to ND_ICHECK*() macrosFrancois-Xavier Le Bail2021-12-291-1/+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.
* Juniper: Report invalid packets as invalid, not truncatedFrancois-Xavier Le Bail2021-12-271-4/+3
| | | | Update the output of a test accordingly.
* Juniper: Rename a variableFrancois-Xavier Le Bail2021-12-271-8/+8
| | | | | This change allows to have a better error message at the next commit with ND_LCHECK_U().
* Use more the ND_TCHECK_1() macroFrancois-Xavier Le Bail2021-08-151-3/+3
| | | | This is a follow-up to 880b867ee73ae757faebbab13213c7d4079222a5.
* Juniper: Add some bounds checksFrancois-Xavier Le Bail2021-06-231-20/+7
| | | | | | | | Avoid to have p (current pointer on packet data) > ndo->ndo_snapend in isoclns_print() in some cases. Define ND_LONGJMP_FROM_TCHECK. Remove some trunc labels.
* Juniper: initialize some structuresFrancois-Xavier Le Bail2020-12-181-0/+14
| | | | | | This change fixes the GH issue #801. Same way as commit 88135db7c785661e7a8b0c02d3ef0bfd00cce6aa.
* Juniper: Avoid testing ndo->ndo_eflag > 1Francois-Xavier Le Bail2020-12-051-1/+1
| | | | | | | | | | | | | It's the only case where ndo->ndo_eflag is tested > 1. It's not documented we could use -ee[...]. To print more details, we already have -v[v]... (if needed). Using -e[e]... could add some confusion. This also add more complexity on a test matrix: ('', '-v', '-e', '-ve', -'vee', -vve, '-vvee', etc.). Thus replace this only case by ndo->ndo_eflag to only have to test ndo_eflag == 0 or ndo_eflag == 1.
* Revert partially the commit 21b1273Francois-Xavier Le Bail2020-09-111-0/+1
| | | | | This change add back 4 ND_TCHECK_n() because their removal may be unsafe. (via Denis comment)
* Remove 15 now redundant ND_TCHECK_n() callsFrancois-Xavier Le Bail2020-09-101-1/+0
| | | | | | | | | ND_TCHECK_n(e). 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' label(s) and most associated code(s).
* 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-22/+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.
* Rework "Update more link-layer dissectors to void functions"Francois-Xavier Le Bail2020-08-061-4/+5
| | | | | | | | | | 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.
* Juniper: Minus the Ethernet hdr length for -x/-X print (JUNIPER_ETHER)Francois-Xavier Le Bail2020-07-281-1/+1
|
* Juniper: Update the link-layer dissectors to void functionsFrancois-Xavier Le Bail2020-07-271-93/+156
|
* Update more link-layer dissectors to void functionsFrancois-Xavier Le Bail2020-07-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | 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.
* More bounds checking when fetching addresses and converting to strings.Guy Harris2020-01-191-2/+2
| | | | | | | | | | | | | | 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.
* Juniper: Fix an undefined behavior at runtimeFrancois-Xavier Le Bail2019-07-251-0/+5
| | | | | | | | The error was: print-juniper.c:1407:21: runtime error: index 8 out of bounds for type 'uint8_t [8]' Thix fixes GitHub issue #783.
* Squelch more warnings.Guy Harris2019-04-171-1/+1
|
* Clean up types to squelch narrowing warnings.Guy Harris2019-04-171-1/+1
|
* Use the new GET_ macros instead of the EXTRACT_ onesFrancois-Xavier Le Bail2019-03-261-51/+60
| | | | | | | 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-2/+3
| | | | This parameter will be needed at the next step.
* Clean up indentation.Guy Harris2018-09-051-34/+34
|
* Remove trailing "_if" from protocol names.Guy Harris2018-09-051-15/+15
| | | | | | "_if", in function names, is just a convention used for the top-level routine for a given DLT_ value; it's not part of the protocol name for the link-layer type.
* If none of those are defined, there's nothing to dissect.Guy Harris2018-07-291-20/+19
| | | | Wrap everyting in the big #if.
* Wrap unused definitions and declarations in #ifdef/#if.Guy Harris2018-07-291-1/+28
| | | | | Some stuff is used only by certain dissectors; define/declare it only if the dissectors that use it are being compiled.
* Add more nd_print_trunc() callsFrancois-Xavier Le Bail2018-05-181-9/+9
| | | | Update the output of some tests accordingly.
* Remove useless commentsFrancois-Xavier Le Bail2018-03-191-8/+0
|
* Add the ndo_protocol field in the netdissect_options structureFrancois-Xavier Le Bail2018-03-161-0/+15
| | | | | Update this field in printer entry functions. It will be used for some printings.
* Have ip{6}addr_string take a u_char * as the second argument.Guy Harris2018-01-311-2/+2
| | | | Fix warnings that introduces.
* 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-50/+50
|
* Use ND_TTEST_SIZE()/ND_TCHECK_SIZE() macros (1/n)Francois-Xavier Le Bail2018-01-031-4/+4
|
* Use nd_ types, add EXTRACT_ calls.Guy Harris2017-12-301-44/+47
|
* Remove all storage class specifier 'register'Francois-Xavier Le Bail2017-12-131-19/+19
| | | | | | 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-2/+2
| | | | | 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 (53/n)Francois-Xavier Le Bail2017-12-101-1/+1
| | | | Assignment, p[n], (more)
* Use more the EXTRACT_U_1() macro (52/n)Francois-Xavier Le Bail2017-12-091-2/+2
| | | | Assignment, p[n]
* Some more EXTRACT_U_1() calls replacing direct fetches.Guy Harris2017-12-081-2/+2
|
* Use more the ND_TCHECK_1() macroFrancois-Xavier Le Bail2017-12-041-1/+1
|
* Use more the EXTRACT_U_1() macro (43/n)Francois-Xavier Le Bail2017-12-031-3/+3
| | | | In: if (... p[n] ...) ...
* Use more the EXTRACT_U_1() macro (42/n)Francois-Xavier Le Bail2017-12-021-2/+2
| | | | In: switch (... p[n] ...) ...
* Use more the EXTRACT_U_1() macro (28/n)Francois-Xavier Le Bail2017-11-261-1/+1
| | | | | | In ND_PRINT() macro call(s) (step 7). p[n] ...
* Use more ND_TCHECK_n()/ND_TTEST_n() macrosFrancois-Xavier Le Bail2017-11-241-9/+9
|
* Rename EXTRACT_ macrosFrancois-Xavier Le Bail2017-11-221-37/+37
| | | | | | | | | | | | | | | | 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 ND_TCHECK_/ND_TTEST_ macrosFrancois-Xavier Le Bail2017-11-221-1/+1
| | | | | | | | Now all the macros have a name meaning a count in bytes. e.g.: ND_TCHECK_32BITS -> ND_TCHECK_4 ND_TTEST_32BITS -> ND_TTEST_4
* Use more the EXTRACT_8BITS() macro to fetch a one-byte value (19/n)Francois-Xavier Le Bail2017-11-211-2/+4
| | | | | | | Assignment, *p++ -> EXTRACT_8BITS(p); p++; Assignment, *(p++) -> EXTRACT_8BITS(p); p++; Partial list.