]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-arp.c
NTP: Use nd_XXXXX integer types in the structures.
[tcpdump] / print-arp.c
index 79c8ecb1af3bcd58b548e3f882915a7a3b1c1ab5..eff97c469074d215360ea8666b1389d521e6f348 100644 (file)
@@ -177,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,
@@ -358,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))));