diff options
author | Renato Botelho <renato@netgate.com> | 2017-02-23 06:37:07 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-02-23 06:37:07 -0300 |
commit | 4ef888db25896b2295f521c736ef04aa2e5e64ec (patch) | |
tree | 3fcc00dda536bd32ae85bc09f21be4081d32bad5 /contrib/tcpdump/print-arp.c | |
parent | 272ffd7c3e4e5e27910eb918e2e36556f2a8ec3a (diff) | |
parent | af015c5bcac0e333adeec07eff0698bad3b91e95 (diff) | |
download | FreeBSD-src-4ef888db25896b2295f521c736ef04aa2e5e64ec.zip FreeBSD-src-4ef888db25896b2295f521c736ef04aa2e5e64ec.tar.gz |
Merge remote-tracking branch 'origin/stable/11' into devel-11
Diffstat (limited to 'contrib/tcpdump/print-arp.c')
-rw-r--r-- | contrib/tcpdump/print-arp.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/contrib/tcpdump/print-arp.c b/contrib/tcpdump/print-arp.c index 883099b..eff97c4 100644 --- a/contrib/tcpdump/print-arp.c +++ b/contrib/tcpdump/print-arp.c @@ -17,24 +17,23 @@ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * $FreeBSD$ */ -#define NETDISSECT_REWORKED +/* \summary: Address Resolution Protocol (ARP) printer */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include <tcpdump-stdinc.h> +#include <netdissect-stdinc.h> #include <string.h> -#include "interface.h" +#include "netdissect.h" #include "addrtoname.h" #include "ether.h" #include "ethertype.h" -#include "extract.h" /* must come after interface.h */ +#include "extract.h" static const char tstr[] = "[|ARP]"; @@ -178,7 +177,17 @@ struct atmarp_pkthdr { #define ATMTSA(ap) (aar_tsa(ap)) #define ATMTPA(ap) (aar_tpa(ap)) -static u_char ezero[6]; +static int +isnonzero(const u_char *a, size_t len) +{ + while (len > 0) { + if (*a != 0) + return (1); + a++; + len--; + } + return (0); +} static void atmarp_addr_print(netdissect_options *ndo, @@ -359,7 +368,7 @@ arp_print(netdissect_options *ndo, case ARPOP_REQUEST: ND_PRINT((ndo, "who-has %s", ipaddr_string(ndo, TPA(ap)))); - if (memcmp((const char *)ezero, (const char *)THA(ap), HRD_LEN(ap)) != 0) + if (isnonzero((const u_char *)THA(ap), HRD_LEN(ap))) ND_PRINT((ndo, " (%s)", linkaddr_string(ndo, THA(ap), linkaddr, HRD_LEN(ap)))); ND_PRINT((ndo, " tell %s", ipaddr_string(ndo, SPA(ap)))); |