X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/e2982e7f6f0b624a773ec5a58885ee80fab46d34..cc2d4cbd8ca150504127f375d8b51b194958d95b:/print-dvmrp.c diff --git a/print-dvmrp.c b/print-dvmrp.c index 20c5ec36..983b63b4 100644 --- a/print-dvmrp.c +++ b/print-dvmrp.c @@ -22,10 +22,10 @@ /* \summary: Distance Vector Multicast Routing Protocol printer */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif -#include +#include "netdissect-stdinc.h" #include "netdissect.h" #include "extract.h" @@ -73,7 +73,8 @@ dvmrp_print(netdissect_options *ndo, u_char type; uint8_t major_version, minor_version; - ep = (const u_char *)ndo->ndo_snapend; + ndo->ndo_protocol = "dvmrp"; + ep = ndo->ndo_snapend; if (bp >= ep) return; @@ -150,13 +151,13 @@ dvmrp_print(netdissect_options *ndo, break; default: - ND_PRINT(" [type %d]", type); + ND_PRINT(" [type %u]", type); break; } return; trunc: - ND_PRINT("[|dvmrp]"); + nd_print_trunc(ndo); return; } @@ -166,7 +167,7 @@ print_report(netdissect_options *ndo, u_int len) { uint32_t mask, origin; - int metric, done; + u_int metric, done; u_int i, width; while (len > 0) { @@ -211,7 +212,7 @@ print_report(netdissect_options *ndo, bp++; done = metric & 0x80; metric &= 0x7f; - ND_PRINT("\n\t %s metric %d", intoa(htonl(origin)), + ND_PRINT("\n\t %s metric %u", intoa(htonl(origin)), metric); len -= width + 1; } while (!done); @@ -234,8 +235,7 @@ print_probe(netdissect_options *ndo, ND_PRINT(" [|}"); return (0); } - genid = (EXTRACT_U_1(bp) << 24) | (EXTRACT_U_1(bp + 1) << 16) | - (EXTRACT_U_1(bp + 2) << 8) | EXTRACT_U_1(bp + 3); + genid = EXTRACT_BE_U_4(bp); bp += 4; len -= 4; ND_PRINT(ndo->ndo_vflag > 1 ? "\n\t" : " "); @@ -277,7 +277,7 @@ print_neighbors(netdissect_options *ndo, while (--ncount >= 0) { ND_TCHECK_4(bp); ND_PRINT(" [%s ->", ipaddr_string(ndo, laddr)); - ND_PRINT(" %s, (%d/%d)]", + ND_PRINT(" %s, (%u/%u)]", ipaddr_string(ndo, bp), metric, thresh); bp += 4; len -= 4; @@ -315,7 +315,7 @@ print_neighbors2(netdissect_options *ndo, len -= 8; while (--ncount >= 0 && (len >= 4) && (bp + 4) <= ep) { ND_PRINT(" [%s -> ", ipaddr_string(ndo, laddr)); - ND_PRINT("%s (%d/%d", ipaddr_string(ndo, bp), + ND_PRINT("%s (%u/%u", ipaddr_string(ndo, bp), metric, thresh); if (flags & DVMRP_NF_TUNNEL) ND_PRINT("/tunnel");