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

network: do not free bound_by carrier map on reconfigure

Otherwise, if a link enters unmanaged state, then its carrier state does
not propagated to other interfaces.
This commit is contained in:
Yu Watanabe 2022-01-31 22:30:39 +09:00
parent b69bfa4305
commit 3cf58ef316

View File

@ -894,24 +894,6 @@ static int link_new_bound_to_list(Link *link) {
return 0;
}
static int link_new_carrier_maps(Link *link) {
int r;
r = link_new_bound_by_list(link);
if (r < 0)
return r;
r = link_handle_bound_by_list(link);
if (r < 0)
return r;
r = link_new_bound_to_list(link);
if (r < 0)
return r;
return link_handle_bound_to_list(link);
}
static void link_free_bound_to_list(Link *link) {
bool updated = false;
Link *bound_to;
@ -1119,6 +1101,10 @@ static int link_configure(Link *link) {
link_set_state(link, LINK_STATE_CONFIGURING);
r = link_new_bound_to_list(link);
if (r < 0)
return r;
r = link_configure_traffic_control(link);
if (r < 0)
return r;
@ -1325,7 +1311,12 @@ static int link_reconfigure_impl(Link *link, bool force) {
return r;
}
link_free_carrier_maps(link);
/* The bound_to map depends on .network file, hence it needs to be freed. But, do not free the
* bound_by map. Otherwise, if a link enters unmanaged state below, then its carrier state will
* not propagated to other interfaces anymore. Moreover, it is not necessary to recreate the
* map here, as it depends on .network files assigned to other links. */
link_free_bound_to_list(link);
link_free_engines(link);
link->network = network_unref(link->network);
@ -1339,10 +1330,6 @@ static int link_reconfigure_impl(Link *link, bool force) {
link_update_operstate(link, true);
link_dirty(link);
r = link_new_carrier_maps(link);
if (r < 0)
return r;
link_set_state(link, LINK_STATE_INITIALIZED);
link->activated = false;
@ -1496,10 +1483,6 @@ static int link_initialized_and_synced(Link *link) {
link_dirty(link);
}
r = link_new_bound_to_list(link);
if (r < 0)
return r;
return link_configure(link);
}