]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-isoclns.c
Use more the EXTRACT_U_1() macro (40/n)
[tcpdump] / print-isoclns.c
index e2d0aec7740e92665460ded9c4dce6fcc9e457b1..e4bc69412abc34bacdb347cabec8fef0f54bff5b 100644 (file)
@@ -678,7 +678,7 @@ isoclns_print(netdissect_options *ndo, const uint8_t *p, u_int length)
        }
 
        if (ndo->ndo_eflag)
-               ND_PRINT((ndo, "OSI NLPID %s (0x%02x): ", tok2str(nlpid_values, "Unknown", EXTRACT_U_1(p)), *p));
+               ND_PRINT((ndo, "OSI NLPID %s (0x%02x): ", tok2str(nlpid_values, "Unknown", EXTRACT_U_1(p)), EXTRACT_U_1(p)));
 
        switch (*p) {
 
@@ -718,7 +718,7 @@ isoclns_print(netdissect_options *ndo, const uint8_t *p, u_int length)
 
        default:
                if (!ndo->ndo_eflag)
-                       ND_PRINT((ndo, "OSI NLPID 0x%02x unknown", *p));
+                       ND_PRINT((ndo, "OSI NLPID 0x%02x unknown", EXTRACT_U_1(p)));
                ND_PRINT((ndo, "%slength: %u", ndo->ndo_eflag ? "" : ", ", length));
                if (length > 1)
                        print_unknown_data(ndo, p, "\n\t", length);
@@ -1666,17 +1666,19 @@ isis_print_id(const uint8_t *cp, int id_len)
     if (sysid_len > id_len)
         sysid_len = id_len;
     for (i = 1; i <= sysid_len; i++) {
-        snprintf(pos, sizeof(id) - (pos - id), "%02x", *cp++);
+        snprintf(pos, sizeof(id) - (pos - id), "%02x", EXTRACT_U_1(cp));
+       cp++;
        pos += strlen(pos);
        if (i == 2 || i == 4)
            *pos++ = '.';
        }
     if (id_len >= NODE_ID_LEN) {
-        snprintf(pos, sizeof(id) - (pos - id), ".%02x", *cp++);
+        snprintf(pos, sizeof(id) - (pos - id), ".%02x", EXTRACT_U_1(cp));
+       cp++;
        pos += strlen(pos);
     }
     if (id_len == LSP_ID_LEN)
-        snprintf(pos, sizeof(id) - (pos - id), "-%02x", *cp);
+        snprintf(pos, sizeof(id) - (pos - id), "-%02x", EXTRACT_U_1(cp));
     return (id);
 }
 
@@ -2015,7 +2017,7 @@ isis_print_ext_is_reach(netdissect_options *ndo,
     if (subtlv_sum_len) {
         ND_PRINT((ndo, " (%u)", subtlv_sum_len));
         while (subtlv_sum_len>0) {
-            if (!ND_TTEST2(*tptr,2))
+            if (!ND_TTEST_2(tptr))
                 return(0);
             subtlv_type=EXTRACT_U_1(tptr);
             subtlv_len=EXTRACT_U_1(tptr + 1);
@@ -2092,7 +2094,7 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
         }
         processed++;
     } else if (afi == AF_INET6) {
-        if (!ND_TTEST2(*tptr, 2)) /* fetch status & prefix_len byte */
+        if (!ND_TTEST_2(tptr)) /* fetch status & prefix_len byte */
             return (0);
         status_byte=EXTRACT_U_1(tptr);
         bit_length=EXTRACT_U_1(tptr + 1);
@@ -2153,7 +2155,7 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
         ND_PRINT((ndo, " (%u)", sublen));   /* print out subTLV length */
 
         while (sublen>0) {
-            if (!ND_TTEST2(*tptr,2))
+            if (!ND_TTEST_2(tptr))
                 return (0);
             subtlvtype=EXTRACT_U_1(tptr);
             subtlvlen=EXTRACT_U_1(tptr + 1);
@@ -3189,7 +3191,7 @@ osi_print_cksum(netdissect_options *ndo, const uint8_t *pptr,
          */
         if (!checksum
             || checksum_offset < 0
-            || !ND_TTEST2(*(pptr + checksum_offset), 2)
+            || !ND_TTEST_2(pptr + checksum_offset)
             || (u_int)checksum_offset > length
             || !ND_TTEST2(*pptr, length)) {
                 ND_PRINT((ndo, " (unverified)"));