From: Yu Watanabe Date: Wed, 1 Dec 2021 05:37:26 +0000 (+0900) Subject: network: radv: use the uplink interface used in DHCPv6-PD X-Git-Tag: v250-rc1~95^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f6032ff3e0970c93c97387e10c56a4be2a978948;p=thirdparty%2Fsystemd.git network: radv: use the uplink interface used in DHCPv6-PD --- diff --git a/man/systemd.network.xml b/man/systemd.network.xml index e90877ada80..fb2569a9dd8 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -2711,9 +2711,11 @@ Token=prefixstable:2002:da8:1:: Specifies the name or the index of the uplink interface, or one of the special values :none and :auto. When emitting DNS servers or search domains is enabled but no servers are specified, the servers configured in the uplink - interface will be emitted. When :auto, the link which has a default gateway - with the highest priority will be automatically selected. When :none, no - uplink interface will be selected. Defaults to :auto. + interface will be emitted. When :auto, the value specified to the same + setting in the [DHCPv6PrefixDelegation] section will be used if + DHCPv6PrefixDelegation= is enabled, otherwise the link which has a default + gateway with the highest priority will be automatically selected. When :none, + no uplink interface will be selected. Defaults to :auto. diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 8d48aa9f88b..da5a22a7b56 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -1452,7 +1452,7 @@ static bool dhcp6_pd_uplink_is_ready(Link *link) { return dhcp6_lease_has_pd_prefix(link->dhcp6_lease); } -static int dhcp6_pd_find_uplink(Link *link, Link **ret) { +int dhcp6_pd_find_uplink(Link *link, Link **ret) { Link *l; assert(link); diff --git a/src/network/networkd-dhcp6.h b/src/network/networkd-dhcp6.h index 4a522aebcfd..9c5aff6af7c 100644 --- a/src/network/networkd-dhcp6.h +++ b/src/network/networkd-dhcp6.h @@ -18,6 +18,7 @@ typedef struct Request Request; bool link_dhcp6_with_address_enabled(Link *link); bool link_dhcp6_pd_is_enabled(Link *link); +int dhcp6_pd_find_uplink(Link *link, Link **ret); int dhcp6_pd_remove(Link *link, bool only_marked); int dhcp6_update_mac(Link *link); int dhcp6_start(Link *link); diff --git a/src/network/networkd-radv.c b/src/network/networkd-radv.c index c98528aee9d..a137270cfa9 100644 --- a/src/network/networkd-radv.c +++ b/src/network/networkd-radv.c @@ -410,6 +410,8 @@ set_domains: } static int radv_find_uplink(Link *link, Link **ret) { + int r; + assert(link); if (link->network->router_uplink_name) @@ -419,8 +421,12 @@ static int radv_find_uplink(Link *link, Link **ret) { return link_get_by_index(link->manager, link->network->router_uplink_index, ret); if (link->network->router_uplink_index == UPLINK_INDEX_AUTO) { - /* It is not necessary to propagate error in automatic selection. */ - if (manager_find_uplink(link->manager, AF_INET6, link, ret) < 0) + if (link_dhcp6_pd_is_enabled(link)) + r = dhcp6_pd_find_uplink(link, ret); /* When DHCPv6PD is enabled, use its uplink. */ + else + r = manager_find_uplink(link->manager, AF_INET6, link, ret); + if (r < 0) + /* It is not necessary to propagate error in automatic selection. */ *ret = NULL; return 0; }