]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use more the EXTRACT_8BITS() macro to fetch a one-byte value (12/n)
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 20 Nov 2017 07:05:29 +0000 (08:05 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 20 Nov 2017 08:40:00 +0000 (09:40 +0100)
In ND_PRINT() macro calls.

print-aoe.c
print-bgp.c
print-cdp.c
print-dtp.c
print-eap.c
print-hncp.c
print-ldp.c
print-rsvp.c
print-slow.c
print-udld.c

index 19d301b916b294e4ba1a1a36f0cb7b714e5cbd07..c790ee2a159461aea43cf1151116d04dbaec7025 100644 (file)
@@ -226,7 +226,7 @@ aoev1_query_print(netdissect_options *ndo,
        cp += 1;
        /* AoE/CCmd */
        ND_TCHECK2(*cp, 1);
-       ND_PRINT((ndo, ", AoE: %u, CCmd: %s", (*cp & 0xF0) >> 4,
+       ND_PRINT((ndo, ", AoE: %u, CCmd: %s", (EXTRACT_8BITS(cp) & 0xF0) >> 4,
                  tok2str(aoev1_ccmd_str, "Unknown (0x02x)", EXTRACT_8BITS(cp) & 0x0F)));
        cp += 1;
        /* Config String Length */
index 26404015b3c45fefeac632df655fc45f9a3359db..0c7e18b0fc24d9c2b5554a65e75bab9b1f1e5719 100644 (file)
@@ -2126,7 +2126,7 @@ bgp_attr_print(netdissect_options *ndo,
                                tok2str(l2vpn_encaps_values,
                                          "unknown encaps",
                                          EXTRACT_8BITS((tptr + 2))),
-                               *(tptr+3),
+                               EXTRACT_8BITS((tptr + 3)),
                                EXTRACT_BE_16BITS(tptr + 4)));
                         break;
                     case BGP_EXT_COM_SOURCE_AS:
@@ -2705,7 +2705,7 @@ bgp_notification_print(netdissect_options *ndo,
                                  EXTRACT_BE_16BITS(tptr)),
                       EXTRACT_BE_16BITS(tptr),
                       tok2str(bgp_safi_values, "Unknown", EXTRACT_8BITS((tptr + 2))),
-                      *(tptr+2),
+                      EXTRACT_8BITS((tptr + 2)),
                       EXTRACT_BE_32BITS(tptr + 3)));
            }
            /*
index 9b12e413c830de0f918dda58f11b891b4adab502..d8d654ae852057bc0674d9bb03e4cbc16859d4de 100644 (file)
@@ -105,7 +105,7 @@ cdp_print(netdissect_options *ndo,
        tptr = pptr; /* temporary pointer */
 
        ND_TCHECK2(*tptr, CDP_HEADER_LEN);
-       ND_PRINT((ndo, "CDPv%u, ttl: %us", *(tptr + CDP_HEADER_VERSION_OFFSET),
+       ND_PRINT((ndo, "CDPv%u, ttl: %us", EXTRACT_8BITS((tptr + CDP_HEADER_VERSION_OFFSET)),
                                           *(tptr + CDP_HEADER_TTL_OFFSET)));
        if (ndo->ndo_vflag)
                ND_PRINT((ndo, ", checksum: 0x%04x (unverified), length %u", EXTRACT_BE_16BITS(tptr + CDP_HEADER_CHECKSUM_OFFSET), length));
@@ -211,7 +211,7 @@ cdp_print(netdissect_options *ndo,
                    case 0x0e: /* ATA-186 VoIP VLAN request - incomplete doc. */
                        if (len < 3)
                            goto trunc;
-                       ND_PRINT((ndo, "app %d, vlan %d", *(tptr), EXTRACT_BE_16BITS(tptr + 1)));
+                       ND_PRINT((ndo, "app %d, vlan %d", EXTRACT_8BITS((tptr)), EXTRACT_BE_16BITS(tptr + 1)));
                        break;
                    case 0x10: /* ATA-186 VoIP VLAN assignment - incomplete doc. */
                        ND_PRINT((ndo, "%1.2fW", cdp_get_number(tptr, len) / 1000.0));
@@ -341,7 +341,7 @@ cdp_print_addr(netdissect_options *ndo,
                        ND_TCHECK2(*p, pl);
                        if (p + pl > endp)
                                goto trunc;
-                       ND_PRINT((ndo, "pt=0x%02x, pl=%d, pb=", *(p - 2), pl));
+                       ND_PRINT((ndo, "pt=0x%02x, pl=%d, pb=", EXTRACT_8BITS((p - 2)), pl));
                        while (pl-- > 0)
                                ND_PRINT((ndo, " %02x", *p++));
                        ND_TCHECK2(*p, 2);
index 2c981fc6c1144470f0f49e15cdd08b4b325b3590..43e1291e7ce2514c759c603bd5844dd20fb2c545 100644 (file)
@@ -57,7 +57,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
     ND_TCHECK2(*tptr, DTP_HEADER_LEN);
 
     ND_PRINT((ndo, "DTPv%u, length %u",
-           (*tptr),
+           EXTRACT_8BITS(tptr),
            length));
 
     /*
index 182b81e2818175e8f8b2fd56eb90e20da22f2190..895dbfe127cfa1caa3df4b65140f6dc4cd789e12 100644 (file)
@@ -189,7 +189,7 @@ eap_print(netdissect_options *ndo,
         ND_PRINT((ndo, ", %s (%u), id %u, len %u",
                tok2str(eap_code_values, "unknown", type),
                type,
-               *(tptr+1),
+               EXTRACT_8BITS((tptr + 1)),
                len));
 
         ND_TCHECK2(*tptr, len);
index d606116dcebf2379f39f0d6f8b5e2f28183a5322..068a2391fdf10877c77755ba4ca7da8d42754bed 100644 (file)
@@ -580,7 +580,7 @@ hncp_print_rec(netdissect_options *ndo,
                 break;
             }
             ND_PRINT((ndo, " Verdict: %u Fingerprint: %s Common Name: ",
-                *value,
+                EXTRACT_8BITS(value),
                 format_256(value + 4)));
             safeputs(ndo, value + 36, bodylen - 36);
         }
index facb231394e043044692d2e38b89e294bd26cf54..ed176b70bcbbd8385f5326edff189e2a0d5b75df 100644 (file)
@@ -446,10 +446,10 @@ ldp_tlv_print(netdissect_options *ndo,
 
                 case LDP_FEC_MARTINI_IFPARM_VCCV:
                     ND_PRINT((ndo, "\n\t\t  Control Channels (0x%02x) = [%s]",
-                           *(tptr+2),
+                           EXTRACT_8BITS((tptr + 2)),
                            bittok2str(ldp_fec_martini_ifparm_vccv_cc_values, "none", EXTRACT_8BITS((tptr + 2)))));
                     ND_PRINT((ndo, "\n\t\t  CV Types (0x%02x) = [%s]",
-                           *(tptr+3),
+                           EXTRACT_8BITS((tptr + 3)),
                            bittok2str(ldp_fec_martini_ifparm_vccv_cv_values, "none", EXTRACT_8BITS((tptr + 3)))));
                     break;
 
index 1e0972a6034ea9064558e6407e96225809b1283f..b37fe5952c535c98e7e5d52f0c7d4f648ab6eebb 100644 (file)
@@ -741,7 +741,7 @@ rsvp_obj_print(netdissect_options *ndo,
                        *(obj_tptr + sizeof(struct in_addr))));
                 ND_PRINT((ndo, "%s  Flags: [0x%02x], DestPort %u",
                        indent,
-                       *(obj_tptr+5),
+                       EXTRACT_8BITS((obj_tptr + 5)),
                        EXTRACT_BE_16BITS(obj_tptr + 6)));
                 obj_tlen-=8;
                 obj_tptr+=8;
@@ -755,7 +755,7 @@ rsvp_obj_print(netdissect_options *ndo,
                        *(obj_tptr + sizeof(struct in6_addr))));
                 ND_PRINT((ndo, "%s  Flags: [0x%02x], DestPort %u",
                        indent,
-                       *(obj_tptr+sizeof(struct in6_addr)+1),
+                       EXTRACT_8BITS((obj_tptr + sizeof(struct in6_addr) + 1)),
                        EXTRACT_BE_16BITS(obj_tptr + sizeof(struct in6_addr) + 2)));
                 obj_tlen-=20;
                 obj_tptr+=20;
@@ -1100,7 +1100,7 @@ rsvp_obj_print(netdissect_options *ndo,
                         ND_PRINT((ndo, ", %s, %s/%u, Flags: [%s]",
                                RSVP_OBJ_XRO_MASK_LOOSE(EXTRACT_8BITS(obj_tptr)) ? "Loose" : "Strict",
                                ipaddr_string(ndo, obj_tptr+2),
-                               *(obj_tptr+6),
+                               EXTRACT_8BITS((obj_tptr + 6)),
                                bittok2str(rsvp_obj_rro_flag_values,
                                    "none",
                                    EXTRACT_8BITS((obj_tptr + 7))))); /* rfc3209 says that this field is rsvd. */
@@ -1119,7 +1119,7 @@ rsvp_obj_print(netdissect_options *ndo,
                                tok2str(rsvp_ctype_values,
                                        "Unknown",
                                        EXTRACT_8BITS((obj_tptr + 3)) + (256 * RSVP_OBJ_RRO)),
-                               *(obj_tptr+3),
+                               EXTRACT_8BITS((obj_tptr + 3)),
                                EXTRACT_BE_32BITS(obj_tptr + 4)));
                     }
                     obj_tlen-=*(obj_tptr+1);
@@ -1369,7 +1369,7 @@ rsvp_obj_print(netdissect_options *ndo,
                     return-1;
                 ND_PRINT((ndo, "%s  Msg-Version: %u, length: %u",
                        indent,
-                       (*obj_tptr & 0xf0) >> 4,
+                       (EXTRACT_8BITS(obj_tptr) & 0xf0) >> 4,
                        EXTRACT_BE_16BITS(obj_tptr + 2) << 2));
                 obj_tptr+=4; /* get to the start of the service header */
                 obj_tlen-=4;
@@ -1647,7 +1647,7 @@ rsvp_obj_print(netdissect_options *ndo,
                     ND_PRINT((ndo, "%s    %s TLV (0x%02x), length: %u", /* length includes header */
                            indent,
                            tok2str(rsvp_obj_prop_tlv_values,"unknown",EXTRACT_8BITS(obj_tptr)),
-                           *obj_tptr,
+                           EXTRACT_8BITS(obj_tptr),
                            *(obj_tptr + 1)));
                     if (obj_tlen < *(obj_tptr+1))
                         return-1;
@@ -1673,7 +1673,7 @@ rsvp_obj_print(netdissect_options *ndo,
                     return-1;
                 ND_PRINT((ndo, "%s  Flags [0x%02x], epoch: %u",
                        indent,
-                       *obj_tptr,
+                       EXTRACT_8BITS(obj_tptr),
                        EXTRACT_BE_24BITS(obj_tptr + 1)));
                 obj_tlen-=4;
                 obj_tptr+=4;
index 46de14c2c63f132cd830b672cf9e8351219d20ac..8b3dca10ecf70d6371cbdd6550a8e793c112e21d 100644 (file)
@@ -292,7 +292,7 @@ slow_print(netdissect_options *ndo,
     if (print_version == 1) {
         ND_PRINT((ndo, "%sv%u, length %u",
                tok2str(slow_proto_values, "unknown (%u)", subtype),
-               *(pptr+1),
+               EXTRACT_8BITS((pptr + 1)),
                len));
     } else {
         /* some slow protos don't have a version number in the header */
index 4b9105bae74144797e1a88c9e2707691213fc168..011fd8ad585cc60194a19d28ea5d91cb30461a7e 100644 (file)
@@ -113,7 +113,7 @@ udld_print (netdissect_options *ndo, const u_char *pptr, u_int length)
            tok2str(udld_code_values, "Reserved", code),
            code,
            bittok2str(udld_flags_values, "none", EXTRACT_8BITS((tptr + 1))),
-           *(tptr+1),
+           EXTRACT_8BITS((tptr + 1)),
            length));
 
     /*