Skip to content

Commit

Permalink
network: call link_handle_bound_by_list() before trying to reconfigur…
Browse files Browse the repository at this point in the history
…e interface

Otherwise, when an interface gained its carrier, the interface may not
have matching .network file yet, then link_reconfigure_impl() returns
zero, and link_handle_bound_by_list() is skipped.

Fixes #33837.

(cherry picked from commit 36b8ad085c6902631ad7054bffbda33d6d168823)
(cherry picked from commit 0d98178abb5ea470d03d05680e58ff0e59fe69bd)
  • Loading branch information
yuwata authored and bluca committed Aug 16, 2024
1 parent b994100 commit 84c4a44
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/network/networkd-link.c
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,13 @@ static int link_carrier_gained(Link *link) {
if (r < 0)
log_link_warning_errno(link, r, "Failed to disable carrier lost timer, ignoring: %m");

/* Process BindCarrier= setting specified by other interfaces. This is independent of the .network
* file assigned to this interface, but depends on .network files assigned to other interfaces.
* Hence, this can and should be called earlier. */
r = link_handle_bound_by_list(link);
if (r < 0)
return r;

/* If a wireless interface was connected to an access point, and the SSID is changed (that is,
* both previous_ssid and ssid are non-NULL), then the connected wireless network could be
* changed. So, always reconfigure the link. Which means e.g. the DHCP client will be
Expand Down Expand Up @@ -1559,10 +1566,6 @@ static int link_carrier_gained(Link *link) {
if (r != 0)
return r;

r = link_handle_bound_by_list(link);
if (r < 0)
return r;

if (link->iftype == ARPHRD_CAN)
/* let's shortcut things for CAN which doesn't need most of what's done below. */
return 0;
Expand Down

0 comments on commit 84c4a44

Please sign in to comment.