Date: Tue, 21 Sep 2004 03:02:20 -0700 From: Bruce M Simpson <bms@spc.org> To: Max Laier <max@love2party.net> Cc: freebsd-arch@freebsd.org Subject: Re: Global (non _KERNEL) place for sockaddr_union? Message-ID: <20040921100220.GC842@empiric.icir.org> In-Reply-To: <200409200250.49518.max@love2party.net> References: <200409200250.49518.max@love2party.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--FCuugMFkClbJLl1L 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: > 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? I think Brooks' recommendation is sound and should probably be followed as it's fairly close to my original recommendation to you in private. The problem is that the definition of the union depends on what you wish to use it for, and which address families are visible to the application or kernel module which is using the definition. You may find that such a definition has to have conditionalized members. This is usually not a problem so long as they are all the same size. And a sockaddr union embedded in a struct probably should have a member with type 'struct sockaddr_storage' if it's to support all address families in future, although this commits more storage in the enclosing struct and may waste space in some cases. As you point out, you cannot do this in pf, as it defeats the intent of keeping larger members out of the table in the first place, and the union is there to make some casts go away. If it's any consolation, I'm going through very similar pain with XORP's new firewall manager right now with respect to address families (and templatized C++ classes). Regards, BMS --FCuugMFkClbJLl1L Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Comment: '' iD8DBQFBT/wsueUpAYYNtTsRAnCbAKCZrI2SsVz6q/Uu0loceoJREQc/zACggs6O e98ZL0h6Z/r8TWtUkJ8P+30= =buDH -----END PGP SIGNATURE----- --FCuugMFkClbJLl1L--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040921100220.GC842>