network/netdev: enter ready state only when it is created by us
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 8 Nov 2024 15:58:29 +0000 (00:58 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 14 Nov 2024 01:17:19 +0000 (10:17 +0900)
commitb0d2ce83423ac69c45d39dab1adabcb1b03ea565
tree34e245c287b3c6a989d2c5ea4a1e4f8410be2ee0
parent09db4106064dd600c64d12a4e06bd88143b2e4f7
network/netdev: enter ready state only when it is created by us

Follow-up for PR #34909.

This fixes an issue that network interfaces cannot join a master netdev,
like bond or bridge, when the corresponding .netdev is reloaded.

With PR #34909, networkd supports reloading .netdev files. However,
When a .netdev file is modified and reloaded, ifindex is copied from
the old NetDev object to the new one. Thus, even if the interface is
successfully updated, netdev_set_ifindex_impl() will return 0 and
netdev_enter_ready() will never called. If the netdev is a kind of
master netdev, then port interfaces cannot join the master netdev,
as REQUEST_TYPE_SET_LINK_MASTER requires that the master netdev is
in the ready state.
src/network/netdev/netdev.c