network: Allow DHCPv6 client to start without router's managed flag.

This commit is contained in:
Susant Sahani 2020-02-15 13:51:34 +01:00 committed by Yu Watanabe
parent eec394f10b
commit cd305af1fe
5 changed files with 22 additions and 0 deletions

View file

@ -1694,6 +1694,14 @@
a prefix-hint in the DHCPv6 solicitation. Prefix ranges 1-128. Defaults to unset.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>WithoutRA=</varname></term>
<listitem>
<para>When true, DHCPv6 client starts without router advertisements's managed or other address configuration flag.
Defaults to false.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -1553,6 +1553,17 @@ static int link_acquire_ipv6_conf(Link *link) {
return log_link_warning_errno(link, r, "Could not start IPv6 Router Advertisement: %m");
}
if (link_dhcp6_enabled(link) && link->network->dhcp6_without_ra) {
assert(link->dhcp6_client);
assert(in_addr_is_link_local(AF_INET6, (const union in_addr_union*)&link->ipv6ll_address) > 0);
r = dhcp6_request_address(link, true);
if (r < 0 && r != -EBUSY)
return log_link_warning_errno(link, r, "Could not acquire DHCPv6 lease: %m");
else
log_link_debug(link, "Acquiring DHCPv6 lease");
}
(void) dhcp6_request_prefix_delegation(link);
return 0;

View file

@ -188,6 +188,7 @@ DHCPv6.UseNTP, config_parse_bool,
DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit)
DHCPv6.ForceDHCPv6PDOtherInformation, config_parse_bool, 0, offsetof(Network, dhcp6_force_pd_other_information)
DHCPv6.PrefixDelegationHint, config_parse_dhcp6_pd_hint, 0, 0
DHCPv6.WithoutRA, config_parse_bool, 0, offsetof(Network, dhcp6_without_ra)
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)

View file

@ -126,6 +126,7 @@ struct Network {
/* DHCPv6 Client support*/
bool dhcp6_use_dns;
bool dhcp6_use_ntp;
bool dhcp6_without_ra;
uint8_t dhcp6_pd_length;
struct in6_addr dhcp6_pd_address;

View file

@ -107,6 +107,7 @@ UseDNS=
RapidCommit=
ForceDHCPv6PDOtherInformation=
PrefixDelegationHint=
WithoutRA=
[Route]
Destination=
Protocol=