network: enter initialized state when the interface will be reconfigured

When the interface is in the failed state, link_getlink_handler_internal()
will do nothing and return zero, thus the interface will not be
reconfigured, especially when the reconfiguration is triggered in
link_enter_failed().

Follow-up for c2eb7753dd.
This commit is contained in:
Yu Watanabe
2024-08-21 07:29:19 +09:00
parent ebf66d0c05
commit 685fd0d729
2 changed files with 6 additions and 1 deletions
-1
View File
@@ -669,7 +669,6 @@ int bus_link_method_reconfigure(sd_bus_message *message, void *userdata, sd_bus_
if (r < 0)
return r;
if (r > 0) {
link_set_state(l, LINK_STATE_INITIALIZED);
r = link_save_and_clean_full(l, /* also_save_manager = */ true);
if (r < 0)
return r;
+6
View File
@@ -1454,6 +1454,9 @@ int link_reconfigure(Link *link, bool force) {
if (r < 0)
return r;
if (force || link->state == LINK_STATE_FAILED)
link_set_state(link, LINK_STATE_INITIALIZED);
return 1; /* 1 means the interface will be reconfigured. */
}
@@ -1536,6 +1539,9 @@ int link_reconfigure_on_bus_method_reload(Link *link, sd_bus_message *message) {
TAKE_PTR(data);
link->manager->reloading++;
if (link->state == LINK_STATE_FAILED)
link_set_state(link, LINK_STATE_INITIALIZED);
return 0;
}