1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00

Merge pull request #22496 from yuwata/network-cleanups-keep-configuration

network: cleanups for KeepConfiguration= setting
This commit is contained in:
Luca Boccassi 2022-02-14 13:17:23 +00:00 committed by GitHub
commit d0ebe2a835
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -848,10 +848,6 @@ int link_drop_foreign_addresses(Link *link) {
assert(link);
assert(link->network);
/* Keep all addresses when KeepConfiguration=yes. */
if (link->network->keep_configuration == KEEP_CONFIGURATION_YES)
return 0;
/* First, mark all addresses. */
SET_FOREACH(address, link->addresses) {
/* We consider IPv6LL addresses to be managed by the kernel, or dropped in link_drop_ipv6ll_addresses() */

View File

@ -1240,10 +1240,13 @@ static int link_reconfigure_impl(Link *link, bool force) {
link_drop_requests(link);
if (network && !force)
if (network && !force && network->keep_configuration != KEEP_CONFIGURATION_YES)
/* When a new/updated .network file is assigned, first make all configs (addresses,
* routes, and so on) foreign, and then drop unnecessary configs later by
* link_drop_foreign_config() in link_configure(). */
* link_drop_foreign_config() in link_configure().
* Note, when KeepConfiguration=yes, link_drop_foreign_config() does nothing. Hence,
* here we need to drop the configs such as addresses, routes, and so on configured by
* the previously assigned .network file. */
link_foreignize_config(link);
else {
/* Remove all managed configs. Note, foreign configs are removed in later by