1
0
mirror of https://github.com/systemd/systemd synced 2025-09-27 15:54:47 +02:00

Compare commits

..

No commits in common. "5916c54a8dabd25efa0d78deef78fbfab684b8a4" and "239952e890fd4b53859f84bbc43d910e68a8f6bc" have entirely different histories.

2 changed files with 19 additions and 22 deletions

View File

@ -667,12 +667,11 @@ int bus_link_method_reconfigure(sd_bus_message *message, void *userdata, sd_bus_
r = link_reconfigure(l, true); r = link_reconfigure(l, true);
if (r < 0) if (r < 0)
return r; return r;
if (r > 0) {
link_set_state(l, LINK_STATE_INITIALIZED); link_set_state(l, LINK_STATE_INITIALIZED);
r = link_save_and_clean(l); r = link_save_and_clean(l);
if (r < 0) if (r < 0)
return r; return r;
}
return sd_bus_reply_method_return(message, NULL); return sd_bus_reply_method_return(message, NULL);
} }

View File

@ -2118,11 +2118,11 @@ static int link_configure_continue(Link *link) {
} }
static int link_reconfigure_internal(Link *link, sd_netlink_message *m, bool force) { static int link_reconfigure_internal(Link *link, sd_netlink_message *m, bool force) {
_cleanup_strv_free_ char **s = NULL;
Network *network; Network *network;
int r; int r;
assert(m); if (m) {
_cleanup_strv_free_ char **s = NULL;
r = sd_netlink_message_get_errno(m); r = sd_netlink_message_get_errno(m);
if (r < 0) if (r < 0)
@ -2133,6 +2133,7 @@ static int link_reconfigure_internal(Link *link, sd_netlink_message *m, bool for
return r; return r;
strv_free_and_replace(link->alternative_names, s); strv_free_and_replace(link->alternative_names, s);
}
r = network_get(link->manager, link->iftype, link->sd_device, r = network_get(link->manager, link->iftype, link->sd_device,
link->ifname, link->alternative_names, link->driver, link->ifname, link->alternative_names, link->driver,
@ -2222,11 +2223,8 @@ int link_reconfigure(Link *link, bool force) {
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL; _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
int r; int r;
/* When link in pending or initialized state, then link_configure() will be called. To prevent if (IN_SET(link->state, LINK_STATE_PENDING, LINK_STATE_LINGER))
* the function from being called multiple times simultaneously, refuse to reconfigure the return 0;
* interface in these cases. */
if (IN_SET(link->state, LINK_STATE_PENDING, LINK_STATE_INITIALIZED, LINK_STATE_LINGER))
return 0; /* 0 means no-op. */
r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_GETLINK, r = sd_rtnl_message_new_link(link->manager->rtnl, &req, RTM_GETLINK,
link->ifindex); link->ifindex);
@ -2241,7 +2239,7 @@ int link_reconfigure(Link *link, bool force) {
link_ref(link); link_ref(link);
return 1; /* 1 means the interface will be reconfigured. */ return 0;
} }
static int link_initialized_and_synced(Link *link) { static int link_initialized_and_synced(Link *link) {
@ -2478,7 +2476,7 @@ static int link_carrier_gained(Link *link) {
if (r < 0) if (r < 0)
return r; return r;
if (r > 0) { if (r > 0) {
r = link_reconfigure(link, false); r = link_reconfigure_internal(link, NULL, false);
if (r < 0) { if (r < 0) {
link_enter_failed(link); link_enter_failed(link);
return r; return r;