[ds6-devel] problem connecting to ipv6 sockets
Parijat
parijat at i2r.a-star.edu.sg
Tue Jan 6 14:33:00 CET 2004
Hello, comments below:
On Mon, Jan 05, 2004 at 03:04:12PM +0100, Andreas Hofmann wrote:
> ip6client local6 ---> does not work
> ip6client fe80::20b:cdff:fef8:1c32 ---> does not work
The problem with the above two is that the clien is trying to make a
connection to a "link-local" address. One requirement of sockets using
or connecting to link-local addresses is that the interface on which the
connection should be made must also be specified. I think this is the
'sin6_scopeid' field in struct sockaddr_in6. On Linux this should be
the interface index. If you really want to find the interface index
programmatically, look at netdeivce(7) (on Debian at least), for the
documentation to appropriate ioctls(). If you are just trying to test,
then set the scopeid to 0 or 1 (...) and by any luck things should just
work.
> the ipv6 config of my machines should work, because i can ping6 them from
> everywhere.
I would be surprised if you were able to ping the link-local address
from another machine without telling ping6 which interface to ping from
(i.e., something like 'ping6 -i eth0 <address>'.
>
> the sources of these two small apps are below. where is the mistake i made?
> any ideas?
> if(connect(sockfd, res->ai_addr, res->ai_addrlen)==0){
Here, connect expects that res->ai_addr.sin6_scopeif would contain a
valid interface id, and IMO getaddrinfo() does not set this.
--
Sincerely,
Parijat Mishra
parijat at i2r.a-star.edu.sg
Tel: +65 6874 6243
More information about the ds6-devel
mailing list