Merge pull request #17619 from yuwata/network-ndisc-dhcp6-client-always
network: honor M or O flag in RA even if IPv6AcceptRA.DHCPv6Cleint=always
This commit is contained in:
commit
e5b88e8d73
|
@ -2086,9 +2086,11 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>DHCPv6Client=</varname></term>
|
<term><varname>DHCPv6Client=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Takes a boolean, or the special value <literal>always</literal>. When true (the default), the DHCPv6 client will be started when the
|
<para>Takes a boolean, or the special value <literal>always</literal>. When true or
|
||||||
RA has the managed or other information flag. If set to <literal>always</literal>, the DHCPv6 client will be started even if there is no
|
<literal>always</literal>, the DHCPv6 client will be started when the RA has the managed or
|
||||||
managed or other information flag in the RA.</para>
|
other information flag. If set to <literal>always</literal>, the DHCPv6 client will also be
|
||||||
|
started in managed mode when neither managed nor other information flag is set in the RA.
|
||||||
|
Defaults to true.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
|
@ -1743,8 +1743,7 @@ int sd_dhcp6_client_start(sd_dhcp6_client *client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
log_dhcp6_client(client, "Started in %s mode",
|
log_dhcp6_client(client, "Started in %s mode",
|
||||||
client->information_request? "Information request":
|
client->information_request ? "Information request" : "Managed");
|
||||||
"Managed");
|
|
||||||
|
|
||||||
return client_start(client, state);
|
return client_start(client, state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1163,13 +1163,17 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Failed to get RA flags: %m");
|
return log_link_error_errno(link, r, "Failed to get RA flags: %m");
|
||||||
|
|
||||||
if ((flags & (ND_RA_FLAG_MANAGED | ND_RA_FLAG_OTHER) && link->network->ipv6_accept_ra_start_dhcp6_client)) {
|
if ((flags & (ND_RA_FLAG_MANAGED | ND_RA_FLAG_OTHER) &&
|
||||||
|
link->network->ipv6_accept_ra_start_dhcp6_client != IPV6_ACCEPT_RA_START_DHCP6_CLIENT_NO) ||
|
||||||
|
link->network->ipv6_accept_ra_start_dhcp6_client == IPV6_ACCEPT_RA_START_DHCP6_CLIENT_ALWAYS) {
|
||||||
|
|
||||||
if (link->network->ipv6_accept_ra_start_dhcp6_client == IPV6_ACCEPT_RA_START_DHCP6_CLIENT_ALWAYS)
|
if (flags & (ND_RA_FLAG_MANAGED | ND_RA_FLAG_OTHER))
|
||||||
r = dhcp6_request_address(link, false);
|
|
||||||
else
|
|
||||||
/* (re)start DHCPv6 client in stateful or stateless mode according to RA flags */
|
/* (re)start DHCPv6 client in stateful or stateless mode according to RA flags */
|
||||||
r = dhcp6_request_address(link, !(flags & ND_RA_FLAG_MANAGED));
|
r = dhcp6_request_address(link, !(flags & ND_RA_FLAG_MANAGED));
|
||||||
|
else
|
||||||
|
/* When IPv6AcceptRA.DHCPv6Client=always, start dhcp6 client in managed mode
|
||||||
|
* even if router does not have M or O flag. */
|
||||||
|
r = dhcp6_request_address(link, false);
|
||||||
if (r < 0 && r != -EBUSY)
|
if (r < 0 && r != -EBUSY)
|
||||||
return log_link_error_errno(link, r, "Could not acquire DHCPv6 lease on NDisc request: %m");
|
return log_link_error_errno(link, r, "Could not acquire DHCPv6 lease on NDisc request: %m");
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue