Re: want same behavior as ipv4(scope_id)

Rémi Denis-Courmont <[email protected]> Sun, 1 Oct 2006 21:54:21 +0300
Newsgroups gmane.ietf.ipv6,gmane.linux.ipv6.usagi.users
Organization SimPhalempin.Com
Message-ID <[email protected]>
N.B.: I think it would be more appropriate to discuss this on 
usagi-users than an IETF mailing list...

Le dimanche 1 octobre 2006 21:36, Amrit Soni a écrit :
> I've ported my application to IPv6. I open socket/bind to ethernet
> interface(scope id=2,eth0) but it doesn't work if i run two instances
> of my application on the same machine. I'm using redhat9 linux.

Why the heck do you bind to a specific interface at all? That should not 
be necessary for usual socket/bind/listen/accept and 
socket/bind/recvmsg/sendmsg code paths.

> If i assign scope_id to 0(loopback i/f)

0 is certainly not the lo(opback) scope ID. That would be in direct 
violation of the relevant POSIX and IETF standards, as 0 is the error 
return value of the if_nametoindex() API.

If you put 0 in a sockaddr_in6, you don't bind to any specific 
interface. This indeed leaves the scope ID undefined, and that's what 
pretty much every IPv6-aware applications do.

> then it works only on my machine. But in IPv4 there is no field as
> scope id, it works on local host as well as on network. I want the
> same behaviour as IPv4.

That's precisely what sin6_scope_id=0 does.

> Pls let me know what should i do to make my 
> application scope  independent. Is it a bug in linux kernal?

I don't think so.

-- 
Rémi Denis-Courmont
http://www.remlab.net/

--------------------------------------------------------------------
IETF IPv6 working group mailing list
[email protected]
Administrative Requests: https://www1.ietf.org/mailman/listinfo/ipv6
--------------------------------------------------------------------
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQBFIA7mw+xtvt1tEr0RAi35AKDzoDtBWtBvDGqraA3gHb0IebSCJwCdEOWz
oadGjj2B7Qnku4gZM1ah9Rg=
=/Vm6
-----END PGP SIGNATURE-----