From owner-svn-src-head@FreeBSD.ORG Tue Aug 10 17:47:25 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E70711065673; Tue, 10 Aug 2010 17:47:25 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id A3C888FC1B; Tue, 10 Aug 2010 17:47:25 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id AC1711FFC36; Tue, 10 Aug 2010 17:47:24 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 74D7184525; Tue, 10 Aug 2010 19:47:24 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "M. Warner Losh" References: <20100810.093656.167578749323544001.imp@bsdimp.com> <201008101623.o7AGNs7I042679@haluter.fromme.com> <20100810.110642.335141733495090585.imp@bsdimp.com> Date: Tue, 10 Aug 2010 19:47:24 +0200 In-Reply-To: <20100810.110642.335141733495090585.imp@bsdimp.com> (M. Warner Losh's message of "Tue, 10 Aug 2010 11:06:42 -0600 (MDT)") Message-ID: <86sk2m1hsj.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@fromme.com, olli@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Aug 2010 17:47:26 -0000 "M. Warner Losh" writes: > /* > * Macros to cast a struct sockaddr, or parts thereof. > * On architectures with strict alignment requirements, the compiler > * can bogusly warn about alignment problems since its static analysis > * is insufficient for it to know that with the APIs used, there > * really is no alignment issue. > */ That's a bit harsh on the compiler, don't you think? It never pays to hurt the compiler's feelings :) > : @@ -2410,8 +2419,8 @@ > : } > : reject =3D 0; > : for (j =3D 0; j < 16; j +=3D 4) { > : - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m= 6p->sin6_addr.s6_addr[j]) > : - !=3D *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) { > : + if ((UINT32_CAST(sin6->sin6_addr.s6_addr[j]) & UINT32_CAST(m6p->s= in6_addr.s6_addr[j])) > : + !=3D UINT32_CAST(a6p->sin6_addr.s6_addr[j])) { > : ++reject; > : break; > : } > :=20 > :=20 > > Why 16 and 4 here? What's so magical about them? 4 =3D bytes in a uint32_t, 16 =3D bytes in an ipv6 address. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no