From 1a90fd99d279d63242419a30ba3e0720872bff75 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Le Bail Date: Sun, 26 Nov 2017 13:02:48 +0100 Subject: Use more the EXTRACT_U_1() macro (28/n) In ND_PRINT() macro call(s) (step 7). p[n] ... --- print-ip6opts.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'print-ip6opts.c') 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; } } -- cgit v1.2.1