// uevent
+static int nw_link_uevent_device_is_renaming(sd_device* device) {
+ int r;
+
+ r = sd_device_get_property_value(device, "ID_RENAMING", NULL);
+ switch (r) {
+ case -ENOENT:
+ return 0;
+
+ case 0:
+ return 1;
+
+ default:
+ return r;
+ }
+}
+
int nw_link_handle_uevent(nw_link* link, sd_device* device, sd_device_action_t action) {
+ int r;
+
+ // Check if the device is renaming
+ r = nw_link_uevent_device_is_renaming(device);
+ switch (r) {
+ // Not renaming - Fallthrough
+ case 0:
+ break;
+
+ case 1:
+ DEBUG("Device is renaming, skipping initialization\n");
+ return 0;
+
+ default:
+ ERROR("Could not determine whether the device is being renamed: %s\n",
+ strerror(-r));
+ return r;
+ }
+
// We need to remove or replace the stored device as it is now outdated
if (link->device) {
sd_device_unref(link->device);