From abbd3a3184657fd6aeb43aab4bc90d98e59c0319 Mon Sep 17 00:00:00 2001 From: Mark Asselstine Date: Thu, 16 Apr 2020 11:57:45 -0400 Subject: [PATCH] node_device_udev: handle move events It is possible and common to rename some devices, this is especially true for ethernet devices such as veth pairs. In the udevEventHandleThread() we will be notified of this change but currently we only process "add", "change" and "remove" events. Renaming a device such as above results in a "move" event, not a "remove" followed by and "add" or vise versa. This change will add the new/destination device to our records but unfortunately there is no usable mechanism to identify the old/source device to remove it from the records. So this is admittedly only a partial fix. Signed-off-by: Mark Asselstine Reviewed-by: Martin Kletzander Reviewed-by: Michal Privoznik --- src/node_device/node_device_udev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 8451903e8a..3149de8321 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1499,6 +1499,11 @@ udevHandleOneDevice(struct udev_device *device) if (STREQ(action, "remove")) return udevRemoveOneDevice(device); + if (STREQ(action, "move")) { + /* TODO: implement a way of finding and removing the old device */ + return udevAddOneDevice(device); + } + return 0; }