mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 13:34:38 +08:00

The introduction of address lifetimes also means that lwIP correctly supports transitions between PREFERRED and DEPRECATED address states, and that means that the source address selection must be changed to take this into account. Adding this feature to the previous algorithm would have resulted in a mess, so this patch rewrites the algorithm to stay close to the rules described in RFC 6724 (formerly 3484) Sec. 5. This yields the following changes: - Rule 2 ("prefer appropriate scope") is now fully implemented, most importantly allowing larger-scope addresses to be picked if no smaller-scope addresses are available (e.g., a global address may now be used to connect to a unique-local address); - Rule 3 ("avoid deprecated addresses") is now also fully implemented; - unknown-scope addresses are also supported, with lowest priority; - the link between the prescribed rules and the actual algorithm is made much more explicit, hopefully allowing future improvements to be made more easily. For reasons explained in comments, one previous deviation from the RFC on Rule 2 is retained for now.