Skip to content

Networkd vs interface renaming#11881

Merged
poettering merged 8 commits intosystemd:masterfrom
yuwata:networkd-vs-interface-renaming
Mar 5, 2019
Merged

Networkd vs interface renaming#11881
poettering merged 8 commits intosystemd:masterfrom
yuwata:networkd-vs-interface-renaming

Conversation

@yuwata
Copy link
Member

@yuwata yuwata commented Mar 4, 2019

Previously, networkd does not synthesize 'move' uevent, and if an interface is passed through uevent or netlink and with valid udev database, the interface is assumed to be initialized.
But, if the interface renaming is requested, it induces move uevent. So, some racy situations between networkd and udev may exist.

This adds ID_NET_RENAMING_TO property to udev database when an interface renaming is requested, and the property will be dropped when the corresponding move uevent is processed. And this makes networkd check whether the property exists or not before configuring interfaces.

I am not sure, but this may fix #7293.

Copy link
Member

@poettering poettering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it wouldn't be better to keep the property name entirely generic. There might be other subsystems that implement the "move" action, and trigger it from "add" by renaming the device (or otherwise doing something to it). And I think it would make sense to allow the property to be used for those things too.

hence maybe rename ID_NET_RENAMING_TO to ID_RENAMING= and make it a boolean? (i mean, we don't need the actual iface name we are renaming to as a prop, do we? a boolean would suffix too, no?)

@poettering
Copy link
Member

I think this is quite an important fix btw, not just for networkd, but any consumer. I figure the NM folks should take notice of this too, and ignore ifaces that have the prop set. @lkundrak ping

@poettering poettering added the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Mar 4, 2019
@yuwata yuwata force-pushed the networkd-vs-interface-renaming branch from 38ee9fa to 8e26dec Compare March 4, 2019 14:52
@yuwata
Copy link
Member Author

yuwata commented Mar 4, 2019

@poettering Updated. The above two tiny comments are addressed in the updated version. But the name ID_NET_RENAMING_TO= is not changed yet.

@yuwata yuwata removed the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Mar 4, 2019
@yuwata
Copy link
Member Author

yuwata commented Mar 4, 2019

I wonder if it wouldn't be better to keep the property name entirely generic. There might be other subsystems that implement the "move" action, and trigger it from "add" by renaming the device (or otherwise doing something to it). And I think it would make sense to allow the property to be used for those things too.

Actually renaming itself may not limited to network interfaces, but currently udevd, at least explicitly, supports only network interface renaming.

hence maybe rename ID_NET_RENAMING_TO to ID_RENAMING= and make it a boolean? (i mean, we don't need the actual iface name we are renaming to as a prop, do we? a boolean would suffix too, no?)

If boolean is enough, meybe we should use a tag?

@poettering
Copy link
Member

Actually renaming itself may not limited to network interfaces, but currently udevd, at least explicitly, supports only network interface renaming.

Well, but other components might do it too, for example from some program they ship that is run from "add". And I think it would make a ton of sense, to allow them to follow the same semantics them, and use the same property for this.

I mean, I figure in PID 1 and such we should also check this new prop, and probably for all devices, so that devices don't show up under their old temporary name at all when they are renamed anyway. And for that having a generic name would be great since PID 1 of course synthesizes .device units for all kinds of device types, not just net ifs

@poettering
Copy link
Member

If boolean is enough, meybe we should use a tag?

tags come at a price. the more oyu have the "fuller" the per-udev-msg bloom filter becomes, and that destroys the filtering caps. Hence, people shouldn't use tags unless they actively want to use it for matching devices. i.e. if somebody asks the question "please tell me all devices that are currently being renamed", then a tag would be right, but if nobody asks questions like that it should be a regular prop. (and yes, i don't think anyone would ask that question, wouldn#t you agree?)

@yuwata yuwata added the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Mar 4, 2019
@yuwata
Copy link
Member Author

yuwata commented Mar 4, 2019

Thank you for the explanation. I will update this tomorrow or later.

@yuwata yuwata force-pushed the networkd-vs-interface-renaming branch from 8e26dec to c30eeee Compare March 5, 2019 01:32
yuwata added 3 commits March 5, 2019 10:33
Before the renaming, wrong .network file may be assigned to the link.
So, let's always drop link configuration.
It will be used in the later commit.
@yuwata yuwata force-pushed the networkd-vs-interface-renaming branch from c30eeee to 8413057 Compare March 5, 2019 01:33
@yuwata
Copy link
Member Author

yuwata commented Mar 5, 2019

@poettering Updated.

  • Rename ID_NET_RENAMING_TO -> ID_RENAMING
  • Always drop ID_RENAMING property on 'move' uevent.

@yuwata yuwata removed the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Mar 5, 2019
systemd-networkd itself does not start dhcp client, but the code
may be used in other projects. So, check that the interface is under
renaming or not.
@yuwata yuwata force-pushed the networkd-vs-interface-renaming branch from 8413057 to 2304168 Compare March 5, 2019 03:48
@poettering poettering merged commit 73622e0 into systemd:master Mar 5, 2019
@yuwata yuwata deleted the networkd-vs-interface-renaming branch March 5, 2019 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Race condition: interface renaming, udev vs. networkd

2 participants