diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2017-11-21 21:53:35 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2017-11-21 22:23:47 +0100 |
commit | cb9b66505924ae735e5ef772a434e72089231076 (patch) | |
tree | 47df75adb4f99b60e9ba6755ff2bb9c65de41429 | |
parent | fe1c2f0d7fb9221936b0d54a670b9f2eea2b72c4 (diff) | |
download | tcpdump-cb9b66505924ae735e5ef772a434e72089231076.tar.gz |
Use more the EXTRACT_8BITS() macro to fetch a one-byte value (18/n)
Assignment, *(p op e)
Partial list.
-rw-r--r-- | print-802_11.c | 4 | ||||
-rw-r--r-- | print-cdp.c | 2 | ||||
-rw-r--r-- | print-dccp.c | 2 | ||||
-rw-r--r-- | print-eap.c | 2 | ||||
-rw-r--r-- | print-geneve.c | 2 | ||||
-rw-r--r-- | print-gre.c | 4 | ||||
-rw-r--r-- | print-ldp.c | 4 | ||||
-rw-r--r-- | print-llc.c | 4 | ||||
-rw-r--r-- | print-lldp.c | 52 | ||||
-rw-r--r-- | print-ppp.c | 2 | ||||
-rw-r--r-- | print-radius.c | 2 | ||||
-rw-r--r-- | print-rrcp.c | 2 | ||||
-rw-r--r-- | print-rsvp.c | 18 | ||||
-rw-r--r-- | print-vtp.c | 6 |
14 files changed, 53 insertions, 53 deletions
diff --git a/print-802_11.c b/print-802_11.c index 1f6f74f2..8918d3d7 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -1023,7 +1023,7 @@ parse_elements(netdissect_options *ndo, return 0; if (length < 2) return 0; - elementlen = *(p + offset + 1); + elementlen = EXTRACT_8BITS(p + offset + 1); /* Make sure we have the entire element. */ if (!ND_TTEST2(*(p + offset + 2), elementlen)) @@ -1123,7 +1123,7 @@ parse_elements(netdissect_options *ndo, length -= ds.length; break; } - ds.channel = *(p + offset); + ds.channel = EXTRACT_8BITS(p + offset); offset += 1; length -= 1; /* diff --git a/print-cdp.c b/print-cdp.c index 6913e3c2..188a3321 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -170,7 +170,7 @@ cdp_print(netdissect_options *ndo, case 0x05: /* Version */ ND_PRINT((ndo, "\n\t ")); for (i=0;i<len;i++) { - j = *(tptr+i); + j = EXTRACT_8BITS(tptr + i); if (j == '\n') /* lets rework the version string to get a nice indentation */ ND_PRINT((ndo, "\n\t ")); diff --git a/print-dccp.c b/print-dccp.c index 56ab2746..7f7f8127 100644 --- a/print-dccp.c +++ b/print-dccp.c @@ -539,7 +539,7 @@ static int dccp_print_option(netdissect_options *ndo, const u_char *option, u_in if (*option >= 32) { ND_TCHECK(*(option+1)); - optlen = *(option +1); + optlen = EXTRACT_8BITS(option + 1); if (optlen < 2) { if (*option >= 128) ND_PRINT((ndo, "CCID option %u optlen too short", *option)); diff --git a/print-eap.c b/print-eap.c index 895dbfe1..56388da0 100644 --- a/print-eap.c +++ b/print-eap.c @@ -196,7 +196,7 @@ eap_print(netdissect_options *ndo, if (type <= 2) { /* For EAP_REQUEST and EAP_RESPONSE only */ ND_TCHECK_8BITS(tptr+4); - subtype = *(tptr+4); + subtype = EXTRACT_8BITS(tptr + 4); ND_PRINT((ndo, "\n\t\t Type %s (%u)", tok2str(eap_type_values, "unknown", subtype), subtype)); diff --git a/print-geneve.c b/print-geneve.c index f7054fb5..9ca7bf2e 100644 --- a/print-geneve.c +++ b/print-geneve.c @@ -113,7 +113,7 @@ geneve_opts_print(netdissect_options *ndo, const u_char *bp, u_int len) sep = ", "; opt_class = EXTRACT_BE_16BITS(bp); - opt_type = *(bp + 2); + opt_type = EXTRACT_8BITS(bp + 2); opt_len = 4 + ((*(bp + 3) & OPT_LEN_MASK) * 4); ND_PRINT((ndo, "class %s (0x%x) type 0x%x%s len %u", diff --git a/print-gre.c b/print-gre.c index 0de72886..a11cb9b8 100644 --- a/print-gre.c +++ b/print-gre.c @@ -180,8 +180,8 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length) if (len < 4) goto trunc; af = EXTRACT_BE_16BITS(bp); - sreoff = *(bp + 2); - srelen = *(bp + 3); + sreoff = EXTRACT_8BITS(bp + 2); + srelen = EXTRACT_8BITS(bp + 3); bp += 4; len -= 4; diff --git a/print-ldp.c b/print-ldp.c index ed176b70..df43da78 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -384,7 +384,7 @@ ldp_tlv_print(netdissect_options *ndo, * Pseudowire Types. */ TLV_TCHECK(7); - vc_info_len = *(tptr+2); + vc_info_len = EXTRACT_8BITS(tptr + 2); /* * According to RFC 4908, the VC info Length field can be zero, @@ -422,7 +422,7 @@ ldp_tlv_print(netdissect_options *ndo, while (vc_info_len > 2) { vc_info_tlv_type = *tptr; - vc_info_tlv_len = *(tptr+1); + vc_info_tlv_len = EXTRACT_8BITS(tptr + 1); if (vc_info_tlv_len < 2) break; if (vc_info_len < vc_info_tlv_len) diff --git a/print-llc.c b/print-llc.c index b3fbef0f..699cc63c 100644 --- a/print-llc.c +++ b/print-llc.c @@ -167,7 +167,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, } dsap_field = *p; - ssap_field = *(p + 1); + ssap_field = EXTRACT_8BITS(p + 1); /* * OK, what type of LLC frame is this? The length @@ -175,7 +175,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, * have a two-byte control field, and U frames have * a one-byte control field. */ - control = *(p + 2); + control = EXTRACT_8BITS(p + 2); if ((control & LLC_U_FMT) == LLC_U_FMT) { /* * U frame. diff --git a/print-lldp.c b/print-lldp.c index b06dab61..ed97f40a 100644 --- a/print-lldp.c +++ b/print-lldp.c @@ -656,7 +656,7 @@ lldp_private_8021_print(netdissect_options *ndo, if (tlv_len < 4) { return hexdump; } - subtype = *(tptr+3); + subtype = EXTRACT_8BITS(tptr + 3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", tok2str(lldp_8021_subtype_values, "unknown", subtype), @@ -687,7 +687,7 @@ lldp_private_8021_print(netdissect_options *ndo, if (tlv_len < 7) { return hexdump; } - sublen = *(tptr+6); + sublen = EXTRACT_8BITS(tptr + 6); if (tlv_len < 7+sublen) { return hexdump; } @@ -698,7 +698,7 @@ lldp_private_8021_print(netdissect_options *ndo, if (tlv_len < 5) { return hexdump; } - sublen = *(tptr+4); + sublen = EXTRACT_8BITS(tptr + 4); if (tlv_len < 5+sublen) { return hexdump; } @@ -709,13 +709,13 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CONGESTION_NOTIFICATION_LENGTH){ return hexdump; } - tval=*(tptr+4); + tval=EXTRACT_8BITS(tptr + 4); ND_PRINT((ndo, "\n\t Pre-Priority CNPV Indicator")); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : ")); for(i=0;i<NO_OF_BITS;i++) ND_PRINT((ndo, "%-2d ", (tval >> i) & 0x01)); - tval=*(tptr+5); + tval=EXTRACT_8BITS(tptr + 5); ND_PRINT((ndo, "\n\t Pre-Priority Ready Indicator")); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : ")); @@ -727,7 +727,7 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_ETS_CONFIGURATION_LENGTH) { return hexdump; } - tval=*(tptr+4); + tval=EXTRACT_8BITS(tptr + 4); ND_PRINT((ndo, "\n\t Willing:%d, CBS:%d, RES:%d, Max TCs:%d", tval >> 7, (tval >> 6) & 0x02, (tval >> 3) & 0x07, tval & 0x07)); @@ -759,11 +759,11 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_PFC_CONFIGURATION_LENGTH) { return hexdump; } - tval=*(tptr+4); + tval=EXTRACT_8BITS(tptr + 4); ND_PRINT((ndo, "\n\t Willing: %d, MBC: %d, RES: %d, PFC cap:%d ", tval >> 7, (tval >> 6) & 0x01, (tval >> 4) & 0x03, (tval & 0x0f))); ND_PRINT((ndo, "\n\t PFC Enable")); - tval=*(tptr+5); + tval=EXTRACT_8BITS(tptr + 5); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : ")); for(i=0;i<NO_OF_BITS;i++) @@ -786,7 +786,7 @@ lldp_private_8021_print(netdissect_options *ndo, i=0; ND_PRINT((ndo, "\n\t Application Priority Table")); while(i<sublen) { - tval=*(tptr+i+5); + tval=EXTRACT_8BITS(tptr + i + 5); ND_PRINT((ndo, "\n\t Priority: %u, RES: %u, Sel: %u, Protocol ID: %u", tval >> 5, (tval >> 3) & 0x03, (tval & 0x07), EXTRACT_BE_16BITS(tptr + i + 5))); @@ -798,20 +798,20 @@ lldp_private_8021_print(netdissect_options *ndo, return hexdump; } ND_PRINT((ndo, "\n\t EVB Bridge Status")); - tval=*(tptr+4); + tval=EXTRACT_8BITS(tptr + 4); ND_PRINT((ndo, "\n\t RES: %d, BGID: %d, RRCAP: %d, RRCTR: %d", tval >> 3, (tval >> 2) & 0x01, (tval >> 1) & 0x01, tval & 0x01)); ND_PRINT((ndo, "\n\t EVB Station Status")); - tval=*(tptr+5); + tval=EXTRACT_8BITS(tptr + 5); ND_PRINT((ndo, "\n\t RES: %d, SGID: %d, RRREQ: %d,RRSTAT: %d", tval >> 4, (tval >> 3) & 0x01, (tval >> 2) & 0x01, tval & 0x03)); - tval=*(tptr+6); + tval=EXTRACT_8BITS(tptr + 6); ND_PRINT((ndo, "\n\t R: %d, RTE: %d, ",tval >> 5, tval & 0x1f)); - tval=*(tptr+7); + tval=EXTRACT_8BITS(tptr + 7); ND_PRINT((ndo, "EVB Mode: %s [%d]", tok2str(lldp_evb_mode_values, "unknown", tval >> 6), tval >> 6)); ND_PRINT((ndo, "\n\t ROL: %d, RWD: %d, ", (tval >> 5) & 0x01, tval & 0x1f)); - tval=*(tptr+8); + tval=EXTRACT_8BITS(tptr + 8); ND_PRINT((ndo, "RES: %d, ROL: %d, RKA: %d", tval >> 6, (tval >> 5) & 0x01, tval & 0x1f)); break; @@ -819,7 +819,7 @@ lldp_private_8021_print(netdissect_options *ndo, if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CDCP_MIN_LENGTH){ return hexdump; } - tval=*(tptr+4); + tval=EXTRACT_8BITS(tptr + 4); ND_PRINT((ndo, "\n\t Role: %d, RES: %d, Scomp: %d ", tval >> 7, (tval >> 4) & 0x07, (tval >> 3) & 0x01)); ND_PRINT((ndo, "ChnCap: %d", EXTRACT_BE_16BITS(tptr + 6) & 0x0fff)); @@ -856,7 +856,7 @@ lldp_private_8023_print(netdissect_options *ndo, if (tlv_len < 4) { return hexdump; } - subtype = *(tptr+3); + subtype = EXTRACT_8BITS(tptr + 3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", tok2str(lldp_8023_subtype_values, "unknown", subtype), @@ -940,7 +940,7 @@ lldp_private_iana_print(netdissect_options *ndo, if (tlv_len < 8) { return hexdump; } - subtype = *(tptr+3); + subtype = EXTRACT_8BITS(tptr + 3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", tok2str(lldp_iana_subtype_values, "unknown", subtype), @@ -976,7 +976,7 @@ lldp_private_tia_print(netdissect_options *ndo, if (tlv_len < 4) { return hexdump; } - subtype = *(tptr+3); + subtype = EXTRACT_8BITS(tptr + 3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", tok2str(lldp_tia_subtype_values, "unknown", subtype), @@ -1016,7 +1016,7 @@ lldp_private_tia_print(netdissect_options *ndo, if (tlv_len < 5) { return hexdump; } - location_format = *(tptr+4); + location_format = EXTRACT_8BITS(tptr + 4); ND_PRINT((ndo, "\n\t Location data format %s (0x%02x)", tok2str(lldp_tia_location_data_format_values, "unknown", location_format), location_format)); @@ -1045,7 +1045,7 @@ lldp_private_tia_print(netdissect_options *ndo, if (tlv_len < 6) { return hexdump; } - lci_len = *(tptr+5); + lci_len = EXTRACT_8BITS(tptr + 5); if (lci_len < 3) { return hexdump; } @@ -1069,7 +1069,7 @@ lldp_private_tia_print(netdissect_options *ndo, return hexdump; } ca_type = *(tptr); - ca_len = *(tptr+1); + ca_len = EXTRACT_8BITS(tptr + 1); tptr += 2; lci_len -= 2; @@ -1159,7 +1159,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, if (len < 4) { return hexdump; } - subtype = *(pptr+3); + subtype = EXTRACT_8BITS(pptr + 3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", tok2str(lldp_dcbx_subtype_values, "unknown", subtype), @@ -1218,7 +1218,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr)); ND_PRINT((ndo, "\n\t Max_Version: %d", *(tptr + 1))); ND_PRINT((ndo, "\n\t Info block(0x%02X): ", *(tptr + 2))); - tval = *(tptr+2); + tval = EXTRACT_8BITS(tptr + 2); ND_PRINT((ndo, "Enable bit: %d, Willing bit: %d, Error Bit: %d", (tval & 0x80) ? 1 : 0, (tval & 0x40) ? 1 : 0, (tval & 0x20) ? 1 : 0)); @@ -1249,12 +1249,12 @@ lldp_private_dcbx_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr)); ND_PRINT((ndo, "\n\t Max_Version: %d", *(tptr + 1))); ND_PRINT((ndo, "\n\t Info block(0x%02X): ", *(tptr + 2))); - tval = *(tptr+2); + tval = EXTRACT_8BITS(tptr + 2); ND_PRINT((ndo, "Enable bit: %d, Willing bit: %d, Error Bit: %d", (tval & 0x80) ? 1 : 0, (tval & 0x40) ? 1 : 0, (tval & 0x20) ? 1 : 0)); ND_PRINT((ndo, "\n\t SubType: %d", *(tptr + 3))); - tval = *(tptr+4); + tval = EXTRACT_8BITS(tptr + 4); ND_PRINT((ndo, "\n\t PFC Config (0x%02X)", *(tptr + 4))); for (i = 0; i <= 7; i++) ND_PRINT((ndo, "\n\t Priority Bit %d: %s", @@ -1270,7 +1270,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr)); ND_PRINT((ndo, "\n\t Max_Version: %d", *(tptr + 1))); ND_PRINT((ndo, "\n\t Info block(0x%02X): ", *(tptr + 2))); - tval = *(tptr+2); + tval = EXTRACT_8BITS(tptr + 2); ND_PRINT((ndo, "Enable bit: %d, Willing bit: %d, Error Bit: %d", (tval & 0x80) ? 1 : 0, (tval & 0x40) ? 1 : 0, (tval & 0x20) ? 1 : 0)); diff --git a/print-ppp.c b/print-ppp.c index 9ace0e23..7203d12e 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -1103,7 +1103,7 @@ print_ipcp_config_options(netdissect_options *ndo, while (ipcomp_subopttotallen >= 2) { ND_TCHECK2(*p, 2); ipcomp_subopt = *p; - ipcomp_suboptlen = *(p+1); + ipcomp_suboptlen = EXTRACT_8BITS(p + 1); /* sanity check */ if (ipcomp_subopt == 0 || diff --git a/print-radius.c b/print-radius.c index 59e5fc5a..ccb51302 100644 --- a/print-radius.c +++ b/print-radius.c @@ -668,7 +668,7 @@ print_vendor_attr(netdissect_options *ndo, ND_TCHECK2(*data, 2); vendor_type = *(data); - vendor_length = *(data+1); + vendor_length = EXTRACT_8BITS(data + 1); if (vendor_length < 2) { diff --git a/print-rrcp.c b/print-rrcp.c index 866e75b9..bbbd4334 100644 --- a/print-rrcp.c +++ b/print-rrcp.c @@ -98,7 +98,7 @@ rrcp_print(netdissect_options *ndo, uint8_t rrcp_opcode; ND_TCHECK(*(cp + RRCP_PROTO_OFFSET)); - rrcp_proto = *(cp + RRCP_PROTO_OFFSET); + rrcp_proto = EXTRACT_8BITS(cp + RRCP_PROTO_OFFSET); ND_TCHECK(*(cp + RRCP_OPCODE_ISREPLY_OFFSET)); rrcp_opcode = EXTRACT_8BITS((cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK; if (src != NULL && dst != NULL) { diff --git a/print-rsvp.c b/print-rsvp.c index b37fe595..b511c29e 100644 --- a/print-rsvp.c +++ b/print-rsvp.c @@ -1069,7 +1069,7 @@ rsvp_obj_print(netdissect_options *ndo, u_char length; ND_TCHECK2(*obj_tptr, 4); - length = *(obj_tptr + 1); + length = EXTRACT_8BITS(obj_tptr + 1); ND_PRINT((ndo, "%s Subobject Type: %s, length %u", indent, tok2str(rsvp_obj_xro_values, @@ -1091,7 +1091,7 @@ rsvp_obj_print(netdissect_options *ndo, goto invalid; } ND_TCHECK2(*obj_tptr, 8); - prefix_length = *(obj_tptr+6); + prefix_length = EXTRACT_8BITS(obj_tptr + 6); if (prefix_length != 32) { ND_PRINT((ndo, " ERROR: Prefix length %u != 32", prefix_length)); @@ -1122,8 +1122,8 @@ rsvp_obj_print(netdissect_options *ndo, EXTRACT_8BITS((obj_tptr + 3)), EXTRACT_BE_32BITS(obj_tptr + 4))); } - obj_tlen-=*(obj_tptr+1); - obj_tptr+=*(obj_tptr+1); + obj_tlen-=EXTRACT_8BITS(obj_tptr + 1); + obj_tptr+=EXTRACT_8BITS(obj_tptr + 1); } break; default: @@ -1171,7 +1171,7 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_TUNNEL_IPV4: if (obj_tlen < 4) return-1; - namelen = *(obj_tptr+3); + namelen = EXTRACT_8BITS(obj_tptr + 3); if (obj_tlen < 4+namelen) return-1; ND_PRINT((ndo, "%s Session Name: ", indent)); @@ -1571,7 +1571,7 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return-1; - error_code=*(obj_tptr+5); + error_code=EXTRACT_8BITS(obj_tptr + 5); error_value=EXTRACT_BE_16BITS(obj_tptr + 6); ND_PRINT((ndo, "%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)", indent, @@ -1603,7 +1603,7 @@ rsvp_obj_print(netdissect_options *ndo, case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return-1; - error_code=*(obj_tptr+17); + error_code=EXTRACT_8BITS(obj_tptr + 17); error_value=EXTRACT_BE_16BITS(obj_tptr + 18); ND_PRINT((ndo, "%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)", indent, @@ -1654,8 +1654,8 @@ rsvp_obj_print(netdissect_options *ndo, if (*(obj_tptr+1) < 2) return -1; print_unknown_data(ndo, obj_tptr + 2, "\n\t\t", *(obj_tptr + 1) - 2); - obj_tlen-=*(obj_tptr+1); - obj_tptr+=*(obj_tptr+1); + obj_tlen-=EXTRACT_8BITS(obj_tptr + 1); + obj_tptr+=EXTRACT_8BITS(obj_tptr + 1); } break; default: diff --git a/print-vtp.c b/print-vtp.c index 0c07293a..fbde2c36 100644 --- a/print-vtp.c +++ b/print-vtp.c @@ -130,7 +130,7 @@ vtp_print (netdissect_options *ndo, ND_TCHECK2(*tptr, VTP_HEADER_LEN); - type = *(tptr+1); + type = EXTRACT_8BITS(tptr + 1); ND_PRINT((ndo, "VTPv%u, Message %s (0x%02x), length %u", *tptr, tok2str(vtp_message_type_values,"Unknown message type", type), @@ -144,7 +144,7 @@ vtp_print (netdissect_options *ndo, /* verbose mode print all fields */ ND_PRINT((ndo, "\n\tDomain name: ")); - mgmtd_len = *(tptr + 3); + mgmtd_len = EXTRACT_8BITS(tptr + 3); if (mgmtd_len < 1 || mgmtd_len > 32) { ND_PRINT((ndo, " [invalid MgmtD Len %d]", mgmtd_len)); return; @@ -288,7 +288,7 @@ vtp_print (netdissect_options *ndo, goto trunc; ND_TCHECK2(*tptr, 2); type = *tptr; - tlv_len = *(tptr+1); + tlv_len = EXTRACT_8BITS(tptr + 1); ND_PRINT((ndo, "\n\t\t%s (0x%04x) TLV", tok2str(vtp_vlan_tlv_values, "Unknown", type), |