]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-cdp.c
OSPF: Use %zu to print sizeof values
[tcpdump] / print-cdp.c
index fede229d0a7d80c15fad461dc4615b2d0cf9b757..0ab646e51dee71dd63296ee4bd1b9c80a58ac94a 100644 (file)
@@ -21,7 +21,7 @@
  * Code by Gert Doering, SpaceNet GmbH, [email protected]
  *
  * Reference documentation:
- *    http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm
+ *    https://web.archive.org/web/20000914194913/http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.pdf
  */
 
 /* \summary: Cisco Discovery Protocol (CDP) printer */
@@ -93,7 +93,7 @@ void
 cdp_print(netdissect_options *ndo,
           const u_char *pptr, u_int length, u_int caplen)
 {
-       u_int type, len, i, j;
+       u_int type, len, i;
        const u_char *tptr;
 
        ndo->ndo_protocol = "cdp";
@@ -173,12 +173,14 @@ cdp_print(netdissect_options *ndo,
                    case 0x05: /* Version */
                        ND_PRINT("\n\t  ");
                        for (i=0;i<len;i++) {
-                           j = GET_U_1(tptr + i);
-                           if (j == '\n') /* lets rework the version string to
+                           u_char c;
+
+                           c = GET_U_1(tptr + i);
+                           if (c == '\n') /* lets rework the version string to
                                              get a nice indentation */
                                ND_PRINT("\n\t  ");
                            else
-                               fn_print_char(ndo, j);
+                               fn_print_char(ndo, c);
                        }
                        break;
                    case 0x06: /* Platform */
@@ -208,7 +210,7 @@ cdp_print(netdissect_options *ndo,
                        ND_PRINT("%s", GET_U_1(tptr) ? "full": "half");
                        break;
 
-                   /* http://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cata/186/2_12_m/english/release/notes/186rn21m.html
+                   /* https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cata/186/2_12_m/english/release/notes/186rn21m.html
                     * plus more details from other sources
                     *
                     * There are apparently versions of the request with both
@@ -335,10 +337,9 @@ cdp_print_addr(netdissect_options *ndo,
                         */
                        p += 3;
 
-                       ND_TCHECK_4(p);
                        if (p + 4 > endp)
                                goto trunc;
-                       ND_PRINT("IPv4 (%u) %s", num, ipaddr_string(ndo, p));
+                       ND_PRINT("IPv4 (%u) %s", num, GET_IPADDR_STRING(p));
                        p += 4;
                }
                else if (pt == PT_IEEE_802_2 && pl == 8 &&
@@ -354,7 +355,7 @@ cdp_print_addr(netdissect_options *ndo,
                        if (p + al > endp)
                                goto trunc;
 
-                       ND_PRINT("IPv6 (%u) %s", num, ip6addr_string(ndo, p));
+                       ND_PRINT("IPv6 (%u) %s", num, GET_IP6ADDR_STRING(p));
                        p += al;
                }
                else {