Skip to content

[th/device-set-mac-addr-no-down] device: avoid taking down link to change MAC address

Thomas Haller requested to merge th/device-set-mac-addr-no-down into master

A lot of drivers actually support changing the MAC address of a link without taking it down.

Taking down a link is very bad, because kernel will remove routes. For example, if the user used a dispatcher script to add routes, these will be lost. Note that we may change the MAC address of a device any time. For example, a VLAN device watches the parent's MAC address and configures it (with a logging message "parent hardware address changed to ...").

Try first whether we can change the MAC address without taking the link down. Only if that fails, retry with taking it down first.

https://bugzilla.redhat.com/show_bug.cgi?id=1639274

Merge request reports