[Xquartz-dev] Re: xauth bus error

Greg Parker gparker at apple.com
Thu Jan 10 21:37:49 PST 2008


On Jan 10, 2008, at 8:55 PM, Jeremy Huddleston wrote:
> So actually, I traced it back to duplicate entries appearing as a  
> result of get_address_info()... and that seems to be coming from  
> OSX's getaddrinfo() returning the duplicate entry:
>
> Is this a bug in getaddrinfo()?  Should it not be returning  
> duplicates?  I don't see in the documentation anywhere that it  
> guarantees uniqueness... so I'm going to try whipping together a  
> patch to get_address_info() which prevents the duplicates from being  
> passed on to the caller of get_address_info()... hopefully that will  
> solve our problem.
>
> (gdb) n
> 296	        if (getaddrinfo(host,NULL,&hints,&firstai) !=0) return  
> NULL;
> (gdb) n
> 297		for (ai = firstai; ai != NULL; ai = ai->ai_next) {
> (gdb) print *firstai
> $1 = {
>  ai_flags = 0,
>  ai_family = 30,
>  ai_socktype = 1,
>  ai_protocol = 6,
>  ai_addrlen = 28,
>  ai_canonname = 0x0,
>  ai_addr = 0x3003e0,
>  ai_next = 0x300400
> }
> (gdb) print *firstai->ai_next
> $2 = {
>  ai_flags = 0,
>  ai_family = 30,
>  ai_socktype = 1,
>  ai_protocol = 6,
>  ai_addrlen = 28,
>  ai_canonname = 0x0,
>  ai_addr = 0x300420,
>  ai_next = 0x300440
> }

These are both AF_INET6, IPPROTO_TCP, SOCK_STREAM.


> (gdb) print *firstai->ai_addr
> $4 = {
>  sa_len = 28 '\034',
>  sa_family = 30 '\036',
>  sa_data = '\0' <repeats 13 times>
> }
> (gdb) print *firstai->ai_next->ai_addr
> $5 = {
>  sa_len = 28 '\034',
>  sa_family = 30 '\036',
>  sa_data = '\0' <repeats 13 times>
> }

What are the full contents of both of these? They're struct  
sockaddr_in6, 28 bytes long. They may not be duplicates because this  
only shows the first 16 bytes.

My guess is that you're seeing IPv6 loopback on two different  
interfaces (i.e. ::1%en0 for ethernet and ::1%en1 for wifi), or  
perhaps an unscoped ::1 and a interface-specific ::1. In these cases,  
sin6_addr will be all zeros with 0x01 at the end, and sin6_scope_id  
(the last 4 of the 28 bytes) will differ.


-- 
Greg Parker     gparker at apple.com     Runtime Wrangler




More information about the Xquartz-dev mailing list