[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [task #13106] Add IPv6 scopes

From: David van Moolenbroek
Subject: [lwip-devel] [task #13106] Add IPv6 scopes
Date: Wed, 18 Jan 2017 18:50:00 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0

Follow-up Comment #3, task #13106 (project lwip):

Good points; to be honest I was focused on the core part of lwIP so far, as
that's the part I am interested in myself :) but indeed, the higher-level
(socket API etc) side should be involved in the considerations as well.

For the standard BSD socket API, the scope ID needs to be expressed as a
32-bit integer (sin6_scope_id), with 0 denoting "no scope". I'd contend that
adopting such a number system throughout lwIP is the simplest approach, to
prevent needless back-and-forth conversion. Note that with the embedding
option (#2), the actual limit is like 22 bits. But 8 used bits should be
plenty in practice anyway - who could possibly want more than 255 netifs?

My additional implementation ideas so far were as follows - all preliminary

Each netif would have its interface index set by the user/application/etc at
initialization time. This would be a requirement for anyone that enables
support for scope IDs in their configuration. It's up the user to ensure that
each netif gets a unique ID this way, although people that use multiple netifs
per actual interface could set the same index on each of those. In any case,
this approach saves the netif code from having to pick unique IDs, especially
since the user may have an easier job at that (eg I for one keep all netifs in
an array).

Locally assigned link-local IPv6 addresses would also have a stored scope ID,
just like other addresses. Not only would this make the implementation simpler
overall I think, but when done properly, this means that the same link-local
address could be assigned to multiple interfaces without creating ambiguity.
So the scope ID really becomes part of the identity of the address that way.

A core-level netif function would look up a netif based on an address scope
ID, as necessary for routing. I am actually guessing/hoping that this is
needed by ip6_route() only, so that the ipv6 routing hook can be used to speed
this up when possible (e.g. I can just use it to index my netif array).

An API-level if_nametoindex(3) function could do the get-id-by-name part in a
standardized way, or possibly call a hook to do such interface name
resolution. This is actually related to a bunch of other things
(interface/local-address enumeration etc) of which I don't know how they're
done in lwIP socket API based applications (if at all?).. but my guess is that
adding support for scope IDs does not make things much more complicated than
they already were in that area.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]