diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2017-11-26 13:02:48 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2017-11-26 15:44:43 +0100 |
commit | 1a90fd99d279d63242419a30ba3e0720872bff75 (patch) | |
tree | b8b631a40f376875b5458bd1ec23d8775c0d266d /print-ip6opts.c | |
parent | 575188b5bf4fc1c26a2766319fcb7ca57d393868 (diff) | |
download | tcpdump-1a90fd99d279d63242419a30ba3e0720872bff75.tar.gz |
Use more the EXTRACT_U_1() macro (28/n)
In ND_PRINT() macro call(s) (step 7).
p[n] ...
Diffstat (limited to 'print-ip6opts.c')
-rw-r--r-- | print-ip6opts.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/print-ip6opts.c b/print-ip6opts.c index 21d8b510..4533bfab 100644 --- a/print-ip6opts.c +++ b/print-ip6opts.c @@ -72,10 +72,10 @@ ip6_sopt_print(netdissect_options *ndo, const u_char *bp, int len) break; default: if (len - i < IP6OPT_MINLEN) { - ND_PRINT((ndo, ", sopt_type %d: trunc)", bp[i])); + ND_PRINT((ndo, ", sopt_type %d: trunc)", EXTRACT_U_1(bp + i))); goto trunc; } - ND_PRINT((ndo, ", sopt_type 0x%02x: len=%d", bp[i], bp[i + 1])); + ND_PRINT((ndo, ", sopt_type 0x%02x: len=%d", EXTRACT_U_1(bp + i), EXTRACT_U_1(bp + i + 1))); break; } } @@ -122,7 +122,7 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) goto trunc; } if (bp[i + 1] != IP6OPT_RTALERT_LEN - 2) { - ND_PRINT((ndo, "(rtalert: invalid len %d)", bp[i + 1])); + ND_PRINT((ndo, "(rtalert: invalid len %d)", EXTRACT_U_1(bp + i + 1))); goto trunc; } ND_PRINT((ndo, "(rtalert: 0x%04x) ", EXTRACT_BE_U_2(bp + i + 2))); @@ -133,7 +133,7 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) goto trunc; } if (bp[i + 1] != IP6OPT_JUMBO_LEN - 2) { - ND_PRINT((ndo, "(jumbo: invalid len %d)", bp[i + 1])); + ND_PRINT((ndo, "(jumbo: invalid len %d)", EXTRACT_U_1(bp + i + 1))); goto trunc; } ND_PRINT((ndo, "(jumbo: %u) ", EXTRACT_BE_U_4(bp + i + 2))); @@ -144,7 +144,7 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) goto trunc; } if (bp[i + 1] < IP6OPT_HOMEADDR_MINLEN - 2) { - ND_PRINT((ndo, "(homeaddr: invalid len %d)", bp[i + 1])); + ND_PRINT((ndo, "(homeaddr: invalid len %d)", EXTRACT_U_1(bp + i + 1))); goto trunc; } ND_PRINT((ndo, "(homeaddr: %s", ip6addr_string(ndo, bp + i + 2))); @@ -156,10 +156,10 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) break; default: if (len - i < IP6OPT_MINLEN) { - ND_PRINT((ndo, "(type %d: trunc)", bp[i])); + ND_PRINT((ndo, "(type %d: trunc)", EXTRACT_U_1(bp + i))); goto trunc; } - ND_PRINT((ndo, "(opt_type 0x%02x: len=%d)", bp[i], bp[i + 1])); + ND_PRINT((ndo, "(opt_type 0x%02x: len=%d)", EXTRACT_U_1(bp + i), EXTRACT_U_1(bp + i + 1))); break; } } |