Some doubt regarding getaddrinfo()
sumanth
sumantk2@linux.vnet.ibm.com
Wed May 21 09:55:00 GMT 2014
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.
#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.
Thank you,
Sumanth K
More information about the Libc-help
mailing list