(Re)Naming interfaces fails if interface with this name are already existing
Bug #1976231 reported by
Jan-Frederik Schmidt
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Netplan |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
When I use the option "set-name" and "match" and want to set the name of an interface, this operation fails if another interface with this name already exists.
This is understandable so far. I would like to suggest at this point that before renaming (i.e. calling "ip link set $CURRENT_NAME $NEW_NAME") it should be checked if the renaming would be possible and e.g. if the names of two interfaces are exchanged the one is temporarily renamed.
To post a comment you must log in.
Thank you for this suggestion. I don't think it's that easy, though. Especially when netplan is run as a systemd-generator during early boot (i.e. the default use case).
The generator is not using "ip link set ..." to change the name, but rather defines udev rules to make the rename happen. We'd need to have some multi-staged udev rules like this:
If interface is supposed to be renamend: RANDOM_ STRING" and remember the association with the netplan ID, this is to avoid conflicts if the new name would already exist.
1) re-name to something temporary "netplan-
2) re-name again (after all re-names moved to a temporary name), to the actual "set-name" value.
I'm marking this as a whishlist item.