Some doubt regarding getaddrinfo()
sumanth
sumantk2@linux.vnet.ibm.com
Sun May 25 10:53:00 GMT 2014
On 05/21/2014 03:24 PM, sumanth wrote:
> Hi all, i had a doubt w.r.t to getaddrinfo()
>
> i had configured link-local address and site-local address as follows.
>
> ifconfig eth0 inet6 add fe80::1/64
> ifconfig eth0 inet6 add fec0::1/10
>
> Now my /etc/hosts contains the following :
> fe80::2 server.org
> fec0::2 server.org
>
> . For the destination address selection , in getaddrinfo.c , gaih_inet
> will return the set of available destination address( not sorted yet ) .
> Then if we have 2 addresses , for eg : site-local and link-local , then
> i see following code flow: <in getaddrinfo.c : __socket (af,
> SOCK_DGRAM, IPPROTO_IP) , then __connect() and then __getsockname
> inorder to get the source address suitable from the kernel ( gets filled
> to results[i].source_addr .>. Here when i see netstat | grep -i udp , i
> see that connection has been established . However the destination is
> unreachable.
>
> So my questions:
> 1) how can connect() succeed to fec0::2 for example which is not
> reachable from my side. < have not configured fec0::2 in any other
> machines. > . In getaddrinfo.c , it is mentioned that :
> /* We overwrite the type with SOCK_DGRAM since we do not
> want connect() to connect to the other side. If we
> cannot determine the source address remember this
> fact. */ < --- Didnt get properly what it means.
Now i understood this..
>
> #netstat | grep -i udp
> udp 0 0 fec0::1:34236 server.org:http
> ESTABLISHED
>
> 2) However connect() fails in case of link-local address and hence
> results->got_source_addr is still false .
>
>
> Any thoughts ? . This may be a simple question . But any help would be
> good.
>
rfc4472 tells the following :
Link-local addresses should never be published in DNS (whether in
forward or reverse tree), because they have only local (to the
connected link) significance
So does it mean that we shouldnt specify link-local address in
/etc/hosts as well ? or it should work as mentioned in rfc 6724. ? ( I m
getting site-local address first and then later link-local . i.e Rule 8
: prefer smaller scope fails ..) . Anyone over here knows whether it is
the expected behaviour / or any hints ?
> Thank you,
> Sumanth K
More information about the Libc-help
mailing list