1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-26 09:57:26 +03:00

network: radv: use the uplink interface used in DHCPv6-PD

This commit is contained in:
Yu Watanabe 2021-12-01 14:37:26 +09:00
parent 312dac2869
commit f6032ff3e0
4 changed files with 15 additions and 6 deletions

View File

@ -2711,9 +2711,11 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
<listitem><para>Specifies the name or the index of the uplink interface, or one of the special <listitem><para>Specifies the name or the index of the uplink interface, or one of the special
values <literal>:none</literal> and <literal>:auto</literal>. When emitting DNS servers or values <literal>:none</literal> and <literal>:auto</literal>. When emitting DNS servers or
search domains is enabled but no servers are specified, the servers configured in the uplink search domains is enabled but no servers are specified, the servers configured in the uplink
interface will be emitted. When <literal>:auto</literal>, the link which has a default gateway interface will be emitted. When <literal>:auto</literal>, the value specified to the same
with the highest priority will be automatically selected. When <literal>:none</literal>, no setting in the [DHCPv6PrefixDelegation] section will be used if
uplink interface will be selected. Defaults to <literal>:auto</literal>.</para></listitem> <varname>DHCPv6PrefixDelegation=</varname> is enabled, otherwise the link which has a default
gateway with the highest priority will be automatically selected. When <literal>:none</literal>,
no uplink interface will be selected. Defaults to <literal>:auto</literal>.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>

View File

@ -1452,7 +1452,7 @@ static bool dhcp6_pd_uplink_is_ready(Link *link) {
return dhcp6_lease_has_pd_prefix(link->dhcp6_lease); 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; Link *l;
assert(link); assert(link);

View File

@ -18,6 +18,7 @@ typedef struct Request Request;
bool link_dhcp6_with_address_enabled(Link *link); bool link_dhcp6_with_address_enabled(Link *link);
bool link_dhcp6_pd_is_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_pd_remove(Link *link, bool only_marked);
int dhcp6_update_mac(Link *link); int dhcp6_update_mac(Link *link);
int dhcp6_start(Link *link); int dhcp6_start(Link *link);

View File

@ -410,6 +410,8 @@ set_domains:
} }
static int radv_find_uplink(Link *link, Link **ret) { static int radv_find_uplink(Link *link, Link **ret) {
int r;
assert(link); assert(link);
if (link->network->router_uplink_name) 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); return link_get_by_index(link->manager, link->network->router_uplink_index, ret);
if (link->network->router_uplink_index == UPLINK_INDEX_AUTO) { if (link->network->router_uplink_index == UPLINK_INDEX_AUTO) {
/* It is not necessary to propagate error in automatic selection. */ if (link_dhcp6_pd_is_enabled(link))
if (manager_find_uplink(link->manager, AF_INET6, link, ret) < 0) 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; *ret = NULL;
return 0; return 0;
} }