[libvirt] OSX 10.6 build failures
Daniel P. Berrange
berrange at redhat.com
Wed Sep 15 09:29:50 UTC 2010
On Tue, Sep 14, 2010 at 09:10:46PM -0500, Doug Goldstein wrote:
> On Tue, Sep 14, 2010 at 7:57 PM, Osier <jyang at redhat.com> wrote:
> >
> >>
> >> % man ipv6
> >>
> >> Address Format
> >> struct sockaddr_in6 {
> >> sa_family_t sin6_family; /* AF_INET6 */
> >> in_port_t sin6_port; /* port number */
> >> uint32_t sin6_flowinfo; /* IPv6 flow information
> >> */
> >> struct in6_addr sin6_addr; /* IPv6 address */
> >> uint32_t sin6_scope_id; /* Scope ID (new in 2.4)
> >> */
> >> };
> >>
> >> struct in6_addr {
> >> unsigned char s6_addr[16]; /* IPv6 address */
> >> };
> >>
>
> Yep. Just checked my OS X 10.6 box.. Here's the relevant snippet.
>
> /*
> * IPv6 address
> */
> struct in6_addr {
> union {
> __uint8_t __u6_addr8[16];
> __uint16_t __u6_addr16[8];
> __uint32_t __u6_addr32[4];
> } __u6_addr; /* 128-bit IP6 address */
> };
>
> #define s6_addr __u6_addr.__u6_addr8
The best thing about standards, is that there are so many to choose
from :-) I just found this in cups/http.h ....
/*
* Oh, the wonderful world of IPv6 compatibility. Apparently some
* implementations expose the (more logical) 32-bit address parts
* to everyone, while others only expose it to kernel code... To
* make supporting IPv6 even easier, each vendor chose different
* core structure and union names, so the same defines or code
* can't be used on all platforms.
*
* The following will likely need tweaking on new platforms that
* support IPv6 - the "s6_addr32" define maps to the 32-bit integer
* array in the in6_addr union, which is named differently on various
* platforms.
*/
#if defined(AF_INET6) && !defined(s6_addr32)
# if defined(__sun)
# define s6_addr32 _S6_un._S6_u32
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
# define s6_addr32 __u6_addr.__u6_addr32
# elif defined(__osf__)
# define s6_addr32 s6_un.sa6_laddr
# elif defined(WIN32)
/*
* Windows only defines byte and 16-bit word members of the union and
* requires special casing of all raw address code...
*/
# define s6_addr32 error_need_win32_specific_code
# endif /* __sun */
#endif /* AF_INET6 && !s6_addr32 */
I wonder if gnulib can help/save us here at all ?
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list