From owner-freebsd-bugs@FreeBSD.ORG Tue Nov 27 22:39:39 2012 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 08C20B78 for ; Tue, 27 Nov 2012 22:39:39 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail13.syd.optusnet.com.au (mail13.syd.optusnet.com.au [211.29.132.194]) by mx1.freebsd.org (Postfix) with ESMTP id 7BFF08FC15 for ; Tue, 27 Nov 2012 22:39:38 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail13.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qARMdNNq012013 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Nov 2012 09:39:28 +1100 Date: Wed, 28 Nov 2012 09:39:23 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Martin Sustrik Subject: Re: Possible non-conformance to POSIX In-Reply-To: <50B53938.2010601@250bpm.com> Message-ID: <20121128092318.U1509@besplex.bde.org> References: <50B53938.2010601@250bpm.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-Cloudmark-Score: 0 X-Optus-Cloudmark-Analysis: v=2.0 cv=XbrRV/F5 c=1 sm=1 a=dD6fYmnc2FAA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=SOV9EjKwEXAA:10 a=7_Wlj_UhDKa6k_sCuEgA:9 a=CjuIK1q_8ugA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: freebsd-bugs@FreeBSD.org X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Nov 2012 22:39:39 -0000 On Tue, 27 Nov 2012, Martin Sustrik wrote: > I've just noted the following: > > #include > INADDR_ANY; > > The above results in 'u_int32_t undefined' error, which it shouldn't > according to POSIX. is careful to only declare uint32_t, but then it is broken and uses u_int32_t for INADDR_ANY and INADDR_BROADCAST. u_int32_t is also misused extensively in the definitions of INADDR_* and IN_* under __BSD_VISIBLE. INADDR_ANY is broken even if __BSD_VISIBLE is nonzero (the default), because the u_int32_t pollution is not automatically supplied with __BSD_VISIBLE. It takes including (with __BSD_VISIBLE) to get it. Nearby bugs: missing parentheses in the definitions of INADDR_ANY and INADDR_BROADCAST. Similarly for definitions under __BSD_VISIBLE. Casts bind tightly (they are at the second level of precedence -- see `man operator'), so it takes very weird usage for these bugs to matter. Nearby style bugs: some of the not-so-extensive use of uint32_t is probably a misspelling of in_addr_t. Bruce