Commit Graph

18 Commits

Author SHA1 Message Date
Francois-Xavier Le Bail
ef5323efe6 Update the ND_LCHECK*() macros to ND_ICHECK*() macros
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.
2021-12-29 15:11:32 +01:00
Francois-Xavier Le Bail
121cd17c7d ZEP: Add three length checks 2021-11-28 10:59:29 +01:00
Francois-Xavier Le Bail
6f245276a2 ZEP: Add a bounds check
This avoids to have cp (current pointer on packet data) > ndo->ndo_snapend
in hex_and_ascii_print(), via ndo_default_print(), via ND_DEFAULTPRINT(),
in some cases.
2021-05-09 19:58:34 +02:00
Francois-Xavier Le Bail
c4d90f05e9 ZEP: Remove 3 ND_TCHECK_LEN() calls
No more ND_TCHECK_*() call.
Remove the trunc label.
2020-10-06 16:16:48 +02:00
Francois-Xavier Le Bail
c9dce66aa1 ZEP: Use %u for unsigned values 2020-10-06 16:05:38 +02:00
Francois-Xavier Le Bail
e75349e8d4 ZEP: Fix invalid Preamble Code processing
It's an invalid case, not a truncated one.

Moreover:
Update a comment.
2020-10-06 15:35:46 +02:00
Denis Ovsienko
4806d50985 Define FMAXINT only once and use it properly.
[skip ci]
2020-07-28 16:02:07 +01:00
Francois-Xavier Le Bail
6313179f4b Fix spaces 2019-08-05 08:24:49 +02:00
Francois-Xavier Le Bail
582b5862e1 ZEP: Assign ndo_protocol in lowercases like in most similar cases
Moreover:
Use nd_print_protocol_caps() to print the protocol name.
2019-06-11 18:20:19 +02:00
Francois-Xavier Le Bail
4027411713 Use quoted include netdissect-stdinc.h instead of angle-bracketed one 2019-04-14 10:54:04 +02:00
Francois-Xavier Le Bail
ee68aa3646 Use the new GET_ macros instead of the EXTRACT_ ones
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.
2019-03-26 21:06:24 +01:00
Francois-Xavier Le Bail
8d35d75892 ZEP: Use nd_print_protocol() and nd_print_trunc() calls
Moreover:
Add a 'summary' comment with the protocol name.
2019-03-26 12:23:09 +01:00
Francois-Xavier Le Bail
ad92d9ae65 Remove useless comments 2019-03-26 10:07:34 +01:00
Francois-Xavier Le Bail
3bd3d8fb72 Clean up whitespaces 2019-03-26 08:56:20 +01:00
Tero Kivinen
dfd6465983 Fixed more warnings. 2018-11-18 01:18:43 +02:00
Tero Kivinen
32e24ead3b Updated 802.15.4 code 2018-11-18 04:35:46 +07:00
Tero Kivinen
8479745268 Fixed warnings 2017-03-26 23:05:02 +03:00
Tero Kivinen
13ebc79dfc IEEE 802.15.4 printer which understands frame version 2 frames, and also knows how to print some mac commands and IE contents. Also includes the zep printer to decode ZigBee Encapsulation Protocol frames 2017-03-26 04:48:28 +03:00