]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Try to squelch a GCC warning.
authorGuy Harris <[email protected]>
Wed, 14 Feb 2018 04:49:07 +0000 (20:49 -0800)
committerGuy Harris <[email protected]>
Wed, 14 Feb 2018 04:49:07 +0000 (20:49 -0800)
Maybe I've gotten lost in a twisty little maze of typedefs and array
pointers, all different, but I don't see how casting a const struct
icmp6_hdr * to a const nd_ipv6 * discards constness, and clang on my Mac
agrees with me.

First cast to const u_char * and then to const nd_ipv6 *, in the hopes
that GCC won't complain.

print-icmp6.c

index ac52af233313d58dc363daf2d3fc4b6a93c75bc9..c13e9379c368b6948668af2ddcc67ea364e55034 100644 (file)
@@ -1281,7 +1281,7 @@ icmp6_print(netdissect_options *ndo,
                        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);
+                       in6 = (const nd_ipv6 *)(const u_char *)(dp + 1);
                        for (; (const u_char *)in6 < cp; in6++) {
                                ND_TCHECK_SIZE(in6);
                                ND_PRINT(", %s", ip6addr_string(ndo, (const u_char *)in6));