]> The Tcpdump Group git mirrors - tcpdump/commit
Update the ND_LCHECK*() macros to ND_ICHECK*() macros
authorFrancois-Xavier Le Bail <[email protected]>
Wed, 29 Dec 2021 13:38:08 +0000 (14:38 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 10 Oct 2023 19:50:17 +0000 (21:50 +0200)
commit5f3ed93e68218d5585977f07a122e5c9e234b763
treed34053069fc5547002f10cb5521031af9dcda9c7
parent95093ac6f4d4020981304e02ffc9b2dee23869b0
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.

(backported from commit ef5323efe6c03aaa50eac0949bf95999b91fe05b)
netdissect.h
print-ether.c
print-icmp6.c
print-ipx.c
print-juniper.c
print-ptp.c
print-sflow.c
print-zep.c