]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use more the EXTRACT_8BITS() macro to fetch a one-byte value (14/n)
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 21 Nov 2017 16:38:35 +0000 (17:38 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 21 Nov 2017 16:38:35 +0000 (17:38 +0100)
Assignment, one operator.

print-aoe.c
print-lldp.c
print-mpcp.c
print-ppp.c
print-snmp.c

index c790ee2a159461aea43cf1151116d04dbaec7025..7dcf5aa2867d178f248cc1443b4ce92296233956 100644 (file)
@@ -350,7 +350,7 @@ aoev1_print(netdissect_options *ndo,
        if (len < AOEV1_COMMON_HDR_LEN)
                goto invalid;
        /* Flags */
-       flags = *cp & 0x0F;
+       flags = EXTRACT_8BITS(cp) & 0x0F;
        ND_PRINT((ndo, ", Flags: [%s]", bittok2str(aoev1_flag_str, "none", flags)));
        cp += 1;
        if (! ndo->ndo_vflag)
index f3441f254422e823b439a70dd3b5d92ae78bdd2d..fd016a2ed69416906ec7b1bd5bd3befd65abac71 100644 (file)
@@ -920,7 +920,7 @@ lldp_extract_latlon(const u_char *tptr)
 {
     uint64_t latlon;
 
-    latlon = *tptr & 0x3;
+    latlon = EXTRACT_8BITS(tptr) & 0x3;
     latlon = (latlon << 32) | EXTRACT_BE_32BITS(tptr + 1);
 
     return latlon;
index 7d7a975531bcaa1766d87437dd1b22797d0d4981..d40d03da9331ecb89e0a467e5fdf8c391b693244 100644 (file)
@@ -159,7 +159,7 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int
 
     case MPCP_OPCODE_GATE:
         ND_TCHECK2(*tptr, MPCP_GRANT_NUMBER_LEN);
-        grant_numbers = *tptr & MPCP_GRANT_NUMBER_MASK;
+        grant_numbers = EXTRACT_8BITS(tptr) & MPCP_GRANT_NUMBER_MASK;
         ND_PRINT((ndo, "\n\tGrant Numbers %u, Flags [ %s ]",
                grant_numbers,
                bittok2str(mpcp_grant_flag_values,
index 88e5792d188ba505d3b65fc9d9924fdddc0b1a69..b6723f8544783c3801039fc164a41d22e1948aa7 100644 (file)
@@ -1395,7 +1395,8 @@ ppp_hdlc(netdissect_options *ndo,
                        if (i <= 1 || !ND_TTEST(*s))
                                break;
                        i--;
-                       c = *s++ ^ 0x20;
+                       c = EXTRACT_8BITS(s) ^ 0x20;
+                       s++;
                }
                *t++ = c;
        }
index 1b096dcfe579289b90be9521dafaad86df1e136e..dc6f1a6e7325cb0c7fac51b44f3ddc7122c18b5b 100644 (file)
@@ -72,6 +72,7 @@
 #endif
 
 #include "netdissect.h"
+#include "extract.h"
 
 #undef OPAQUE  /* defined in <wingdi.h> */
 
@@ -437,7 +438,7 @@ asn1_parse(netdissect_options *ndo,
         *  +---+---+---+---+---+---+---+---+
         *    7   6   5   4   3   2   1   0
         */
-       id = *p & ASN_ID_BITS;          /* lower 5 bits, range 00-1f */
+       id = EXTRACT_8BITS(p) & ASN_ID_BITS;            /* lower 5 bits, range 00-1f */
 #ifdef notdef
        form = (*p & 0xe0) >> 5;        /* move upper 3 bits to lower 3 */
        class = form >> 1;              /* bits 7&6 -> bits 1&0, range 0-3 */