diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2021-12-29 14:38:08 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2021-12-29 15:11:32 +0100 |
commit | ef5323efe6c03aaa50eac0949bf95999b91fe05b (patch) | |
tree | da57e896fb5cdafd8bff2defafc304ee73cef643 /print-geneve.c | |
parent | 72a3d5e76fff0c9ed7992076d93990bd925cc995 (diff) | |
download | tcpdump-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-geneve.c')
-rw-r--r-- | print-geneve.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/print-geneve.c b/print-geneve.c index 4d5dda6b..7b77e191 100644 --- a/print-geneve.c +++ b/print-geneve.c @@ -117,7 +117,7 @@ geneve_opts_print(netdissect_options *ndo, const u_char *bp, u_int len) uint8_t opt_type; uint8_t opt_len; - ND_LCHECKMSG_U(len, 4, "remaining options length"); + ND_ICHECKMSG_U("remaining options length", len, <, 4); ND_PRINT("%s", sep); sep = ", "; @@ -169,7 +169,7 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len) ndo->ndo_protocol = "geneve"; ND_PRINT("Geneve"); - ND_LCHECK_U(len, 8); + ND_ICHECK_U(len, <, 8); ver_opt = GET_U_1(bp); bp += 1; |