summaryrefslogtreecommitdiff
path: root/print-ether.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2021-12-29 14:38:08 +0100
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2021-12-29 15:11:32 +0100
commitef5323efe6c03aaa50eac0949bf95999b91fe05b (patch)
treeda57e896fb5cdafd8bff2defafc304ee73cef643 /print-ether.c
parent72a3d5e76fff0c9ed7992076d93990bd925cc995 (diff)
downloadtcpdump-ef5323efe6c03aaa50eac0949bf95999b91fe05b.tar.gz
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.
Diffstat (limited to 'print-ether.c')
-rw-r--r--print-ether.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/print-ether.c b/print-ether.c
index c47749c3..d20addbf 100644
--- a/print-ether.c
+++ b/print-ether.c
@@ -238,7 +238,7 @@ recurse:
*/
length_type = GET_BE_U_2(p);
- ND_LCHECK_U(caplen, 2);
+ ND_ICHECK_U(caplen, <, 2);
length -= 2;
caplen -= 2;
p += 2;