mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 22:30:11 +01:00
device: do not set MAC address on iface with index <=0
The `nm_device_hw_addr_reset()` should only set MAC address on NIC with valid(>0) interface index. The failure was found by `ovs_mtu` test of NMCI, failed to reproduce the original problem (`ovs_mtu` test of NMCI) with 100 times retry. And no trace log found for original test failure, hence cannot tell why `nm_device_hw_addr_reset()` been invoked with iface index 0. Signed-off-by: Gris Ge <fge@redhat.com> (cherry picked from commit215bc15255) (cherry picked from commit21f1e5cdc7)
This commit is contained in:
parent
c9a6e501b6
commit
37bd70034f
1 changed files with 8 additions and 1 deletions
|
|
@ -16871,6 +16871,7 @@ nm_device_hw_addr_reset(NMDevice *self, const char *detail)
|
|||
{
|
||||
NMDevicePrivate *priv;
|
||||
const char *addr;
|
||||
int ifindex;
|
||||
|
||||
g_return_val_if_fail(NM_IS_DEVICE(self), FALSE);
|
||||
|
||||
|
|
@ -16880,7 +16881,13 @@ nm_device_hw_addr_reset(NMDevice *self, const char *detail)
|
|||
return TRUE;
|
||||
|
||||
priv->hw_addr_type = HW_ADDR_TYPE_UNSET;
|
||||
addr = nm_device_get_initial_hw_address(self);
|
||||
|
||||
ifindex = nm_device_get_ip_ifindex(self);
|
||||
if (ifindex <= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
addr = nm_device_get_initial_hw_address(self);
|
||||
if (!addr) {
|
||||
/* as hw_addr_type is not UNSET, we expect that we can get an
|
||||
* initial address to which to reset. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue