]> git.ipfire.org Git - thirdparty/systemd.git/commit
network: do not regenerate MAC address if already set by userspace
authorShihao Ren <renshihao.rsh@bytedance.com>
Fri, 10 Jul 2026 07:26:27 +0000 (15:26 +0800)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 11 Jul 2026 15:00:01 +0000 (00:00 +0900)
commitdbb59dab734238aa3fb6caa27ca7c12bdeb461b4
treec38ca0243edadcfc67c55af817469008f69d8bff
parent70cfb11d4bf6175a3548520025e6d6b25d55ff17
network: do not regenerate MAC address if already set by userspace

When MACAddress= is unspecified, a stable MAC is generated to seed a newly
created netdev. Since existing netdevs are reconfigured on reload/restart,
this seed got re-applied to an already existing interface, conflicting with
an explicit MACAddress= from the matching .network file and flipping MAC.

Now, when MACAddress= is unspecified, only generate a new address if
addr_assign_type is not NET_ADDR_SET (i.e. not already set by userspace). On
first creation the interface does not exist yet, so this is a no-op and the
address is generated as before. Mirrors src/udev/net/link-config.c.

Fixes: #42457
src/network/netdev/netdev.c