]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/udev/udev-event.c
udev/net: assign alternative names only on add uevent
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 May 2023 03:28:23 +0000 (12:28 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 May 2023 07:37:31 +0000 (16:37 +0900)
commit9094ae52caca0c19ff6abdbd95d17d8e401ea3b1
treee14986e9af9d1876ed445708b57e779e76dfd372
parent81824455008070253c62bf5c27187028ba8e7e99
udev/net: assign alternative names only on add uevent

Previously, we first assign alternative names to a network interface,
then later change its main name if requested. So, we could not assign
the name that currently assigned as the main name of an interface as an
alternative name. So, we retry to assign the previous main name as an
alternative name on later move uevent.

However, that causes some confusing situation. E.g. if a .link file has
```
Name=foo
AlternativeNames=foo baz
```
then even if the interface is renamed by a user e.g. by invoking 'ip link'
command manually, the interface can be still referenced as 'foo', as the
name is now assigned as an alternative name.

This makes the order of name assignment inverse: the main name is first
changed, and then the requested alternative names are assigned. And
udevd do not assign alternative names on move uevent.

Replaces #27506.
src/udev/net/link-config.c
src/udev/net/link-config.h
src/udev/udev-builtin-net_setup_link.c
src/udev/udev-event.c
src/udev/udev-event.h