[ipv6] Match user expectations for IPv6 settings priorities

A reasonable user expectation is that ${net0/ip6} should show the
"highest-priority" of the IPv6 addresses, even when multiple IPv6
addresses are active.  The expected order of priority is likely to be
manually-assigned addresses first, then stateful DHCPv6 addresses,
then SLAAC addresses, and lastly link-local addresses.

Using ${priority} to enforce an ordering is undesirable since that
would affect the priority assigned to each of the net<N> blocks as a
whole, so use the sibling ordering capability instead.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2016-07-19 16:57:32 +01:00
parent f5cf4f706e
commit 4ad3c73b30
4 changed files with 31 additions and 2 deletions

View File

@@ -238,6 +238,18 @@ static inline void ipv6_all_routers ( struct in6_addr *addr ) {
addr->s6_addr[15] = 2;
}
/** IPv6 settings sibling order */
enum ipv6_settings_order {
/** No address */
IPV6_ORDER_PREFIX_ONLY = -4,
/** Link-local address */
IPV6_ORDER_LINK_LOCAL = -3,
/** Address assigned via SLAAC */
IPV6_ORDER_SLAAC = -2,
/** Address assigned via DHCPv6 */
IPV6_ORDER_DHCPV6 = -1,
};
/** IPv6 link-local address settings block name */
#define IPV6_SETTINGS_NAME "link"