]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-cdp.c
Shorten a status text description.
[tcpdump] / print-cdp.c
index 353ce4c1ed0db0a8554cd3b6080b7ec3bc34dcd4..116f0fa522e8a07d502effee29a3be12479b1da1 100644 (file)
@@ -96,24 +96,20 @@ cdp_print(netdissect_options *ndo,
 
         tptr = pptr; /* temporary pointer */
 
-       if (!ND_TTEST2(*tptr, CDP_HEADER_LEN))
-               goto trunc;
+       ND_TCHECK2(*tptr, CDP_HEADER_LEN);
        ND_PRINT((ndo, "CDPv%u, ttl: %us", *tptr, *(tptr + 1)));
        if (ndo->ndo_vflag)
                ND_PRINT((ndo, ", checksum: %u (unverified), length %u", EXTRACT_16BITS(tptr), length));
        tptr += CDP_HEADER_LEN;
 
        while (tptr < (pptr+length)) {
-
-                if (!ND_TTEST2(*tptr, 4)) /* read out Type and Length */
-                    goto trunc;
+               ND_TCHECK2(*tptr, 4); /* read out Type and Length */
                type = EXTRACT_16BITS(tptr);
                len  = EXTRACT_16BITS(tptr+2); /* object length includes the 4 bytes header length */
                 tptr += 4;
                 len -= 4;
 
-               if (!ND_TTEST2(*tptr, len))
-                       goto trunc;
+               ND_TCHECK2(*tptr, len);
 
                 if (ndo->ndo_vflag || type == 1) { /* in non-verbose mode just print Device-ID */
 
@@ -130,7 +126,7 @@ cdp_print(netdissect_options *ndo,
                         if (!ndo->ndo_vflag)
                             ND_PRINT((ndo, ", Device-ID "));
                         ND_PRINT((ndo, "'"));
-                        fn_printn(tptr, len, NULL);
+                        fn_printn(ndo, tptr, len, NULL);
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x02: /* Address */
@@ -139,7 +135,7 @@ cdp_print(netdissect_options *ndo,
                        break;
                     case 0x03: /* Port-ID */
                         ND_PRINT((ndo, "'"));
-                        fn_printn(tptr, len, NULL);
+                        fn_printn(ndo, tptr, len, NULL);
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x04: /* Capabilities */
@@ -158,7 +154,7 @@ cdp_print(netdissect_options *ndo,
                        break;
                     case 0x06: /* Platform */
                         ND_PRINT((ndo, "'"));
-                        fn_printn(tptr, len, NULL);
+                        fn_printn(ndo, tptr, len, NULL);
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x07: /* Prefixes */
@@ -169,7 +165,7 @@ cdp_print(netdissect_options *ndo,
                        break;
                     case 0x09: /* VTP Mgmt Domain  - not documented */
                         ND_PRINT((ndo, "'"));
-                        fn_printn(tptr, len, NULL);
+                        fn_printn(ndo, tptr, len, NULL);
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x0a: /* Native VLAN ID - not documented */
@@ -199,7 +195,7 @@ cdp_print(netdissect_options *ndo,
                        break;
                     case 0x14: /* System Name - not documented */
                         ND_PRINT((ndo, "'"));
-                        fn_printn(tptr, len, NULL);
+                        fn_printn(ndo, tptr, len, NULL);
                         ND_PRINT((ndo, "'"));
                        break;
                     case 0x16: /* System Object ID - not documented */
@@ -210,7 +206,7 @@ cdp_print(netdissect_options *ndo,
                        ND_PRINT((ndo, "0x%02x", *(tptr)));
                        if (len > 1) {
                                ND_PRINT((ndo, "/"));
-                               fn_printn(tptr + 1, len - 1, NULL);
+                               fn_printn(ndo, tptr + 1, len - 1, NULL);
                        }
                        break;
                     default: