]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-atalk.c
OpenFlow: Have a function for each message type.
[tcpdump] / print-atalk.c
index 99cd850e3d1d992bd27cf794bce66fc4b7373bf7..c921dc1a7d166cfc5d278fa459c791eb16af3918 100644 (file)
@@ -51,9 +51,9 @@ struct aarp {
        nd_uint16_t     htype, ptype;
        nd_uint8_t      halen, palen;
        nd_uint16_t     op;
-       uint8_t         hsaddr[6];
+       uint8_t         hsaddr[MAC_ADDR_LEN];
        uint8_t         psaddr[4];
-       uint8_t         hdaddr[6];
+       uint8_t         hdaddr[MAC_ADDR_LEN];
        uint8_t         pdaddr[4];
 };
 
@@ -72,19 +72,20 @@ static const char *ddpskt_string(netdissect_options *, u_int);
 /*
  * Print LLAP packets received on a physical LocalTalk interface.
  */
-u_int
+void
 ltalk_if_print(netdissect_options *ndo,
                const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int hdrlen;
 
-       ndo->ndo_protocol = "ltalk_if";
+       ndo->ndo_protocol = "ltalk";
        hdrlen = llap_print(ndo, p, h->len);
        if (hdrlen == 0) {
                /* Cut short by the snapshot length. */
-               return (h->caplen);
+               ndo->ndo_ll_hdr_len += h->caplen;
+               return;
        }
-       return (hdrlen);
+       ndo->ndo_ll_hdr_len += hdrlen;
 }
 
 /*
@@ -237,7 +238,7 @@ aarp_print(netdissect_options *ndo,
        }
        if (GET_BE_U_2(ap->htype) == 1 &&
            GET_BE_U_2(ap->ptype) == ETHERTYPE_ATALK &&
-           GET_U_1(ap->halen) == 6 && GET_U_1(ap->palen) == 4 )
+           GET_U_1(ap->halen) == MAC_ADDR_LEN && GET_U_1(ap->palen) == 4)
                switch (GET_BE_U_2(ap->op)) {
 
                case 1:                         /* request */
@@ -245,7 +246,7 @@ aarp_print(netdissect_options *ndo,
                        return;
 
                case 2:                         /* response */
-                       ND_PRINT("reply %s is-at %s", AT(psaddr), etheraddr_string(ndo, ap->hsaddr));
+                       ND_PRINT("reply %s is-at %s", AT(psaddr), GET_ETHERADDR_STRING(ap->hsaddr));
                        return;
 
                case 3:                         /* probe (oy!) */
@@ -635,7 +636,7 @@ ataddr_string(netdissect_options *ndo,
                                        if (tp->name == NULL)
                                                (*ndo->ndo_error)(ndo,
                                                    S_ERR_ND_MEM_ALLOC,
-                                                   "ataddr_string: strdup(nambuf)");
+                                                   "%s: strdup(nambuf)", __func__);
                                }
                                fclose(fp);
                        }
@@ -655,25 +656,25 @@ ataddr_string(netdissect_options *ndo,
                if (tp2->addr == i) {
                        tp->addr = (atnet << 8) | athost;
                        tp->nxt = newhnamemem(ndo);
-                       (void)nd_snprintf(nambuf, sizeof(nambuf), "%s.%u",
+                       (void)snprintf(nambuf, sizeof(nambuf), "%s.%u",
                            tp2->name, athost);
                        tp->name = strdup(nambuf);
                        if (tp->name == NULL)
                                (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
-                                       "ataddr_string: strdup(nambuf)");
+                                       "%s: strdup(nambuf)", __func__);
                        return (tp->name);
                }
 
        tp->addr = (atnet << 8) | athost;
        tp->nxt = newhnamemem(ndo);
        if (athost != 255)
-               (void)nd_snprintf(nambuf, sizeof(nambuf), "%u.%u", atnet, athost);
+               (void)snprintf(nambuf, sizeof(nambuf), "%u.%u", atnet, athost);
        else
-               (void)nd_snprintf(nambuf, sizeof(nambuf), "%u", atnet);
+               (void)snprintf(nambuf, sizeof(nambuf), "%u", atnet);
        tp->name = strdup(nambuf);
        if (tp->name == NULL)
                (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
-                                 "ataddr_string: strdup(nambuf)");
+                                 "%s: strdup(nambuf)", __func__);
 
        return (tp->name);
 }
@@ -693,7 +694,7 @@ ddpskt_string(netdissect_options *ndo,
        static char buf[8];
 
        if (ndo->ndo_nflag) {
-               (void)nd_snprintf(buf, sizeof(buf), "%u", skt);
+               (void)snprintf(buf, sizeof(buf), "%u", skt);
                return (buf);
        }
        return (tok2str(skt2str, "%u", skt));