[Xcb] Re: [Xcb-commit] Fix IP6 work for FreeBSD/Mac.
Ian Osgood
iano at quirkster.com
Tue Nov 21 20:15:12 PST 2006
When compiling, I got this error:
xcb_auth.c:97: error: 'struct sockaddr_in6' has no member named
'__u6_addr'
three times for each use of an IN6_IS_* macro.
In <netinet6/in6.h> (Copyright 1998 FreeBSD) are defined:
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
struct sockaddr_in6 {
__uint8_t sin6_len; /* length of this struct
(sa_family_t)*/
sa_family_t sin6_family; /* AF_INET6 (sa_family_t) */
in_port_t sin6_port; /* Transport layer port #
(in_port_t)*/
__uint32_t sin6_flowinfo; /* IP6 flow information */
struct in6_addr sin6_addr; /* IP6 address */
__uint32_t sin6_scope_id; /* scope zone index */
};
#define IN6_IS_ADDR_V4COMPAT(a) \
((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) ==
0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) ==
0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) ==
0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) !=
0) && \
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) !=
ntohl(1)))
Hope this "casts" light on the problem!
Ian
On Nov 21, 2006, at 3:53 PM, Jamey Sharp wrote:
> Hi Ian!
>
> Could you explain what's wacky about the MacOS X implementation of
> IN6_IS_ADDR_V4MAPPED and IN6_IS_ADDR_LOOPBACK that required this
> patch?
>
> Thanks,
> --Jamey
>
> p.s. http://solair.livejournal.com/9404.html
>
> On Tue, Nov 21, 2006 at 09:04:48AM -0800, Ian Osgood wrote:
>> +#define SIN6_ADDR(s) (&((struct sockaddr_in6 *)s)->sin6_addr)
>> +
>> static Xauth *get_authptr(struct sockaddr *sockname, unsigned int
>> socknamelen,
>> int display)
>> {
>> @@ -92,11 +94,11 @@ static Xauth *get_authptr(struct sockadd
>> switch(sockname->sa_family)
>> {
>> case AF_INET6:
>> - addr = (char *) &((struct sockaddr_in6 *)sockname)-
>> >sin6_addr;
>> - addrlen = sizeof(((struct sockaddr_in6 *)sockname)-
>> >sin6_addr);
>> - if(!IN6_IS_ADDR_V4MAPPED(addr))
>> + addr = (char *) SIN6_ADDR(sockname);
>> + addrlen = sizeof(*SIN6_ADDR(sockname));
>> + if(!IN6_IS_ADDR_V4MAPPED(SIN6_ADDR(sockname)))
>> {
>> - if(!IN6_IS_ADDR_LOOPBACK(addr))
>> + if(!IN6_IS_ADDR_LOOPBACK(SIN6_ADDR(sockname)))
>> family = XCB_FAMILY_INTERNET_6;
>> break;
>> }
>> @@ -180,7 +182,7 @@ static int compute_auth(xcb_auth_info_t
>> case AF_INET6:
>> /*block*/ {
>> struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)
>> sockname;
>> - if(IN6_IS_ADDR_V4MAPPED(si6->sin6_addr.s6_addr))
>> + if(IN6_IS_ADDR_V4MAPPED(SIN6_ADDR(sockname)))
>> {
>> APPEND(info->data, j, si6->sin6_addr.s6_addr[12]);
>> APPEND(info->data, j, si6->sin6_port);
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
More information about the Xcb
mailing list