Subject: want same behavior as ipv4(scope_id)

From: "Amrit Soni" <[email-masked]>
Date: 1 Oct 2006 18:36:41 -0000

Hi,

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. 

If i assign scope_id to 0(loopback i/f) 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. Pls let me know what should i do to make my application scope independent. Is it a bug in linux kernal? 

Thanks In Advance,
-Amit
--------------------------------------------------------------------
IETF IPv6 working group mailing list
[email-masked]
Administrative Requests: https://www1.ietf.org/mailman/listinfo/ipv6
--------------------------------------------------------------------

---

From: Rémi Denis-Courmont <[email-masked]>
Date: Sun, 1 Oct 2006 21:54:21 +0300

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/