]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use more the EXTRACT_U_1() macro (49/n)
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 9 Dec 2017 08:56:29 +0000 (09:56 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Sat, 9 Dec 2017 08:56:29 +0000 (09:56 +0100)
Assignment, *(p)

19 files changed:
print-ahcp.c
print-aodv.c
print-aoe.c
print-cfm.c
print-eap.c
print-ip.c
print-ip6.c
print-msdp.c
print-openflow-1.0.c
print-openflow.c
print-pppoe.c
print-radius.c
print-rsvp.c
print-slow.c
print-snmp.c
print-vtp.c
print-vxlan-gpe.c
print-vxlan.c
smbutil.c

index 8dfe9d1611d81b69a2601902d725523fdb5cc0c8..efe684a0afac8895dd5efa0bdfaff5930f2df8ef 100644 (file)
@@ -266,7 +266,7 @@ ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
        while (cp < ep) {
                /* Option no */
                ND_TCHECK_1(cp);
-               option_no = *cp;
+               option_no = EXTRACT_U_1(cp);
                cp += 1;
                ND_PRINT((ndo, "\n\t %s", tok2str(ahcp1_opt_str, "Unknown-%u", option_no)));
                if (option_no == AHCP1_OPT_PAD || option_no == AHCP1_OPT_MANDATORY)
@@ -275,7 +275,7 @@ ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
                if (cp + 1 > ep)
                        goto invalid;
                ND_TCHECK_1(cp);
-               option_len = *cp;
+               option_len = EXTRACT_U_1(cp);
                cp += 1;
                if (cp + option_len > ep)
                        goto invalid;
@@ -309,11 +309,11 @@ ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
                goto invalid;
        /* Type */
        ND_TCHECK_1(cp);
-       type = *cp;
+       type = EXTRACT_U_1(cp);
        cp += 1;
        /* MBZ */
        ND_TCHECK_1(cp);
-       mbz = *cp;
+       mbz = EXTRACT_U_1(cp);
        cp += 1;
        /* Length */
        ND_TCHECK_2(cp);
@@ -360,7 +360,7 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len)
        cp += 1;
        /* Version */
        ND_TCHECK_1(cp);
-       version = *cp;
+       version = EXTRACT_U_1(cp);
        cp += 1;
        switch (version) {
                case AHCP_VERSION_1: {
index 4d1b26892c6e167cb7940ec44d2e8179f485c2e2..df8406f34a8676fe1a81bd5d17db42b6f1de9e31 100644 (file)
@@ -483,7 +483,7 @@ aodv_print(netdissect_options *ndo,
         * and then fetch it.
         */
        ND_TCHECK_1(dat);
-       msg_type = *dat;
+       msg_type = EXTRACT_U_1(dat);
        ND_PRINT((ndo, " aodv"));
 
        switch (msg_type) {
index 75a67342d248af08063a84007de8e6cec914f307..e5fe731935fec477874d17cd86dabce795dfa5fb 100644 (file)
@@ -274,7 +274,7 @@ aoev1_mac_print(netdissect_options *ndo,
        cp += 1;
        /* Dir Count */
        ND_TCHECK_1(cp);
-       dircount = *cp;
+       dircount = EXTRACT_U_1(cp);
        cp += 1;
        ND_PRINT((ndo, ", Dir Count: %u", dircount));
        if (AOEV1_MAC_ARG_LEN + dircount * 8 > len)
@@ -318,7 +318,7 @@ aoev1_reserve_print(netdissect_options *ndo,
        cp += 1;
        /* NMacs (correlated with the length) */
        ND_TCHECK_1(cp);
-       nmacs = *cp;
+       nmacs = EXTRACT_U_1(cp);
        cp += 1;
        ND_PRINT((ndo, ", NMacs: %u", nmacs));
        if (AOEV1_RESERVE_ARG_LEN + nmacs * ETHER_ADDR_LEN != len)
@@ -370,7 +370,7 @@ aoev1_print(netdissect_options *ndo,
        cp += 1;
        /* Command */
        ND_TCHECK_1(cp);
-       command = *cp;
+       command = EXTRACT_U_1(cp);
        cp += 1;
        ND_PRINT((ndo, ", Command: %s", tok2str(cmdcode_str, "Unknown (0x%02x)", command)));
        /* Tag */
index 2a2485e96d7d7f69fe1227a89ab31c0b583c2d0b..674a3117a52ba286699da980f60cb6d28c46aa6e 100644 (file)
@@ -370,11 +370,11 @@ cfm_print(netdissect_options *ndo,
         /*
          * Resolve the MD fields.
          */
-        md_nameformat = *namesp;
+        md_nameformat = EXTRACT_U_1(namesp);
         namesp++;
         names_data_remaining--;  /* We know this is != 0 */
         if (md_nameformat != CFM_CCM_MD_FORMAT_NONE) {
-            md_namelength = *namesp;
+            md_namelength = EXTRACT_U_1(namesp);
             namesp++;
             names_data_remaining--; /* We know this is !=0 */
             ND_PRINT((ndo, "\n\t  MD Name Format %s (%u), MD Name length %u",
@@ -428,10 +428,10 @@ cfm_print(netdissect_options *ndo,
         /*
          * Resolve the MA fields.
          */
-        ma_nameformat = *namesp;
+        ma_nameformat = EXTRACT_U_1(namesp);
         namesp++;
         names_data_remaining--; /* We know this is != 0 */
-        ma_namelength = *namesp;
+        ma_namelength = EXTRACT_U_1(namesp);
         namesp++;
         names_data_remaining--; /* We know this is != 0 */
         ND_PRINT((ndo, "\n\t  MA Name-Format %s (%u), MA name length %u",
index 924157de8bbe3271fa6fb5920c2eb58b1262bcf9..30c48616aaa6429221b4eb2e646e0360c2c79e2e 100644 (file)
@@ -183,7 +183,7 @@ eap_print(netdissect_options *ndo,
     switch (eap->type) {
     case EAP_FRAME_TYPE_PACKET:
         ND_TCHECK_1(tptr);
-        type = *(tptr);
+        type = EXTRACT_U_1(tptr);
         ND_TCHECK_2(tptr + 2);
         len = EXTRACT_BE_U_2(tptr + 2);
         ND_PRINT((ndo, ", %s (%u), id %u, len %u",
index 64599835f96a8f38068c3285c793992678a6efc7..b5f7a4380cf78b98f75065b838407959d346a2cc 100644 (file)
@@ -107,7 +107,7 @@ ip_finddst(netdissect_options *ndo,
                int tt;
 
                ND_TCHECK_1(cp);
-               tt = *cp;
+               tt = EXTRACT_U_1(cp);
                if (tt == IPOPT_EOL)
                        break;
                else if (tt == IPOPT_NOP)
@@ -255,7 +255,7 @@ ip_optprint(netdissect_options *ndo,
                sep = ",";
 
                ND_TCHECK_1(cp);
-               option_code = *cp;
+               option_code = EXTRACT_U_1(cp);
 
                ND_PRINT((ndo, "%s",
                          tok2str(ip_option_values,"unknown %u",option_code)));
@@ -349,7 +349,7 @@ again:
                        ND_PRINT((ndo, "[|AH]"));
                        break;
                }
-               ipds->nh = *ipds->cp;
+               ipds->nh = EXTRACT_U_1(ipds->cp);
                ipds->advance = ah_print(ndo, ipds->cp);
                if (ipds->advance <= 0)
                        break;
index 5f6c647f043d88651122971414b4f6f6dbce6326..bdc79f9cadf0dfb90e65b112a388ed18caab665b 100644 (file)
@@ -78,7 +78,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst,
                         */
                        ND_TCHECK_2(cp);
                        advance = (EXTRACT_U_1(cp + 1) + 1) << 3;
-                       nh = *cp;
+                       nh = EXTRACT_U_1(cp);
                        break;
 
                case IPPROTO_FRAGMENT:
@@ -89,7 +89,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst,
                         */
                        ND_TCHECK_1(cp);
                        advance = sizeof(struct ip6_frag);
-                       nh = *cp;
+                       nh = EXTRACT_U_1(cp);
                        break;
 
                case IPPROTO_ROUTING:
index df59b46394ae3fc491dca500e695937ea23c19ec..7eb6b1050be10b3d8dbed2564025b11f704c48e5 100644 (file)
@@ -37,14 +37,14 @@ msdp_print(netdissect_options *ndo, const u_char *sp, u_int length)
 
        ND_TCHECK_3(sp);
        /* See if we think we're at the beginning of a compound packet */
-       type = *sp;
+       type = EXTRACT_U_1(sp);
        len = EXTRACT_BE_U_2(sp + 1);
        if (len > 1500 || len < 3 || type == 0 || type > MSDP_TYPE_MAX)
                goto trunc;     /* not really truncated, but still not decodable */
        ND_PRINT((ndo, " msdp:"));
        while (length > 0) {
                ND_TCHECK_3(sp);
-               type = *sp;
+               type = EXTRACT_U_1(sp);
                len = EXTRACT_BE_U_2(sp + 1);
                if (len > 1400 || ndo->ndo_vflag)
                        ND_PRINT((ndo, " [len %u]", len));
index 731f0e38ac77a1ab2c1cb3e37769ae2b17a68e6c..adab701f2d154f3276e14e69297929b3072a2c23 100644 (file)
@@ -1400,7 +1400,7 @@ of10_match_print(netdissect_options *ndo,
        cp += 1;
        /* nw_proto */
        ND_TCHECK_1(cp);
-       nw_proto = *cp;
+       nw_proto = EXTRACT_U_1(cp);
        cp += 1;
        if (! (wildcards & OFPFW_NW_PROTO)) {
                field_name = ! (wildcards & OFPFW_DL_TYPE) && dl_type == ETHERTYPE_ARP
index 16d1e18bfaf75c7866a2e9853321d036b783cf4e..687b16d60c42b29b4d3a7dc7c51eed0c7cc889c3 100644 (file)
@@ -86,11 +86,11 @@ of_header_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep
                goto invalid;
        /* version */
        ND_TCHECK_1(cp);
-       version = *cp;
+       version = EXTRACT_U_1(cp);
        cp += 1;
        /* type */
        ND_TCHECK_1(cp);
-       type = *cp;
+       type = EXTRACT_U_1(cp);
        cp += 1;
        /* length */
        ND_TCHECK_2(cp);
index 39d41700cc7693e80e7e13f23cceda73c8ba7c95..f1fedc75292298e70afea4fc5d4ddc62bc7e24b2 100644 (file)
@@ -157,7 +157,7 @@ pppoe_print(netdissect_options *ndo, register const u_char *bp, u_int length)
                                ND_TCHECK2(*p, tag_len);
                                for (v = p; v < p + tag_len && tag_str_len < MAXTAGPRINT-1; v++)
                                        if (*v >= 32 && *v < 127) {
-                                               tag_str[tag_str_len++] = *v;
+                                               tag_str[tag_str_len++] = EXTRACT_U_1(v);
                                                ascii_count++;
                                        } else {
                                                tag_str[tag_str_len++] = '.';
index cb170170da3d13366659362cd420c83c2249cb14..1862b0a9f3bd46f9eb26646cf84b69f90bcfe175 100644 (file)
@@ -667,7 +667,7 @@ print_vendor_attr(netdissect_options *ndo,
     while (length >= 2) {
        ND_TCHECK_2(data);
 
-        vendor_type = *(data);
+        vendor_type = EXTRACT_U_1(data);
         vendor_length = EXTRACT_U_1(data + 1);
 
         if (vendor_length < 2)
index 5f895493872467462f00945af053de28b80f21b0..5a9fb1fc91ec40a71ca77b45a92fefcb04fee1c9 100644 (file)
@@ -499,7 +499,7 @@ rsvp_intserv_print(netdissect_options *ndo,
 
     if (obj_tlen < 4)
         return 0;
-    parameter_id = *(tptr);
+    parameter_id = EXTRACT_U_1(tptr);
     ND_TCHECK_2(tptr + 2);
     parameter_length = EXTRACT_BE_U_2(tptr + 2)<<2; /* convert wordcount to bytecount */
 
index dba842996959dcaffc627841e249a967b707b289..f3dc330dd50e75ac5ac7316aea81d1c217a2ca8b 100644 (file)
@@ -251,7 +251,7 @@ slow_print(netdissect_options *ndo,
     if (len < 1)
         goto tooshort;
     ND_TCHECK_1(pptr);
-    subtype = *pptr;
+    subtype = EXTRACT_U_1(pptr);
 
     /*
      * Sanity checking of the header.
index e7b64aee56466434821e0eb5ea7a3fa51422fa43..ec43a4ddf30bf70cf2362222a9c5e8e3eaeadce7 100644 (file)
@@ -491,7 +491,7 @@ asn1_parse(netdissect_options *ndo,
                return -1;
        }
        ND_TCHECK_1(p);
-       elem->asnlen = *p;
+       elem->asnlen = EXTRACT_U_1(p);
        p++; len--; hdr++;
        if (elem->asnlen & ASN_BIT8) {
                uint32_t noct = elem->asnlen % ASN_BIT8;
index 04054112faf8d202363145de6950e9be62583a3a..735d864a5be8840ff1d46f87c22c2e9084ad9a2c 100644 (file)
@@ -244,7 +244,7 @@ vtp_print (netdissect_options *ndo,
        while (tptr < (pptr+length)) {
 
            ND_TCHECK_1(tptr);
-           len = *tptr;
+           len = EXTRACT_U_1(tptr);
            if (len == 0)
                break;
 
@@ -287,7 +287,7 @@ vtp_print (netdissect_options *ndo,
                 if (len < 2)
                     goto trunc;
                 ND_TCHECK_2(tptr);
-                type = *tptr;
+                type = EXTRACT_U_1(tptr);
                 tlv_len = EXTRACT_U_1(tptr + 1);
 
                 ND_PRINT((ndo, "\n\t\t%s (0x%04x) TLV",
index 71c517baf7e084fa50ded27d7acd22f96b438afc..2a195165e98f7661d7b31f499c4c635c7dc3079e 100644 (file)
@@ -69,10 +69,10 @@ vxlan_gpe_print(netdissect_options *ndo, const u_char *bp, u_int len)
 
     ND_TCHECK2(*bp, VXLAN_GPE_HDR_LEN);
 
-    flags = *bp;
+    flags = EXTRACT_U_1(bp);
     bp += 3;
 
-    next_protocol = *bp;
+    next_protocol = EXTRACT_U_1(bp);
     bp += 1;
 
     vni = EXTRACT_BE_U_3(bp);
index 1a7635fdd9cc664b7cde1c26161c096c2b0ca26e..b8914fe11424b74c9c40bbf4a74829d7ecf2dbc3 100644 (file)
@@ -55,7 +55,7 @@ vxlan_print(netdissect_options *ndo, const u_char *bp, u_int len)
 
     ND_TCHECK2(*bp, VXLAN_HDR_LEN);
 
-    flags = *bp;
+    flags = EXTRACT_U_1(bp);
     bp += 4;
 
     vni = EXTRACT_BE_U_3(bp);
index 47f798a4e88c194b1c37d8e859d80141fb2c0d1c..7d85efb1c58816082269448e5daab288f097e85f 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -178,7 +178,7 @@ name_ptr(netdissect_options *ndo,
        return(NULL);   /* name goes past the end of the buffer */
     ND_TCHECK_1(p);
 
-    c = *p;
+    c = EXTRACT_U_1(p);
 
     /* XXX - this should use the same code that the DNS dissector does */
     if ((c & 0xC0) == 0xC0) {
@@ -231,7 +231,7 @@ name_len(netdissect_options *ndo,
     if (s >= maxbuf)
        return(-1);     /* name goes past the end of the buffer */
     ND_TCHECK_1(s);
-    c = *s;
+    c = EXTRACT_U_1(s);
     if ((c & 0xC0) == 0xC0)
        return(2);
     while (*s) {