]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Squelch some alignment warnings.
authorGuy Harris <[email protected]>
Sat, 22 Jul 2017 20:24:15 +0000 (13:24 -0700)
committerGuy Harris <[email protected]>
Sat, 22 Jul 2017 20:24:15 +0000 (13:24 -0700)
Make dst_addr a "const void *" to squelch

    taking address of packed member 'ip6_dst' of class or structure
    'ip6_hdr' may result in an unaligned pointer value
    [-Waddress-of-packed-member]

warnings from some versions of Clang.

print-ip6.c

index 9f590f2af4e1a8763a31b64e2330f7d57868d801..0075fcea2e51a389638bf48fbf33f73b72141fec 100644 (file)
@@ -50,7 +50,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst,
        const u_char *cp;
        int advance;
        u_int nh;
-       const struct in6_addr *dst_addr;
+       const void *dst_addr;
        const struct ip6_rthdr *dp;
        const struct ip6_rthdr0 *dp0;
        const struct in6_addr *addr;
@@ -59,7 +59,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst,
        cp = (const u_char *)ip6;
        advance = sizeof(struct ip6_hdr);
        nh = ip6->ip6_nxt;
-       dst_addr = &ip6->ip6_dst;
+       dst_addr = (const void *)&ip6->ip6_dst;
 
        while (cp < ndo->ndo_snapend) {
                cp += advance;
@@ -112,7 +112,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst,
                                        if ((const u_char *)(addr + 1) > ndo->ndo_snapend)
                                                goto trunc;
 
-                                       dst_addr = addr;
+                                       dst_addr = (const void *)addr;
                                        addr++;
                                }
                                break;