Global (non _KERNEL) place for sockaddr_union?

Max Laier max at love2party.net
Sun Sep 19 17:51:53 PDT 2004


Hi,

http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/71836 is the symptom. Now I am 
looking for a clean solution to it. What is needed is an include file that 
defines union sockaddr_union in a way that is useable from kernel and 
userland. Historically it seems that this union first apeared in context of 
ipsec within the kernel. pf has adopted it, but uses it in the userland as 
well. I am sure that it can be usefull in a lot of places that have to deal 
with/store different address formats.

My question now is, what would be a good place to define this? Are there any 
fromal standarts that might define it already? (Couldn't find anything) Is 
there anything else that I must consider?

At some point I though netinet/in.h might be a good place, but that'd require 
inclusion of sys/socket.h, which certainly is not a good solution.

Opinions? Ideas?

> #include <sys/socket.h>
> #include <netinet/in.h>
> 
> union sockaddr_union {
>  struct sockaddr   sa;
>  struct sockaddr_in  sin;
>  struct sockaddr_in6  sin6;
>  struct sockaddr_storage __su_pad;  /* maybe not a bad idea */
> };

FreeBSD:
 netipsec/keydb.h, line 43 (_KERNEL)
NetBSD:
 netipsec/keydb.h, line 46 (_KERNEL)
OpenBSD:
 netinet/ip_ipsp.h, line 50 (non _KERNEL)
KAME:
 net/pfvar.h, line 699 (non _KERNEL, ! __OpenBSD__)
Linux:
 Doesn't seem to have it. Or has it under a different name?

-- 
/"\  Best regards,                      | mlaier at freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier at EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20040920/7a61ede4/attachment.bin


More information about the freebsd-hackers mailing list