]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: add DHCPv6.RouteMetric=
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 1 Jun 2020 04:02:16 +0000 (13:02 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 2 Jun 2020 06:16:51 +0000 (15:16 +0900)
Hopefully fixes #15295.

man/systemd.network.xml
src/network/networkd-ndisc.c
src/network/networkd-network-gperf.gperf
src/network/networkd-network.c
src/network/networkd-network.h
test/fuzz/fuzz-network-parser/directives.network

index ae82ae7e02b21759a7f2b616dddbedb00e2820de..146401f6c9001c552245c8911db2db9868cfee10 100644 (file)
         <varlistentry>
           <term><varname>RouteMetric=</varname></term>
           <listitem>
-            <para>Set the routing metric for routes specified by the
-            DHCP server.</para>
+            <para>Set the routing metric for routes specified by the DHCP server. Defaults to 1024.</para>
           </listitem>
         </varlistentry>
 
           </listitem>
         </varlistentry>
 
+        <varlistentry>
+          <term><varname>RouteMetric=</varname></term>
+          <listitem>
+            <para>Set the routing metric for routes specified by the DHCP server. Defaults to 1024.</para>
+          </listitem>
+        </varlistentry>
+
         <varlistentry>
           <term><varname>RapidCommit=</varname></term>
           <listitem>
index 8af7b3c0c3c83645f6e5eda991ba046d8e9b2e58..6de8428e1e2fed81e255a53f25db891b0e8e3bbb 100644 (file)
@@ -216,7 +216,7 @@ static int ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
 
         route->family = AF_INET6;
         route->table = link_get_ipv6_accept_ra_route_table(link);
-        route->priority = link->network->dhcp_route_metric;
+        route->priority = link->network->dhcp6_route_metric;
         route->protocol = RTPROT_RA;
         route->pref = preference;
         route->gw = gateway;
@@ -451,7 +451,7 @@ static int ndisc_router_process_onlink_prefix(Link *link, sd_ndisc_router *rt) {
 
         route->family = AF_INET6;
         route->table = link_get_ipv6_accept_ra_route_table(link);
-        route->priority = link->network->dhcp_route_metric;
+        route->priority = link->network->dhcp6_route_metric;
         route->protocol = RTPROT_RA;
         route->flags = RTM_F_PREFIX;
         route->dst_prefixlen = prefixlen;
@@ -512,6 +512,7 @@ static int ndisc_router_process_route(Link *link, sd_ndisc_router *rt) {
 
         route->family = AF_INET6;
         route->table = link_get_ipv6_accept_ra_route_table(link);
+        route->priority = link->network->dhcp6_route_metric;
         route->protocol = RTPROT_RA;
         route->pref = preference;
         route->gw.in6 = gateway;
index 2fc513fbadc10f8be3153322a2866478c4f6fe7d..4976c62c100bf57aefaab5ace1ede9db0d9d0d60 100644 (file)
@@ -204,6 +204,7 @@ DHCPv6.AssignAcquiredDelegatedPrefixAddress, config_parse_bool,
 DHCPv6.PrefixDelegationHint,                 config_parse_dhcp6_pd_hint,                               0,                             0
 DHCPv6.WithoutRA,                            config_parse_bool,                                        0,                             offsetof(Network, dhcp6_without_ra)
 DHCPv6.SendOption,                           config_parse_dhcp_send_option,                            AF_INET6,                      offsetof(Network, dhcp6_client_send_options)
+DHCPv6.RouteMetric,                          config_parse_uint32,                                      0,                             offsetof(Network, dhcp6_route_metric)
 IPv6AcceptRA.UseAutonomousPrefix,            config_parse_bool,                                        0,                             offsetof(Network, ipv6_accept_ra_use_autonomous_prefix)
 IPv6AcceptRA.UseOnLinkPrefix,                config_parse_bool,                                        0,                             offsetof(Network, ipv6_accept_ra_use_onlink_prefix)
 IPv6AcceptRA.UseDNS,                         config_parse_bool,                                        0,                             offsetof(Network, ipv6_accept_ra_use_dns)
index 2e8cba4ae2edee0a9998409c2cd2cb52f45bb7d9..b928f7585c39ff4a2171c4598cc18a07cbd00b6e 100644 (file)
@@ -410,6 +410,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
                 .dhcp_use_timezone = false,
                 .rapid_commit = true,
 
+                .dhcp6_route_metric = DHCP_ROUTE_METRIC,
                 .dhcp6_use_ntp = true,
                 .dhcp6_use_dns = true,
 
index db325d0d3c26683bcb091cdc35b5b659d8022d1a..1d4b68d790e0f45601e3ac9ea8d0d90afafe22a9 100644 (file)
@@ -132,6 +132,7 @@ struct Network {
         bool dhcp6_use_ntp;
         bool dhcp6_without_ra;
         uint8_t dhcp6_pd_length;
+        uint32_t dhcp6_route_metric;
         char *dhcp6_mudurl;
         char **dhcp6_user_class;
         char **dhcp6_vendor_class;
index faa38a1c1e00a52226ae2e28121261727c127ab2..0b62420e0a9b2035aa92271f6e18211d3d8241c9 100644 (file)
@@ -121,6 +121,7 @@ UserClass=
 VendorClass=
 AssignAcquiredDelegatedPrefixAddress=
 SendVendorOption=
+RouteMetric=
 [Route]
 Destination=
 Protocol=