X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/07a7f33ba3ff346b9ce31772645a06980baca907..b51a0dafc7861eb31d21524ec067d7c529a664b8:/print-lisp.c diff --git a/print-lisp.c b/print-lisp.c index 5c6825ae..756fff0f 100644 --- a/print-lisp.c +++ b/print-lisp.c @@ -100,8 +100,6 @@ #include "netdissect-stdinc.h" #include "netdissect.h" -#include -#include #include "ip.h" #include "ip6.h" @@ -285,8 +283,8 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) goto invalid; /* Print all the EID records */ - while ((length > packet_offset) && (record_count--)) { - + while ((length > packet_offset) && (record_count != 0)) { + record_count--; ND_TCHECK_LEN(packet_iterator + packet_offset, MAP_REGISTER_EID_LEN); ND_PRINT("\n"); @@ -307,15 +305,15 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) switch (eid_afi) { case IPv4_AFI: - ND_TCHECK_4(packet_iterator + packet_offset); - ND_PRINT(" EID %s/%u,", ipaddr_string(ndo, - packet_iterator + packet_offset), mask_len); + ND_PRINT(" EID %s/%u,", + GET_IPADDR_STRING(packet_iterator + packet_offset), + mask_len); packet_offset += 4; break; case IPv6_AFI: - ND_TCHECK_16(packet_iterator + packet_offset); - ND_PRINT(" EID %s/%u,", ip6addr_string(ndo, - packet_iterator + packet_offset), mask_len); + ND_PRINT(" EID %s/%u,", + GET_IP6ADDR_STRING(packet_iterator + packet_offset), + mask_len); packet_offset += 16; break; default: @@ -328,7 +326,8 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) ND_PRINT(" %u locator(s)", loc_count); - while (loc_count--) { + while (loc_count != 0) { + loc_count--; ND_TCHECK_LEN(packet_iterator + packet_offset, MAP_REGISTER_LOC_LEN); lisp_loc = (const lisp_map_register_loc *) (packet_iterator + packet_offset); @@ -342,12 +341,12 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) switch (loc_afi) { case IPv4_AFI: ND_TCHECK_4(packet_iterator + packet_offset); - ND_PRINT(" LOC %s", ipaddr_string(ndo, loc_ip_pointer)); + ND_PRINT(" LOC %s", GET_IPADDR_STRING(loc_ip_pointer)); packet_offset += 4; break; case IPv6_AFI: ND_TCHECK_16(packet_iterator + packet_offset); - ND_PRINT(" LOC %s", ip6addr_string(ndo, loc_ip_pointer)); + ND_PRINT(" LOC %s", GET_IP6ADDR_STRING(loc_ip_pointer)); packet_offset += 16; break; default: @@ -374,14 +373,14 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) if (xtr_present) { if (!ND_TTEST_LEN(packet_iterator + packet_offset, 24)) goto invalid; - hex_print_with_offset(ndo, "\n xTR-ID: ", packet_iterator + packet_offset, 16, 0); + hex_print(ndo, "\n xTR-ID: ", packet_iterator + packet_offset, 16); ND_PRINT("\n SITE-ID: %" PRIu64, GET_BE_U_8(packet_iterator + packet_offset + 16)); } else { /* Check if packet isn't over yet */ if (packet_iterator + packet_offset < ndo->ndo_snapend) { - hex_print_with_offset(ndo, "\n Data: ", packet_iterator + packet_offset, - ND_BYTES_AVAILABLE_AFTER(packet_iterator + packet_offset), 0); + hex_print(ndo, "\n Data: ", packet_iterator + packet_offset, + ND_BYTES_AVAILABLE_AFTER(packet_iterator + packet_offset)); } } return; @@ -390,7 +389,6 @@ trunc: return; invalid: nd_print_invalid(ndo); - return; } static uint8_t @@ -430,8 +428,6 @@ static void lisp_hdr_flag(netdissect_options *ndo, const lisp_map_register_hdr * ND_PRINT(" flags [%s],", bittok2str(map_notify_hdr_flag, "none", GET_BE_U_4(lisp_hdr))); } - - return; } static void action_flag(netdissect_options *ndo, uint8_t act_auth_inc_res)