]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use more the EXTRACT_8BITS() macro to fetch a one-byte value (1/n)
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 19 Nov 2017 11:54:25 +0000 (12:54 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Sun, 19 Nov 2017 11:54:25 +0000 (12:54 +0100)
In bittok2str() calls.

print-aoe.c
print-eap.c
print-isoclns.c
print-ldp.c
print-lldp.c
print-ospf.c
print-rsvp.c
print-udld.c

index 4b483bd8d36ef27f8873045a9c4a4fedc8b91660..68bfb95844f355892a220e70f67f4ce5edacb21b 100644 (file)
@@ -149,7 +149,7 @@ aoev1_issue_print(netdissect_options *ndo,
                goto invalid;
        /* AFlags */
        ND_TCHECK2(*cp, 1);
-       ND_PRINT((ndo, "\n\tAFlags: [%s]", bittok2str(aoev1_aflag_str, "none", *cp)));
+       ND_PRINT((ndo, "\n\tAFlags: [%s]", bittok2str(aoev1_aflag_str, "none", EXTRACT_8BITS(cp))));
        cp += 1;
        /* Err/Feature */
        ND_TCHECK2(*cp, 1);
index 886b4f6c91bc6aff0701e4652076875d6e3f5e4f..cc115ee6653c198d27e4634bd66d4393812d3934 100644 (file)
@@ -240,7 +240,7 @@ eap_print(netdissect_options *ndo,
                     ND_PRINT((ndo, " TTLSv%u",
                            EAP_TTLS_VERSION(*(tptr + 5))));
                 ND_PRINT((ndo, " flags [%s] 0x%02x,",
-                       bittok2str(eap_tls_flags_values, "none", *(tptr+5)),
+                       bittok2str(eap_tls_flags_values, "none", EXTRACT_8BITS((tptr + 5))),
                        *(tptr + 5)));
 
                 if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) {
@@ -254,7 +254,7 @@ eap_print(netdissect_options *ndo,
                 ND_PRINT((ndo, " FASTv%u",
                        EAP_TTLS_VERSION(*(tptr + 5))));
                 ND_PRINT((ndo, " flags [%s] 0x%02x,",
-                       bittok2str(eap_tls_flags_values, "none", *(tptr+5)),
+                       bittok2str(eap_tls_flags_values, "none", EXTRACT_8BITS((tptr + 5))),
                        *(tptr + 5)));
 
                 if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) {
index cbd33a2c1b001b5eeb849a3c5e0cf8bb8cde0096..fa4dc9c3b49a517a91d66a9dc052605db7d77a8b 100644 (file)
@@ -1896,8 +1896,8 @@ isis_print_is_reach_subtlv(netdissect_options *ndo,
         case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE:
             if (subl >= 2) {
               ND_PRINT((ndo, ", %s, Priority %u",
-                  bittok2str(gmpls_link_prot_values, "none", *tptr),
-                   *(tptr+1)));
+                  bittok2str(gmpls_link_prot_values, "none", EXTRACT_8BITS(tptr)),
+                  *(tptr+1)));
             }
             break;
         case ISIS_SUBTLV_SPB_METRIC:
@@ -2997,7 +2997,7 @@ isis_print(netdissect_options *ndo,
                 break;
             ND_TCHECK2(*tptr, ISIS_TLV_RESTART_SIGNALING_FLAGLEN);
             ND_PRINT((ndo, "\n\t      Flags [%s]",
-                   bittok2str(isis_restart_flag_values, "none", *tptr)));
+                   bittok2str(isis_restart_flag_values, "none", EXTRACT_8BITS(tptr))));
             tptr+=ISIS_TLV_RESTART_SIGNALING_FLAGLEN;
             tmp-=ISIS_TLV_RESTART_SIGNALING_FLAGLEN;
 
index 7f991a2b56476d14bba35e59d9f3f484b6999dca..facb231394e043044692d2e38b89e294bd26cf54 100644 (file)
@@ -447,10 +447,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),
-                           bittok2str(ldp_fec_martini_ifparm_vccv_cc_values, "none", *(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),
-                           bittok2str(ldp_fec_martini_ifparm_vccv_cv_values, "none", *(tptr+3))));
+                           bittok2str(ldp_fec_martini_ifparm_vccv_cv_values, "none", EXTRACT_8BITS((tptr + 3)))));
                     break;
 
                 default:
index f43af3b61928b31741c65b4c479d66c48e555f01..1decb31cd965b3996900baa9049d1a05917a205a 100644 (file)
@@ -676,8 +676,8 @@ lldp_private_8021_print(netdissect_options *ndo,
         }
         ND_PRINT((ndo, "\n\t    port and protocol vlan id (PPVID): %u, flags [%s] (0x%02x)",
                EXTRACT_BE_16BITS(tptr + 5),
-               bittok2str(lldp_8021_port_protocol_id_values, "none", *(tptr+4)),
-              *(tptr + 4)));
+               bittok2str(lldp_8021_port_protocol_id_values, "none", EXTRACT_8BITS((tptr + 4))),
+               *(tptr + 4)));
         break;
     case LLDP_PRIVATE_8021_SUBTYPE_VLAN_NAME:
         if (tlv_len < 6) {
@@ -868,7 +868,7 @@ lldp_private_8023_print(netdissect_options *ndo,
             return hexdump;
         }
         ND_PRINT((ndo, "\n\t    autonegotiation [%s] (0x%02x)",
-               bittok2str(lldp_8023_autonegotiation_values, "none", *(tptr+4)),
+               bittok2str(lldp_8023_autonegotiation_values, "none", EXTRACT_8BITS((tptr + 4))),
                *(tptr + 4)));
         ND_PRINT((ndo, "\n\t    PMD autoneg capability [%s] (0x%04x)",
                bittok2str(lldp_pmd_capability_values,"unknown", EXTRACT_BE_16BITS(tptr + 5)),
@@ -883,7 +883,7 @@ lldp_private_8023_print(netdissect_options *ndo,
             return hexdump;
         }
         ND_PRINT((ndo, "\n\t    MDI power support [%s], power pair %s, power class %s",
-               bittok2str(lldp_mdi_values, "none", *(tptr+4)),
+               bittok2str(lldp_mdi_values, "none", EXTRACT_8BITS((tptr + 4))),
                tok2str(lldp_mdi_power_pairs_values, "unknown", *(tptr+5)),
                tok2str(lldp_mdi_power_class_values, "unknown", *(tptr + 6))));
         break;
@@ -893,7 +893,7 @@ lldp_private_8023_print(netdissect_options *ndo,
             return hexdump;
         }
         ND_PRINT((ndo, "\n\t    aggregation status [%s], aggregation port ID %u",
-               bittok2str(lldp_aggregation_values, "none", *(tptr+4)),
+               bittok2str(lldp_aggregation_values, "none", EXTRACT_8BITS((tptr + 4))),
                EXTRACT_BE_32BITS(tptr + 5)));
         break;
 
@@ -1003,7 +1003,7 @@ lldp_private_tia_print(netdissect_options *ndo,
                tok2str(lldp_tia_application_type_values, "none", *(tptr+4)),
                *(tptr + 4)));
         ND_PRINT((ndo, ", Flags [%s]", bittok2str(
-                   lldp_tia_network_policy_bits_values, "none", *(tptr + 5))));
+                   lldp_tia_network_policy_bits_values, "none", EXTRACT_8BITS((tptr + 5)))));
         ND_PRINT((ndo, "\n\t    Vlan id %u",
                LLDP_EXTRACT_NETWORK_POLICY_VLAN(EXTRACT_BE_16BITS(tptr + 5))));
         ND_PRINT((ndo, ", L2 priority %u",
index 22eb4c522d491ed0c271e8863fde4879a1b01245..4c82c6111d73e16c8a03b6325384687a3b294a2f 100644 (file)
@@ -414,7 +414,7 @@ ospf_print_te_lsa(netdissect_options *ndo,
                        goto invalid;
                    }
                     ND_PRINT((ndo, ", %s",
-                             bittok2str(gmpls_link_prot_values, "none", *tptr)));
+                             bittok2str(gmpls_link_prot_values, "none", EXTRACT_8BITS(tptr))));
                     break;
                 case LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR:
                    if (subtlv_length < 36) {
index 3689b77e15f2a76dc7c7328256a8b08d50ffda9e..368aa9049393a3aa4c09100b39d86fe8e2fc686f 100644 (file)
@@ -1103,7 +1103,7 @@ rsvp_obj_print(netdissect_options *ndo,
                                *(obj_tptr+6),
                                bittok2str(rsvp_obj_rro_flag_values,
                                    "none",
-                                   *(obj_tptr + 7)))); /* rfc3209 says that this field is rsvd. */
+                                   EXTRACT_8BITS((obj_tptr + 7))))); /* rfc3209 says that this field is rsvd. */
                     break;
                     case RSVP_OBJ_XRO_LABEL:
                        if (length != 8) {
@@ -1114,7 +1114,7 @@ rsvp_obj_print(netdissect_options *ndo,
                         ND_PRINT((ndo, ", Flags: [%s] (%#x), Class-Type: %s (%u), %u",
                                bittok2str(rsvp_obj_rro_label_flag_values,
                                    "none",
-                                   *(obj_tptr+2)),
+                                   EXTRACT_8BITS((obj_tptr + 2))),
                                *(obj_tptr+2),
                                tok2str(rsvp_ctype_values,
                                        "Unknown",
@@ -1183,7 +1183,7 @@ rsvp_obj_print(netdissect_options *ndo,
                        (int)*(obj_tptr+1),
                        bittok2str(rsvp_session_attribute_flag_values,
                                   "none",
-                                  *(obj_tptr+2)),
+                                  EXTRACT_8BITS((obj_tptr + 2))),
                        *(obj_tptr + 2)));
                 obj_tlen-=4+*(obj_tptr+3);
                 obj_tptr+=4+*(obj_tptr+3);
index 9e77b1c734898e719719f7eae0c308875f4d856e..4b9105bae74144797e1a88c9e2707691213fc168 100644 (file)
@@ -112,7 +112,7 @@ udld_print (netdissect_options *ndo, const u_char *pptr, u_int length)
            UDLD_EXTRACT_VERSION(*tptr),
            tok2str(udld_code_values, "Reserved", code),
            code,
-           bittok2str(udld_flags_values, "none", *(tptr+1)),
+           bittok2str(udld_flags_values, "none", EXTRACT_8BITS((tptr + 1))),
            *(tptr+1),
            length));