Add support for IPv6 address scopes
This patch adds full support for IPv6 address scopes, thereby aiming to be compliant with IPv6 standards in general and RFC 4007 in particular. The high-level summary is that link-local addresses are now meaningful only in the context of their own link, guaranteeing full isolation between links (and their addresses) in this respect. This isolation even allows multiple interfaces to have the same link-local addresses locally assigned. The implementation achieves this by extending the lwIP IPv6 address structure with a zone field that, for addresses that have a scope, carries the scope's zone in which that address has meaning. The zone maps to one or more interfaces. By default, lwIP uses a policy that provides a 1:1 mapping between links and interfaces, and considers all other addresses unscoped, corresponding to the default policy sketched in RFC 4007 Sec. 6. The implementation allows for replacing the default policy with a custom policy if desired, though. The lwIP core implementation has been changed to provide somewhat of a balance between correctness and efficiency on on side, and backward compatibility on the other. In particular, while the application would ideally always provide a zone for a scoped address, putting this in as a requirement would likely break many applications. Instead, the API accepts both "properly zoned" IPv6 addresses and addresses that, while scoped, "lack" a zone. lwIP will try to add a zone as soon as possible for efficiency reasons, in particular from TCP/UDP/RAW PCB bind and connect calls, but this may fail, and sendto calls may bypass that anyway. Ultimately, a zone is always added when an IP packet is sent when needed, because the link-layer lwIP code (and ND6 in particualar) requires that all addresses be properly zoned for correctness: for example, to provide isolation between links in the ND6 destination cache. All this applies to packet output only, because on packet input, all scoped addresses will be given a zone automatically. It is also worth remarking that on output, no attempt is made to stop outgoing packets with addresses for a zone not matching the outgoing interface. However, unless the application explicitly provides addresses that will result in such zone violations, the core API implementation (and the IPv6 routing algorithm in particular) itself will never take decisions that result in zone violations itself. This patch adds a new header file, ip6_zone.h, which contains comments that explain several implementation aspects in a bit more detail. For now, it is possible to disable scope support by changing the new LWIP_IPV6_SCOPES configuration option. For users of the core API, it is important to note that scoped addresses that are locally assigned to a netif must always have a zone set; the standard netif address assignment functions always do this on behalf of the caller, though. Also, core API users will want to enable LWIP_IPV6_SCOPES_DEBUG at least initially when upgrading, to ensure that all addresses are properly initialized.
This commit is contained in:
committed by
sg
parent
1839153609
commit
29ddfd1d71
13
UPGRADING
13
UPGRADING
@@ -8,6 +8,19 @@ with newer versions.
|
||||
|
||||
* [Enter new changes just after this line - do not remove this line]
|
||||
|
||||
++ Application changes:
|
||||
|
||||
* The IPv6 implementation now supports address scopes. All addresses that have a scope according
|
||||
to the default policy (link-local unicast addresses, interface-local and link-local multicast
|
||||
addresses) should now have a zone set on them before being passed to the core API, although
|
||||
lwIP will currently attempt to select a zone on the caller's behalf when necessary.
|
||||
Applications that directly assign IPv6 addresses to interfaces (which is NOT recommended)
|
||||
must now ensure that link-local addresses carry the netif's zone. See the new ip6_zone.h header
|
||||
file for more information and relevant macros. For now it is still possible to turn off scopes
|
||||
support through the new LWIP_IPV6_SCOPES option. When upgrading an implementation that uses the
|
||||
core API directly, it is highly recommended to enable LWIP_IPV6_SCOPES_DEBUG at least for
|
||||
a while, to ensure e.g. proper address initialization.
|
||||
|
||||
(2.0.1)
|
||||
|
||||
++ Application changes:
|
||||
|
||||
Reference in New Issue
Block a user