From e048961ec1e1b1d9b44ab6315fd87e826edc04c6 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Le Bail Date: Wed, 14 Feb 2018 11:51:09 +0100 Subject: [PATCH] ICMPv6: Squelch a GCC warning The warning was: ./print-icmp6.c: In function 'icmp6_print': ./print-icmp6.c:1284:10: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual] in6 = (const nd_ipv6 *)(dp + 1); ^ --- print-icmp6.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/print-icmp6.c b/print-icmp6.c index ac52af23..9bbd5c81 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -1275,16 +1275,17 @@ icmp6_print(netdissect_options *ndo, break; case ICMP6_HADISCOV_REPLY: if (ndo->ndo_vflag) { - const nd_ipv6 *in6; const u_char *cp; + const u_char *p; ND_TCHECK_2(dp->icmp6_data16[0]); ND_PRINT(", id 0x%04x", EXTRACT_BE_U_2(dp->icmp6_data16[0])); cp = (const u_char *)dp + length; - in6 = (const nd_ipv6 *)(dp + 1); - for (; (const u_char *)in6 < cp; in6++) { - ND_TCHECK_SIZE(in6); - ND_PRINT(", %s", ip6addr_string(ndo, (const u_char *)in6)); + p = (const u_char *)(dp + 1); + while (p < cp) { + ND_TCHECK_16(p); + ND_PRINT(", %s", ip6addr_string(ndo, p)); + p += 16; } } break;