network: dhcp6-pd: add RouteMetric= setting in [DHCPv6PrefixDelegation]

This commit is contained in:
Yu Watanabe 2021-04-18 02:32:51 +09:00
parent 8ebafba9f9
commit 9fe0b7b493
5 changed files with 13 additions and 0 deletions

View file

@ -2160,6 +2160,14 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
<para>As in the [Address] section, but defaults to true.</para>
</listitem>
</varlistentry>
<varlistentry>
<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>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -284,6 +284,7 @@ static int dhcp6_set_pd_route(Link *link, const union in_addr_union *prefix, con
route->dst = *prefix;
route->dst_prefixlen = 64;
route->protocol = RTPROT_DHCP;
route->priority = link->network->dhcp6_pd_route_metric;
r = route_configure(route, link, dhcp6_pd_route_handler, &ret);
if (r < 0)
@ -399,6 +400,7 @@ static int dhcp6_set_pd_address(
address->cinfo.ifa_prefered = lifetime_preferred;
address->cinfo.ifa_valid = lifetime_valid;
SET_FLAG(address->flags, IFA_F_MANAGETEMPADDR, link->network->dhcp6_pd_manage_temporary_address);
address->route_metric = link->network->dhcp6_pd_route_metric;
r = address_configure(address, link, dhcp6_pd_address_handler, &ret);
if (r < 0)

View file

@ -309,6 +309,7 @@ DHCPv6PrefixDelegation.Announce, config_parse_bool,
DHCPv6PrefixDelegation.Assign, config_parse_bool, 0, offsetof(Network, dhcp6_pd_assign)
DHCPv6PrefixDelegation.ManageTemporaryAddress, config_parse_bool, 0, offsetof(Network, dhcp6_pd_manage_temporary_address)
DHCPv6PrefixDelegation.Token, config_parse_dhcp6_pd_token, 0, offsetof(Network, dhcp6_pd_token)
DHCPv6PrefixDelegation.RouteMetric, config_parse_uint32, 0, offsetof(Network, dhcp6_pd_route_metric)
IPv6SendRA.RouterLifetimeSec, config_parse_sec, 0, offsetof(Network, router_lifetime_usec)
IPv6SendRA.Managed, config_parse_bool, 0, offsetof(Network, router_managed)
IPv6SendRA.OtherInformation, config_parse_bool, 0, offsetof(Network, router_other_information)

View file

@ -219,6 +219,7 @@ struct Network {
bool dhcp6_pd_assign;
bool dhcp6_pd_manage_temporary_address;
int64_t dhcp6_pd_subnet_id;
uint32_t dhcp6_pd_route_metric;
union in_addr_union dhcp6_pd_token;
/* Bridge Support */

View file

@ -147,6 +147,7 @@ Announce=
Assign=
ManageTemporaryAddress=
Token=
RouteMetric=
[Route]
Destination=
Protocol=