summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-11-20 14:30:55 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-11-20 19:42:06 +0100
commit9ad294efd03662d98523144b3aac1c406239435a (patch)
tree962f088ef78fe834acc920a784f90ab06b4ed9e5 /src/network
parentkillall: gracefully handle processes inserted into containers via nsenter -a (diff)
downloadsystemd-9ad294efd03662d98523144b3aac1c406239435a.tar.xz
systemd-9ad294efd03662d98523144b3aac1c406239435a.zip
network: update state files before replying bus method
Follow-up for 2b07a3211ba8b1b81d6cebb9650d5cb24554b08a.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-link.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 4b341a96c7..3c042e6c18 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1443,6 +1443,7 @@ int link_reconfigure_impl(Link *link, LinkReconfigurationFlag flags) {
}
typedef struct LinkReconfigurationData {
+ Manager *manager;
Link *link;
LinkReconfigurationFlag flags;
sd_bus_message *message;
@@ -1473,6 +1474,12 @@ static void link_reconfiguration_data_destroy_callback(LinkReconfigurationData *
}
if (!data->counter || *data->counter <= 0) {
+ /* Update the state files before replying the bus method. Otherwise,
+ * systemd-networkd-wait-online following networkctl reload/reconfigure may read an
+ * outdated state file and wrongly handle an interface is already in the configured
+ * state. */
+ (void) manager_clean_all(data->manager);
+
r = sd_bus_reply_method_return(data->message, NULL);
if (r < 0)
log_warning_errno(r, "Failed to reply for DBus method, ignoring: %m");
@@ -1521,6 +1528,7 @@ int link_reconfigure_full(Link *link, LinkReconfigurationFlag flags, sd_bus_mess
}
*data = (LinkReconfigurationData) {
+ .manager = link->manager,
.link = link_ref(link),
.flags = flags,
.message = sd_bus_message_ref(message), /* message may be NULL, but _ref() works fine. */