diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2017-12-02 00:04:55 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2017-12-02 00:04:55 +0100 |
commit | dbcba20b5eaeb49a2027130283e617ea3c755a67 (patch) | |
tree | e6ee1bde59bb1b32932f2fbd4a65a0c32c5ffbb1 | |
parent | d2def296e94a50e74c3ada4002cdfba116688c11 (diff) | |
download | tcpdump-dbcba20b5eaeb49a2027130283e617ea3c755a67.tar.gz |
Use more the EXTRACT_U_1() macro (42/n)
In: switch (... p[n] ...) ...
-rw-r--r-- | print-802_11.c | 2 | ||||
-rw-r--r-- | print-babel.c | 2 | ||||
-rw-r--r-- | print-ip6opts.c | 4 | ||||
-rw-r--r-- | print-juniper.c | 4 | ||||
-rw-r--r-- | print-mobility.c | 2 | ||||
-rw-r--r-- | print-pim.c | 2 |
6 files changed, 8 insertions, 8 deletions
diff --git a/print-802_11.c b/print-802_11.c index 82480f32..59d1f63d 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -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; diff --git a/print-babel.c b/print-babel.c index d1931c82..a3f540f8 100644 --- a/print-babel.c +++ b/print-babel.c @@ -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; diff --git a/print-ip6opts.c b/print-ip6opts.c index 4533bfab..de6c9c99 100644 --- a/print-ip6opts.c +++ b/print-ip6opts.c @@ -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; diff --git a/print-juniper.c b/print-juniper.c index cb22c6c6..bd36fd2f 100644 --- a/print-juniper.c +++ b/print-juniper.c @@ -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; diff --git a/print-mobility.c b/print-mobility.c index 6d33ebd9..a3066380 100644 --- a/print-mobility.c +++ b/print-mobility.c @@ -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; diff --git a/print-pim.c b/print-pim.c index fac8ef0e..a84c3fb3 100644 --- a/print-pim.c +++ b/print-pim.c @@ -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); |