]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: radv: use the uplink interface used in DHCPv6-PD
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 1 Dec 2021 05:37:26 +0000 (14:37 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 1 Dec 2021 11:35:03 +0000 (20:35 +0900)
man/systemd.network.xml
src/network/networkd-dhcp6.c
src/network/networkd-dhcp6.h
src/network/networkd-radv.c

index e90877ada800662d8d6165cbea9f3c5a6b64cf73..fb2569a9dd87cc7f7675da91c64b190c920a9763 100644 (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
         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
-        interface will be emitted. When <literal>:auto</literal>, 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>
+        interface will be emitted. When <literal>:auto</literal>, the value specified to the same
+        setting in the [DHCPv6PrefixDelegation] section will be used if
+        <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>
index 8d48aa9f88b53c579b6f77c3a1ba8309559308de..da5a22a7b560f06a965dd1fca1027f8762050907 100644 (file)
@@ -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);
index 4a522aebcfd8ec9a0c4ace23370ef541c9dfa951..9c5aff6af7c769dec296ed1c37adc21ca0aedfe7 100644 (file)
@@ -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);
index c98528aee9d92dc7ef1b16ac86baaa7547823c07..a137270cfa94d4d18e82e6bf1188338895627846 100644 (file)
@@ -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;
         }