]> 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]>
Wed, 29 Dec 2021 14:11:32 +0000 (15:11 +0100)
commitef5323efe6c03aaa50eac0949bf95999b91fe05b
treeda57e896fb5cdafd8bff2defafc304ee73cef643
parent72a3d5e76fff0c9ed7992076d93990bd925cc995
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.
17 files changed:
netdissect.h
print-aodv.c
print-atalk.c
print-egp.c
print-ether.c
print-geneve.c
print-gre.c
print-ipx.c
print-juniper.c
print-l2tp.c
print-olsr.c
print-ptp.c
print-rip.c
print-rsvp.c
print-sflow.c
print-udp.c
print-zep.c