]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use more the EXTRACT_U_1() macro (42/n)
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 1 Dec 2017 23:04:55 +0000 (00:04 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 1 Dec 2017 23:04:55 +0000 (00:04 +0100)
In: switch (... p[n] ...) ...

print-802_11.c
print-babel.c
print-ip6opts.c
print-juniper.c
print-mobility.c
print-pim.c

index 82480f32bcde09807ef9f5376c9d0d803f1a29a1..59d1f63d865f229a1f6a5df067295d1ce66b7ce2 100644 (file)
@@ -1589,7 +1589,7 @@ handle_action(netdissect_options *ndo,
        } else {
                ND_PRINT((ndo, " (%s): ", etheraddr_string(ndo, src)));
        }
-       switch (p[0]) {
+       switch (EXTRACT_U_1(p)) {
        case 0: ND_PRINT((ndo, "Spectrum Management Act#%d", EXTRACT_U_1(p + 1))); break;
        case 1: ND_PRINT((ndo, "QoS Act#%d", EXTRACT_U_1(p + 1))); break;
        case 2: ND_PRINT((ndo, "DLS Act#%d", EXTRACT_U_1(p + 1))); break;
index d1931c82b523b07c10d4a1a383fe48f0cf12ac66..a3f540f802f7f8ff3e131b334f69133a4cec97f1 100644 (file)
@@ -60,7 +60,7 @@ babel_print(netdissect_options *ndo,
         ND_PRINT((ndo, " %d", EXTRACT_U_1(cp + 1)));
     }
 
-    switch(cp[1]) {
+    switch(EXTRACT_U_1(cp + 1)) {
     case 2:
         babel_print_v2(ndo, cp, length);
         break;
index 4533bfabe77e76bb269fbe9fb88394bcedb3eeca..de6c9c990525578ee8722cede92ff7344dfcb76a 100644 (file)
@@ -59,7 +59,7 @@ ip6_sopt_print(netdissect_options *ndo, const u_char *bp, int len)
        if (i + optlen > len)
            goto trunc;
 
-       switch (bp[i]) {
+       switch (EXTRACT_U_1(bp + i)) {
        case IP6OPT_PAD1:
             ND_PRINT((ndo, ", pad1"));
            break;
@@ -105,7 +105,7 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len)
        if (i + optlen > len)
            goto trunc;
 
-       switch (bp[i]) {
+       switch (EXTRACT_U_1(bp + i)) {
        case IP6OPT_PAD1:
             ND_PRINT((ndo, "(pad1)"));
            break;
index cb22c6c67e98d8f4d0192b35f5e2fc78d68fa801..bd36fd2fe0f9103556b2d3239fecb4fe8552fbd8 100644 (file)
@@ -1089,7 +1089,7 @@ static int
 ip_heuristic_guess(netdissect_options *ndo,
                    register const u_char *p, u_int length)
 {
-    switch(p[0]) {
+    switch(EXTRACT_U_1(p)) {
     case 0x45:
     case 0x46:
     case 0x47:
@@ -1323,7 +1323,7 @@ juniper_parse_header(netdissect_options *ndo,
 
             l2info->cookie_len += lp->cookie_len;
 
-            switch (p[0]) {
+            switch (EXTRACT_U_1(p)) {
             case LS_COOKIE_ID:
                 l2info->cookie_type = LS_COOKIE_ID;
                 l2info->cookie_len += 2;
index 6d33ebd94fb3fb76929bbd3bb9272baee730c00f..a30663808ddb5e18e29621129872658fa976f07b 100644 (file)
@@ -133,7 +133,7 @@ mobility_opt_print(netdissect_options *ndo,
                        goto trunc;
                ND_TCHECK(bp[i + optlen]);
 
-               switch (bp[i]) {
+               switch (EXTRACT_U_1(bp + i)) {
                case IP6MOPT_PAD1:
                        ND_PRINT((ndo, "(pad1)"));
                        break;
index fac8ef0e6067f7dc0a35363ea19782889a4f03e8..a84c3fb30f076c547e62c30ebf65211f4b013e67 100644 (file)
@@ -567,7 +567,7 @@ pimv2_addr_print(netdissect_options *ndo,
                if (len < 2)
                        goto trunc;
                ND_TCHECK(bp[1]);
-               switch (bp[0]) {
+               switch (EXTRACT_U_1(bp)) {
                case 1:
                        af = AF_INET;
                        addr_len = (u_int)sizeof(struct in_addr);