mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-11 09:18:38 +02:00
core: reevaluate ignore-carrier after UDEV's announcement
When a new device is hot plugged, matching by MAC doesn't work yet
because we haven't set the permanent MAC address in NMDevicePrivate.
This seems to be intentional, per the following commit:
7b7c653c4f ('device: delay capturing permanent MAC address until UDEV is settled')
Reevaluate ignore-carrier after UDEV's announcement (unsetting of the
PLATFORM_INIT unmanaged flag) so it gets its correct value.
The rest of configurations that can be set with a `match-device`
condition are evaluated when the device has already moved at least to a
managed state, so they don't have this problem.
Closes https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1907
This commit is contained in:
parent
230009b9e8
commit
4eead7ab88
1 changed files with 10 additions and 1 deletions
|
|
@ -7883,6 +7883,12 @@ device_link_changed(gpointer user_data)
|
|||
NM_UNMANAGED_PLATFORM_INIT,
|
||||
NM_UNMAN_FLAG_OP_SET_MANAGED,
|
||||
nm_device_get_manage_reason_external(self));
|
||||
|
||||
/* Now that we got UDEV's announcement we need to check ignore-carrier again.
|
||||
* This is because the permanent MAC might have been set or changed. If we don't
|
||||
* recheck we would ignore rules matching by MAC address. */
|
||||
priv->ignore_carrier =
|
||||
nm_config_data_get_ignore_carrier_by_device(nm_config_get_data(nm_config_get()), self);
|
||||
}
|
||||
|
||||
_dev_unmanaged_check_external_down(self, FALSE, FALSE);
|
||||
|
|
@ -8559,10 +8565,13 @@ realize_start_setup(NMDevice *self,
|
|||
nm_device_update_initial_hw_address(self);
|
||||
nm_device_update_permanent_hw_address(self, FALSE);
|
||||
|
||||
/* Note: initial hardware address must be read before calling get_ignore_carrier() */
|
||||
/* Note: initial hardware address must be read before calling get_ignore_carrier(). We'll
|
||||
* need to recheck ignore_carrier again after UDEV's announcement, as the permanent MAC
|
||||
* address may be set by UDEV. */
|
||||
config = nm_config_get();
|
||||
priv->ignore_carrier =
|
||||
nm_config_data_get_ignore_carrier_by_device(nm_config_get_data(config), self);
|
||||
|
||||
if (!priv->config_changed_id) {
|
||||
priv->config_changed_id = g_signal_connect(config,
|
||||
NM_CONFIG_SIGNAL_CONFIG_CHANGED,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue