This partially reverts
95355a281c06c5970b7355c38b066910c3be4958.
It seems that other parts of link_stop_clients() should be skipped
when restarting, but I don't know enough about those other clients to have
an opinion if it is better to stop&start them on restart or not.
Anyway, that can be done in later patches now that the support for restarts
is there.
Fixes #13625.
lease expires. This is contrary to the DHCP specification, but may be the best choice if,
e.g., the root filesystem relies on this connection. The setting <literal>dhcp</literal>
implies <literal>dhcp-on-stop</literal>, and <literal>yes</literal> implies
- <literal>dhcp</literal> and <literal>static</literal>. Defaults to
- <literal>dhcp-on-stop</literal>.</para>
+ <literal>dhcp</literal> and <literal>static</literal>. Defaults to <literal>no</literal>.
+ </para>
</listitem>
</varlistentry>
dhcp4_release_old_lease(link);
- if (link->dhcp_client && (!may_keep_dhcp || !link->network ||
- !FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_DHCP_ON_STOP))) {
+ bool keep_dhcp = may_keep_dhcp &&
+ link->network &&
+ (link->manager->restarting ||
+ FLAGS_SET(link->network->keep_configuration, KEEP_CONFIGURATION_DHCP_ON_STOP));
+
+ if (link->dhcp_client && !keep_dhcp) {
k = sd_dhcp_client_stop(link->dhcp_client);
if (k < 0)
r = log_link_warning_errno(link, k, "Could not stop DHCPv4 client: %m");
/* CriticalConnection=yes also preserve foreign static configurations. */
network->keep_configuration = KEEP_CONFIGURATION_YES;
else
- /* For backward compatibility, we do not release DHCP addresses on manager stop. */
- network->keep_configuration = KEEP_CONFIGURATION_DHCP_ON_STOP;
+ network->keep_configuration = KEEP_CONFIGURATION_NO;
}
if (network->keep_configuration < 0)
- /* For backward compatibility, we do not release DHCP addresses on manager stop. */
- network->keep_configuration = KEEP_CONFIGURATION_DHCP_ON_STOP;
+ network->keep_configuration = KEEP_CONFIGURATION_NO;
LIST_FOREACH_SAFE(addresses, address, address_next, network->static_addresses)
if (address_section_verify(address) < 0)