From owner-freebsd-hackers@FreeBSD.ORG Mon Sep 20 02:26:56 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D3C5116A4CE; Mon, 20 Sep 2004 02:26:56 +0000 (GMT) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id B033843D2F; Mon, 20 Sep 2004 02:26:56 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id i8K2SqAq027289; Sun, 19 Sep 2004 19:28:52 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id i8K2SqpY027288; Sun, 19 Sep 2004 19:28:52 -0700 Date: Sun, 19 Sep 2004 19:28:52 -0700 From: Brooks Davis To: Max Laier Message-ID: <20040920022852.GA21281@odin.ac.hmc.edu> References: <200409200250.49518.max@love2party.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3MwIy2ne0vdjdPXF" Content-Disposition: inline In-Reply-To: <200409200250.49518.max@love2party.net> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=3.0 required=8.0 tests=SUSPICIOUS_RECIPS autolearn=no version=2.63 X-Spam-Level: *** X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu cc: freebsd-hackers@freebsd.org cc: freebsd-net@freebsd.org cc: freebsd-standards@freebsd.org cc: freebsd-arch@freebsd.org Subject: Re: Global (non _KERNEL) place for sockaddr_union? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Sep 2004 02:26:57 -0000 --3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 20, 2004 at 02:50:40AM +0200, Max Laier wrote: > Hi, >=20 > http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dkern/71836 is the symptom. N= ow I am=20 > looking for a clean solution to it. What is needed is an include file tha= t=20 > defines union sockaddr_union in a way that is useable from kernel and=20 > userland. Historically it seems that this union first apeared in context = of=20 > ipsec within the kernel. pf has adopted it, but uses it in the userland a= s=20 > well. I am sure that it can be usefull in a lot of places that have to de= al=20 > with/store different address formats. >=20 > My question now is, what would be a good place to define this? Are there = any=20 > fromal standarts that might define it already? (Couldn't find anything) I= s=20 > there anything else that I must consider? >=20 > At some point I though netinet/in.h might be a good place, but that'd req= uire=20 > inclusion of sys/socket.h, which certainly is not a good solution. >=20 > Opinions? Ideas? >=20 > > #include > > #include > >=20 > > union sockaddr_union { > > struct sockaddr sa; > > struct sockaddr_in sin; > > struct sockaddr_in6 sin6; > > struct sockaddr_storage __su_pad; /* maybe not a bad idea */ > > }; I don't see an elegant solution. Stuffing it off in its own file may be the best thing if you're going to use it. Overall, I'd say it's bad idea that PF be better off without. It appears to save a few casts, but nothing worth the pain of generalizing the declaration. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --3MwIy2ne0vdjdPXF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFBTkBkXY6L6fI4GtQRAkN5AJ4vSbihrYfqgTxU4MrgF4vNXFYr6ACeJ0Uh aeCoFMPqPGpWIYLi5DDzc4c= =WKvT -----END PGP SIGNATURE----- --3MwIy2ne0vdjdPXF--