Skip to content

Commit

Permalink
network: skip to reassign master ifindex if already set
Browse files Browse the repository at this point in the history
Otherwise, the slave interface may go down, especially when the master
is bond.

Fixes systemd#25067.
  • Loading branch information
yuwata committed Oct 27, 2022
1 parent 6fadf01 commit ebf95ef
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/network/networkd-setlink.c
Expand Up @@ -543,6 +543,12 @@ static int link_is_ready_to_set_link(Link *link, Request *req) {
m = link->network->vrf->ifindex;
}

if (m == (uint32_t) link->master_ifindex) {
/* The requested master is already set. */
link->master_set = true;
return -EALREADY; /* indicate to cancel the request. */
}

req->userdata = UINT32_TO_PTR(m);
break;
}
Expand All @@ -568,6 +574,8 @@ static int link_process_set_link(Request *req, Link *link, void *userdata) {
assert(link);

r = link_is_ready_to_set_link(link, req);
if (r == -EALREADY)
return 1; /* Cancel the request. */
if (r <= 0)
return r;

Expand Down

0 comments on commit ebf95ef

Please sign in to comment.