]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: dhcp6pd: set default metric 256 for delegated prefix 21055/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 14 Oct 2021 20:57:30 +0000 (05:57 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 19 Oct 2021 17:36:20 +0000 (02:36 +0900)
When Assign= in [DHCPv6PrefixDelegation] is enabled, then the kernel
will create the prefix route for the assigned address with metric 256.
When Assign= is disabled, then the kernel will create the route with
metric 1024.

For the default value, we should choose a smaller value (higher priority)
than 1024, as the unreachable routes for delegated prefix will be
configured with 1024.

man/systemd.network.xml
src/network/networkd-dhcp-common.h
src/network/networkd-network.c

index bcc86417c69be294a115a22db5a1d063901684b3..01297c397f3081179ade362cc098f547bc5154d9 100644 (file)
@@ -2162,7 +2162,8 @@ Table=1234</programlisting></para>
         <term><varname>RouteMetric=</varname></term>
         <listitem>
           <para>The metric of the route to the delegated prefix subnet. Takes an unsigned integer in
-          the range 0…4294967295. When unset or set to 0, the kernel's default value is used.</para>
+          the range 0…4294967295. When set to 0, the kernel's default value is used. Defaults to 256.
+          </para>
         </listitem>
       </varlistentry>
     </variablelist>
index 4a98038391a04d99b59d16d148c06729c9b2ebb9..2573247db2022e6bbcf5e1e52f2bb43380614471 100644 (file)
@@ -10,6 +10,7 @@
 #include "time-util.h"
 
 #define DHCP_ROUTE_METRIC 1024
+#define DHCP6PD_ROUTE_METRIC 256
 
 typedef struct Link Link;
 typedef struct Manager Manager;
index a367041e9916efd16f7104f20515a738abeac9eb..798f4099297c3f87ff64b54d352d3a228fcbb211 100644 (file)
@@ -409,7 +409,8 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
                 .dhcp6_pd_announce = true,
                 .dhcp6_pd_assign = true,
                 .dhcp6_pd_manage_temporary_address = true,
-                .dhcp6_pd_subnet_id = -1,
+                .dhcp6_pd_subnet_id = UINT64_MAX,
+                .dhcp6_pd_route_metric = DHCP6PD_ROUTE_METRIC,
 
                 .dhcp_server_bind_to_interface = true,
                 .dhcp_server_emit[SD_DHCP_LEASE_DNS].emit = true,