From patchwork Wed May 20 08:42:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 6809 Received: (qmail 125954 invoked by alias); 20 May 2015 08:42:31 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 125942 invoked by uid 89); 20 May 2015 08:42:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Message-ID: <555C48F0.2030208@redhat.com> Date: Wed, 20 May 2015 10:42:24 +0200 From: Florian Weimer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Andreas Schwab CC: Roland McGrath , sellcey@imgtec.com, Paul Eggert , libc-alpha@sourceware.org Subject: Re: [PATCH] Fix strict-aliasing warning in resolv/res_hconf.c References: <5bfa6373-3817-4d31-a5ee-a8676e79b723@BAMAIL02.ba.imgtec.org> <555BB55E.3050304@cs.ucla.edu> <1432075989.16668.62.camel@ubuntu-sellcey> <555BC19B.90001@cs.ucla.edu> <1432077972.16668.65.camel@ubuntu-sellcey> <20150519235817.9516F2C3A73@topped-with-meat.com> <555C3E0B.2040404@redhat.com> In-Reply-To: On 05/20/2015 10:23 AM, Andreas Schwab wrote: > Florian Weimer writes: > >> Looking at struct ifreq, it is rather mysterious to me how this is >> supposed to work at all. I mean, struct sockaddr has just 14 bytes >> storage for address information, but IPv6 addresses need 16 bytes, and >> socket addresses contain even more information than a raw address. > > This ioctl is only defined for IPv4. Oh, but then we can add a union member of the appropriate type (just one is needed): This doesn't change ABI. And then the code in resolv/res_hconf.c could use that new member, without any casts. diff --git a/sysdeps/gnu/net/if.h b/sysdeps/gnu/net/if.h index 49a048c..39f40de 100644 --- a/sysdeps/gnu/net/if.h +++ b/sysdeps/gnu/net/if.h @@ -24,6 +24,7 @@ #ifdef __USE_MISC # include # include +# include #endif @@ -139,6 +140,7 @@ struct ifreq struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; + struct sockaddr_in ifru_addr_in; short int ifru_flags; int ifru_ivalue; int ifru_mtu;