X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/fb2479d733dbe8a991d11909b319341f7db62ab1..1af20c3adc4dfef93de41d4fcd02f0aeb6bbfd4e:/print-arp.c diff --git a/print-arp.c b/print-arp.c index c7eeeb96..5e744587 100644 --- a/print-arp.c +++ b/print-arp.c @@ -34,7 +34,6 @@ #include "ethertype.h" #include "extract.h" -static const char tstr[] = "[|ARP]"; /* * Address Resolution Protocol. @@ -177,7 +176,7 @@ struct atmarp_pkthdr { #define ATMTPA(ap) (aar_tpa(ap)) static int -isnonzero(const u_char *a, size_t len) +isnonzero(netdissect_options *ndo, const u_char *a, size_t len) { while (len > 0) { if (EXTRACT_U_1(a) != 0) @@ -266,7 +265,7 @@ atmarp_print(netdissect_options *ndo, op = ATMOP(ap); if (!ND_TTEST_LEN(aar_tpa(ap), ATMTPROTO_LEN(ap))) { - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); ND_DEFAULTPRINT((const u_char *)ap, length); return; } @@ -349,7 +348,7 @@ atmarp_print(netdissect_options *ndo, return; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); } void @@ -359,6 +358,7 @@ arp_print(netdissect_options *ndo, const struct arp_pkthdr *ap; u_short pro, hrd, op, linkaddr; + ndo->ndo_protocol = "arp"; ap = (const struct arp_pkthdr *)bp; ND_TCHECK_SIZE(ap); @@ -385,7 +385,7 @@ arp_print(netdissect_options *ndo, } if (!ND_TTEST_LEN(TPA(ap), PROTO_LEN(ap))) { - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); ND_DEFAULTPRINT((const u_char *)ap, length); return; } @@ -421,7 +421,7 @@ arp_print(netdissect_options *ndo, case ARPOP_REQUEST: ND_PRINT("who-has "); tpaddr_print_ip(ndo, ap, pro); - if (isnonzero((const u_char *)THA(ap), HRD_LEN(ap))) + if (isnonzero(ndo, (const u_char *)THA(ap), HRD_LEN(ap))) ND_PRINT(" (%s)", linkaddr_string(ndo, THA(ap), linkaddr, HRD_LEN(ap))); ND_PRINT(" tell "); @@ -468,12 +468,5 @@ arp_print(netdissect_options *ndo, return; trunc: - ND_PRINT("%s", tstr); + nd_print_trunc(ndo); } - -/* - * Local Variables: - * c-style: bsd - * End: - */ -