diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2022-02-06 20:36:37 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2022-02-06 20:39:58 +0100 |
commit | 500270d47d09559d5b2bae7d4a0fdb156931a009 (patch) | |
tree | 981fe16a2857ef62fc72d5dea6e5328e232473aa /print-icmp6.c | |
parent | ca513b2d06ad2db95ab4041cecb4702edc27c0df (diff) | |
download | tcpdump-500270d47d09559d5b2bae7d4a0fdb156931a009.tar.gz |
ICMPv6: Modernize RPL DAO parsing
Use GET_IP6ADDR_STRING(), ND_ICHECK_U() and nd_print_invalid().
Remove the redundant ND_TCHECK*() instances and the trunc label.
Fix indentation.
Diffstat (limited to 'print-icmp6.c')
-rw-r--r-- | print-icmp6.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/print-icmp6.c b/print-icmp6.c index 78c3dbe8..f88d71f4 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -879,18 +879,14 @@ rpl_dao_print(netdissect_options *ndo, const char *dagid_str = "<elided>"; uint8_t rpl_flags; - ND_TCHECK_SIZE(dao); - if (length < ND_RPL_DAO_MIN_LEN) - goto tooshort; + ND_ICHECK_U(length, <, ND_RPL_DAO_MIN_LEN); bp += ND_RPL_DAO_MIN_LEN; length -= ND_RPL_DAO_MIN_LEN; rpl_flags = GET_U_1(dao->rpl_flags); if(RPL_DAO_D(rpl_flags)) { - ND_TCHECK_LEN(dao->rpl_dagid, DAGID_LEN); - if (length < DAGID_LEN) - goto tooshort; - dagid_str = ip6addr_string (ndo, dao->rpl_dagid); + ND_ICHECK_U(length, <, DAGID_LEN); + dagid_str = GET_IP6ADDR_STRING(dao->rpl_dagid); bp += DAGID_LEN; length -= DAGID_LEN; } @@ -906,14 +902,9 @@ rpl_dao_print(netdissect_options *ndo, if(ndo->ndo_vflag > 1) { rpl_printopts(ndo, bp, length); } - return; - -trunc: - nd_print_trunc(ndo); - return; - -tooshort: - ND_PRINT(" [|length too short]"); + return; +invalid: + nd_print_invalid(ndo); } static void |