Subject: Re: IPv6: presentation format for zero scope ID

From: Brian Haley <[email-masked]>
Date: Thu, 10 Dec 2009 14:32:31 -0500

Chuck Lever wrote:
> One other thing.  This is a rather more broad question, but still
> IPv6-related.
> 
> I'm considering mapping the scope ID to a device name in rpc_ntop6(),
> but it looks like network device names are part of a net namespace, and
> these presentation address strings are shared.  This address string
> might appear in /proc/mounts, for example, but can also be used to send
> messages to user space service daemons like statd or gssd.  We try to do
> the conversion once when certain objects are created (like an RPC client
> data structure) and then save the string.

Devices can be renamed, I'm not sure how common it is after boot though.
If you're not printing it that often the overhead of dev_get_by_index()
probably isn't that high, especially since it now uses RCU.

> Is it OK to leave just the scope ID (for link-local only, of course), or
> might the scope IDs also vary depending on the namespace?  I wouldn't
> think that they would.

Are you asking if a given numeric scope ID could map to a different interface
depending on the namespace?  I don't think so, the ifindex is unique for every
device, but a given network namespace might not contain the device that
matches a certain ifindex.

-Brian