]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-isoclns.c
DNS: Sync types with IANA
[tcpdump] / print-isoclns.c
index da155708ff08c6d7ef425d93a1eddc3f118bf0cc..ddd559532abd3bae10bfb7681326a01df0b63055 100644 (file)
@@ -964,7 +964,6 @@ clnp_print(netdissect_options *ndo,
                 ND_PRINT(", bad opts/li");
                 return (0);
             }
-            ND_TCHECK_2(pptr);
             op = GET_U_1(pptr);
             opli = GET_U_1(pptr + 1);
             pptr += 2;
@@ -1023,8 +1022,6 @@ clnp_print(netdissect_options *ndo,
                             }
                             if (source_address_length > 0) {
                                     source_address=(tptr+1);
-                                    ND_TCHECK_LEN(source_address,
-                                                  source_address_length);
                                     ND_PRINT("\n\t    NSAP address (length %u): %s",
                                            source_address_length,
                                            GET_ISONSAP_STRING(source_address, source_address_length));
@@ -1301,7 +1298,7 @@ esis_print(netdissect_options *ndo,
                pptr += netal;
                 li -= netal;
 
-               if (snpal == 6)
+               if (snpal == MAC_ADDR_LEN)
                        ND_PRINT("\n\t  SNPA (length: %u): %s",
                               snpal,
                               GET_ETHERADDR_STRING(snpa));
@@ -1394,7 +1391,6 @@ esis_print(netdissect_options *ndo,
                 ND_PRINT(", bad opts/li");
                 return;
             }
-            ND_TCHECK_2(pptr);
             op = GET_U_1(pptr);
             opli = GET_U_1(pptr + 1);
             pptr += 2;
@@ -1469,8 +1465,7 @@ isis_print_mcid(netdissect_options *ndo,
   ND_TCHECK_SIZE(mcid);
   ND_PRINT("ID: %u, Name: ", GET_U_1(mcid->format_id));
 
-  if (nd_printzp(ndo, mcid->name, 32, ndo->ndo_snapend))
-      goto trunc;
+  nd_printjnp(ndo, mcid->name, sizeof(mcid->name));
 
   ND_PRINT("\n\t              Lvl: %u", GET_BE_U_2(mcid->revision_lvl));
 
@@ -1494,7 +1489,6 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo,
 
   while (len > 2)
   {
-    ND_TCHECK_2(tptr);
     stlv_type = GET_U_1(tptr);
     stlv_len  = GET_U_1(tptr + 1);
 
@@ -1627,7 +1621,6 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo,
 
   while (len > 2)
   {
-    ND_TCHECK_2(tptr);
     stlv_type = GET_U_1(tptr);
     stlv_len  = GET_U_1(tptr + 1);
     tptr += 2;
@@ -2252,7 +2245,6 @@ isis_print_mtid(netdissect_options *ndo,
 {
     if (tlv_remaining < 2)
         goto trunc;
-    ND_TCHECK_2(tptr);
 
     ND_PRINT("%s%s",
            ident,
@@ -2300,7 +2292,6 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
         }
         processed++;
     } else if (afi == AF_INET6) {
-        ND_TCHECK_2(tptr);
         status_byte=GET_U_1(tptr);
         bit_length=GET_U_1(tptr + 1);
         if (bit_length > 128) {
@@ -2316,9 +2307,8 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
 
     byte_length = (bit_length + 7) / 8; /* prefix has variable length encoding */
 
-    ND_TCHECK_LEN(tptr, byte_length);
     memset(prefix, 0, sizeof(prefix));   /* clear the copy buffer */
-    memcpy(prefix,tptr,byte_length);    /* copy as much as is stored in the TLV */
+    GET_CPY_BYTES(prefix,tptr,byte_length);    /* copy as much as is stored in the TLV */
     tptr+=byte_length;
     processed+=byte_length;
 
@@ -2357,7 +2347,6 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
         ND_PRINT(" (%u)", sublen);   /* print out subTLV length */
 
         while (sublen>0) {
-            ND_TCHECK_2(tptr);
             subtlvtype=GET_U_1(tptr);
             subtlvlen=GET_U_1(tptr + 1);
             tptr+=2;
@@ -2370,8 +2359,6 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
         }
     }
     return (processed);
-trunc:
-    return 0;
 }
 
 static void
@@ -2380,7 +2367,6 @@ isis_print_router_cap_subtlv(netdissect_options *ndo, const uint8_t *tptr, uint8
     uint8_t subt, subl;
 
     while (tlen >= 2) {
-       ND_TCHECK_LEN(tptr, 2);
        subt = GET_U_1(tptr);
        subl = GET_U_1(tptr+1);
        tlen -= 2;
@@ -2899,7 +2885,6 @@ isis_print(netdissect_options *ndo,
                tlen--;
                if (tlen < alen)
                    goto tlv_trunc;
-               ND_TCHECK_LEN(tptr, alen);
                ND_PRINT("\n\t      Area address (length: %u): %s",
                        alen,
                        GET_ISONSAP_STRING(tptr, alen));
@@ -3131,8 +3116,7 @@ isis_print(netdissect_options *ndo,
 
            switch (auth_type) {
            case ISIS_SUBTLV_AUTH_SIMPLE:
-               if (nd_printzp(ndo, tptr, tlen, ndo->ndo_snapend))
-                   goto trunc;
+               nd_printjnp(ndo, tptr, tlen);
                break;
            case ISIS_SUBTLV_AUTH_MD5:
                for(i=0;i<tlen;i++) {
@@ -3210,7 +3194,6 @@ isis_print(netdissect_options *ndo,
         {
             if (tlen < 2)
                 goto tlv_trunc;
-            ND_TCHECK_2(tptr);
 
             ND_PRINT("\n\t       RES: %u, MTID(s): %u",
                     (GET_BE_U_2(tptr) >> 12),
@@ -3245,7 +3228,6 @@ isis_print(netdissect_options *ndo,
        case ISIS_TLV_TE_ROUTER_ID:
            if (tlen < sizeof(nd_ipv4))
                goto tlv_trunc;
-           ND_TCHECK_LEN(pptr, sizeof(nd_ipv4));
            ND_PRINT("\n\t      Traffic Engineering Router ID: %s", GET_IPADDR_STRING(pptr));
            break;
 
@@ -3253,7 +3235,6 @@ isis_print(netdissect_options *ndo,
            while (tlen != 0) {
                 if (tlen < sizeof(nd_ipv4))
                     goto tlv_trunc;
-               ND_TCHECK_LEN(tptr, sizeof(nd_ipv4));
                ND_PRINT("\n\t      IPv4 interface address: %s", GET_IPADDR_STRING(tptr));
                tptr += sizeof(nd_ipv4);
                tlen -= sizeof(nd_ipv4);
@@ -3262,8 +3243,7 @@ isis_print(netdissect_options *ndo,
 
        case ISIS_TLV_HOSTNAME:
            ND_PRINT("\n\t      Hostname: ");
-           if (nd_printzp(ndo, tptr, tlen, ndo->ndo_snapend))
-               goto trunc;
+           nd_printjnp(ndo, tptr, tlen);
            break;
 
        case ISIS_TLV_SHARED_RISK_GROUP:
@@ -3283,14 +3263,12 @@ isis_print(netdissect_options *ndo,
 
            if (tlen < sizeof(nd_ipv4))
                break;
-           ND_TCHECK_LEN(tptr, sizeof(nd_ipv4));
            ND_PRINT("\n\t      IPv4 interface address: %s", GET_IPADDR_STRING(tptr));
            tptr+=sizeof(nd_ipv4);
            tlen-=sizeof(nd_ipv4);
 
            if (tlen < sizeof(nd_ipv4))
                break;
-           ND_TCHECK_LEN(tptr, sizeof(nd_ipv4));
            ND_PRINT("\n\t      IPv4 neighbor address: %s", GET_IPADDR_STRING(tptr));
            tptr+=sizeof(nd_ipv4);
            tlen-=sizeof(nd_ipv4);
@@ -3472,7 +3450,6 @@ isis_print(netdissect_options *ndo,
                 }
                 if (tlen < prefix_len/2)
                     break;
-                ND_TCHECK_LEN(tptr, prefix_len / 2);
                 ND_PRINT("\n\t\tAddress: %s/%u",
                        GET_ISONSAP_STRING(tptr, prefix_len / 2), prefix_len * 4);
                 tptr+=prefix_len/2;
@@ -3492,7 +3469,6 @@ isis_print(netdissect_options *ndo,
                 nd_print_invalid(ndo);
                 break;
             }
-            ND_TCHECK_5(tptr); /* router-id + flags */
             ND_PRINT("\n\t      Router-ID %s", GET_IPADDR_STRING(tptr));
             ND_PRINT(", Flags [%s]",
                     bittok2str(isis_tlv_router_capability_flags, "none", GET_U_1(tptr+4)));