]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-isoclns.c
Remove many (762) now redundant ND_TCHECK_n() calls
[tcpdump] / print-isoclns.c
index 9e83e613aef543d5eb345203fc64de26ff6bd811..1e381eb6d1c53d38b59bee6d55adcf7d6d04a70d 100644 (file)
@@ -735,7 +735,6 @@ void
 isoclns_print(netdissect_options *ndo, const u_char *p, u_int length)
 {
        ndo->ndo_protocol = "isoclns";
-       ND_TCHECK_1(p); /* enough bytes on the wire ? */
 
        if (ndo->ndo_eflag)
                ND_PRINT("OSI NLPID %s (0x%02x): ",
@@ -786,9 +785,6 @@ isoclns_print(netdissect_options *ndo, const u_char *p, u_int length)
                        print_unknown_data(ndo, p, "\n\t", length);
                break;
        }
-       return;
-trunc:
-       nd_print_trunc(ndo);
 }
 
 #define        CLNP_PDU_ER      1
@@ -884,7 +880,6 @@ clnp_print(netdissect_options *ndo,
             ND_PRINT("li < size of fixed part of CLNP header and addresses");
             return (0);
         }
-       ND_TCHECK_1(pptr);
         dest_address_length = GET_U_1(pptr);
         pptr += 1;
         li_remaining -= 1;
@@ -901,7 +896,6 @@ clnp_print(netdissect_options *ndo,
             ND_PRINT("li < size of fixed part of CLNP header and addresses");
             return (0);
         }
-       ND_TCHECK_1(pptr);
         source_address_length = GET_U_1(pptr);
         pptr += 1;
         li_remaining -= 1;
@@ -1109,7 +1103,6 @@ clnp_print(netdissect_options *ndo,
 
         case    CLNP_PDU_ER: /* fall through */
         case   CLNP_PDU_ERP:
-            ND_TCHECK_1(pptr);
             if (GET_U_1(pptr) == NLPID_CLNP) {
                 ND_PRINT("\n\t-----original packet-----\n\t");
                 /* FIXME recursion protection */
@@ -1430,7 +1423,6 @@ esis_print(netdissect_options *ndo,
 
             case ESIS_OPTION_PROTOCOLS:
                 while (opli>0) {
-                    ND_TCHECK_1(tptr);
                     ND_PRINT("%s (0x%02x)",
                            tok2str(nlpid_values,
                                    "unknown",
@@ -1728,7 +1720,6 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo,
           stlv_len -= 8;
 
           while (stlv_len >= 4) {
-            ND_TCHECK_4(tptr);
             ND_PRINT("\n\t        T: %u, R: %u, RES: %u, ISID: %u",
                     (GET_BE_U_4(tptr) >> 31),
                     (GET_BE_U_4(tptr) >> 30) & 0x01,
@@ -2293,13 +2284,11 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
     uint8_t prefix[sizeof(nd_ipv6)]; /* shared copy buffer for IPv4 and IPv6 prefixes */
     u_int metric, status_byte, bit_length, byte_length, sublen, processed, subtlvtype, subtlvlen;
 
-    ND_TCHECK_4(tptr);
     metric = GET_BE_U_4(tptr);
     processed=4;
     tptr+=4;
 
     if (afi == AF_INET) {
-        ND_TCHECK_1(tptr);
         status_byte=GET_U_1(tptr);
         tptr++;
         bit_length = status_byte&0x3f;
@@ -2362,7 +2351,6 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
            than one subTLV - therefore the first byte must reflect
            the aggregate bytecount of the subTLVs for this prefix
         */
-        ND_TCHECK_1(tptr);
         sublen=GET_U_1(tptr);
         tptr++;
         processed+=sublen+1;
@@ -2906,7 +2894,6 @@ isis_print(netdissect_options *ndo,
        switch (tlv_type) {
        case ISIS_TLV_AREA_ADDR:
            while (tlen != 0) {
-               ND_TCHECK_1(tptr);
                alen = GET_U_1(tptr);
                tptr++;
                tlen--;
@@ -3005,7 +2992,6 @@ isis_print(netdissect_options *ndo,
         case ISIS_TLV_IS_REACH:
             if (tlen < 1)
                 goto tlv_trunc;
-           ND_TCHECK_1(tptr);  /* check if there is one byte left to read out the virtual flag */
             ND_PRINT("\n\t      %s",
                    tok2str(isis_is_reach_virtual_values,
                            "bogus virtual flag 0x%02x",
@@ -3136,7 +3122,6 @@ isis_print(netdissect_options *ndo,
        case ISIS_TLV_AUTH:
            if (tlen < 1)
                goto tlv_trunc;
-           ND_TCHECK_1(tptr);
            auth_type = GET_U_1(tptr);
            tptr++;
            tlen--;
@@ -3153,7 +3138,6 @@ isis_print(netdissect_options *ndo,
                break;
            case ISIS_SUBTLV_AUTH_MD5:
                for(i=0;i<tlen;i++) {
-                   ND_TCHECK_1(tptr + i);
                    ND_PRINT("%02x", GET_U_1(tptr + i));
                }
                if (tlen != ISIS_SUBTLV_AUTH_MD5_LEN)
@@ -3168,13 +3152,11 @@ isis_print(netdissect_options *ndo,
             case ISIS_SUBTLV_AUTH_GENERIC:
                 if (tlen < 2)
                     goto tlv_trunc;
-               ND_TCHECK_2(tptr);
                 key_id = GET_BE_U_2(tptr);
                 ND_PRINT("%u, password: ", key_id);
                 tptr += 2;
                 tlen -= 2;
                 for(i=0;i<tlen;i++) {
-                    ND_TCHECK_1(tptr + i);
                     ND_PRINT("%02x", GET_U_1(tptr + i));
                 }
                 break;
@@ -3189,14 +3171,12 @@ isis_print(netdissect_options *ndo,
        case ISIS_TLV_PTP_ADJ:
            tlv_ptp_adj = (const struct isis_tlv_ptp_adj *)tptr;
            if(tlen>=1) {
-               ND_TCHECK_1(tptr);
                ND_PRINT("\n\t      Adjacency State: %s (%u)",
                       tok2str(isis_ptp_adjancey_values, "unknown", GET_U_1(tptr)),
                       GET_U_1(tptr));
                tlen--;
            }
            if(tlen>sizeof(tlv_ptp_adj->extd_local_circuit_id)) {
-               ND_TCHECK_4(tlv_ptp_adj->extd_local_circuit_id);
                ND_PRINT("\n\t      Extended Local circuit-ID: 0x%08x",
                       GET_BE_U_4(tlv_ptp_adj->extd_local_circuit_id));
                tlen-=sizeof(tlv_ptp_adj->extd_local_circuit_id);
@@ -3208,7 +3188,6 @@ isis_print(netdissect_options *ndo,
                tlen-=SYSTEM_ID_LEN;
            }
            if(tlen>=sizeof(tlv_ptp_adj->neighbor_extd_local_circuit_id)) {
-               ND_TCHECK_4(tlv_ptp_adj->neighbor_extd_local_circuit_id);
                ND_PRINT("\n\t      Neighbor Extended Local circuit-ID: 0x%08x",
                       GET_BE_U_4(tlv_ptp_adj->neighbor_extd_local_circuit_id));
            }
@@ -3217,7 +3196,6 @@ isis_print(netdissect_options *ndo,
        case ISIS_TLV_PROTOCOLS:
            ND_PRINT("\n\t      NLPID(s): ");
            while (tlen != 0) {
-               ND_TCHECK_1(tptr);
                ND_PRINT("%s (0x%02x)",
                        tok2str(nlpid_values,
                                "unknown",
@@ -3252,7 +3230,6 @@ isis_print(netdissect_options *ndo,
         case ISIS_TLV_MT_CAPABILITY:
             if (tlen < 2)
                 goto tlv_trunc;
-            ND_TCHECK_2(tptr);
 
             ND_PRINT("\n\t      O: %u, RES: %u, MTID(s): %u",
                       (GET_BE_U_2(tptr) >> 15) & 0x01,
@@ -3301,7 +3278,6 @@ isis_print(netdissect_options *ndo,
 
            if (tlen < 1)
                break;
-           ND_TCHECK_1(tptr);
            ND_PRINT(", Flags: [%s]",
                      ISIS_MASK_TLV_SHARED_RISK_GROUP(GET_U_1(tptr)) ? "numbered" : "unnumbered");
            tptr++;
@@ -3324,7 +3300,6 @@ isis_print(netdissect_options *ndo,
            while (tlen != 0) {
                if (tlen < 4)
                    goto tlv_trunc;
-                ND_TCHECK_4(tptr);
                 ND_PRINT("\n\t      Link-ID: 0x%08x", GET_BE_U_4(tptr));
                 tptr+=4;
                 tlen-=4;
@@ -3339,13 +3314,10 @@ isis_print(netdissect_options *ndo,
                ND_TCHECK_1(tlv_lsp->lsp_id + LSP_ID_LEN - 1);
                ND_PRINT("\n\t      lsp-id: %s",
                        isis_print_id(ndo, tlv_lsp->lsp_id, LSP_ID_LEN));
-               ND_TCHECK_4(tlv_lsp->sequence_number);
                ND_PRINT(", seq: 0x%08x",
                          GET_BE_U_4(tlv_lsp->sequence_number));
-               ND_TCHECK_2(tlv_lsp->remaining_lifetime);
                ND_PRINT(", lifetime: %5ds",
                          GET_BE_U_2(tlv_lsp->remaining_lifetime));
-               ND_TCHECK_2(tlv_lsp->checksum);
                ND_PRINT(", chksum: 0x%04x", GET_BE_U_2(tlv_lsp->checksum));
                tlen-=sizeof(struct isis_tlv_lsp);
                tlv_lsp++;
@@ -3369,7 +3341,6 @@ isis_print(netdissect_options *ndo,
        case ISIS_TLV_POI:
            if (tlen < 1)
                goto tlv_trunc;
-           ND_TCHECK_1(tptr);
            num_system_ids = GET_U_1(tptr);
            tptr++;
            tlen--;
@@ -3445,7 +3416,6 @@ isis_print(netdissect_options *ndo,
         case ISIS_TLV_IDRP_INFO:
            if (tlen < 1)
                break;
-            ND_TCHECK_1(tptr);
             isis_subtlv_idrp = GET_U_1(tptr);
             ND_PRINT("\n\t      Inter-Domain Information Type: %s",
                    tok2str(isis_subtlv_idrp_values,
@@ -3457,7 +3427,6 @@ isis_print(netdissect_options *ndo,
             case ISIS_SUBTLV_IDRP_ASN:
                 if (tlen < 2)
                     goto tlv_trunc;
-                ND_TCHECK_2(tptr); /* fetch AS number */
                 ND_PRINT("AS Number: %u", GET_BE_U_2(tptr));
                 break;
             case ISIS_SUBTLV_IDRP_LOCAL:
@@ -3472,7 +3441,6 @@ isis_print(netdissect_options *ndo,
         case ISIS_TLV_LSP_BUFFERSIZE:
            if (tlen < 2)
                break;
-            ND_TCHECK_2(tptr);
             ND_PRINT("\n\t      LSP Buffersize: %u", GET_BE_U_2(tptr));
             break;
 
@@ -3497,7 +3465,6 @@ isis_print(netdissect_options *ndo,
             tlen-=sizeof(struct isis_metric_block);
 
             while (tlen != 0) {
-                ND_TCHECK_1(tptr);
                 prefix_len=GET_U_1(tptr); /* read out prefix length in semioctets*/
                 tptr++;
                 tlen--;
@@ -3518,7 +3485,6 @@ isis_print(netdissect_options *ndo,
         case ISIS_TLV_IIH_SEQNR:
            if (tlen < 4)
                break;
-            ND_TCHECK_4(tptr); /* check if four bytes are on the wire */
             ND_PRINT("\n\t      Sequence number: %u", GET_BE_U_4(tptr));
             break;
 
@@ -3542,7 +3508,6 @@ isis_print(netdissect_options *ndo,
         case ISIS_TLV_VENDOR_PRIVATE:
            if (tlen < 3)
                break;
-            ND_TCHECK_3(tptr); /* check if enough byte for a full oui */
             vendor_id = GET_BE_U_3(tptr);
             ND_PRINT("\n\t      Vendor: %s (%u)",
                    tok2str(oui_values, "Unknown", vendor_id),