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: 474233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3BFDB140281 for ; Wed, 20 May 2015 18:42:38 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sourceware.org header.i=@sourceware.org header.b=QfRT3DCw; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=BUj2vU+WXg5sOE/h io0PDVbEeU8BzH1g1WVVyX6tPgfmfp3dgMIi4B7dUeHZdGfuahwxGw61ooTHx8+v 44qNl0v+ORhuxbSSR9iWHpCM3JRoSa+JPB05NxifKubga351qXMZaQ7sdaL5kqtU pDV9HYuLxMDNtoSWjKDU3qEJSMs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; s=default; bh=YzkY+VbvPYtb1z0hkaVSz6 yGMqE=; b=QfRT3DCweQXPoutxylvSfHBCrvVBT28N+O7C+e8TZrJSOl4bzLrxNk lQdK9enkf7Ib1s0xN8Ky0lknEOfwEDNtOqz6tXJsX1lCJTMhK9Zo8/NArKnAOcXL Bn07JFQJs6nKcBdTvyNfWVsGY+Vc1BsYq3RrMFHOJUBUBsQ58pQYs= 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;