[ds6-devel] problem connecting to ipv6 sockets

Andreas Hofmann a.hofmann at fhbb.ch
Tue Jan 6 09:20:50 CET 2004


thanks a lot, it is exactly what is wrong!

and by coincidence, after days of work with this problem, i wondered yesterday 
why i have to allways use the -I eth0 parameter with ping6. a look at 
getaddrinfo man page (Extension for scoped IPv6 address) gave me a hint. the 
%eth0 at the end of the address solves the problem.

the next time i will write sooner to this list! i could have saved a lot of 
time. thanks!


Am Dienstag, 6. Januar 2004 08.14 schrieb Lionel Elie Mamane:
> On Tue, Jan 06, 2004 at 02:33:00PM +0800, Parijat wrote:
> > 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.
>
> Indeed. Try this:
>
>  ip6client fe80::20b:cdff:fef8:1c32%eth0
>
> >> 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.
>
> It does, if the address contains the %eth0 part.



More information about the ds6-devel mailing list