platform: react on udev signal "move"

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller
2014-03-07 13:30:30 +01:00
parent b9d85bb783
commit 3d396d6f72

View File

@@ -3036,6 +3036,7 @@ udev_device_added (NMPlatform *platform,
auto_nl_object struct rtnl_link *rtnllink = NULL; auto_nl_object struct rtnl_link *rtnllink = NULL;
const char *ifname; const char *ifname;
int ifindex; int ifindex;
gboolean is_changed;
ifname = g_udev_device_get_name (udev_device); ifname = g_udev_device_get_name (udev_device);
if (!ifname) { if (!ifname) {
@@ -3055,6 +3056,7 @@ udev_device_added (NMPlatform *platform,
return; return;
} }
is_changed = g_hash_table_lookup_extended (priv->udev_devices, GINT_TO_POINTER (ifindex), NULL, NULL);
g_hash_table_insert (priv->udev_devices, GINT_TO_POINTER (ifindex), g_hash_table_insert (priv->udev_devices, GINT_TO_POINTER (ifindex),
g_object_ref (udev_device)); g_object_ref (udev_device));
@@ -3065,7 +3067,7 @@ udev_device_added (NMPlatform *platform,
return; return;
} }
announce_object (platform, (struct nl_object *) rtnllink, ADDED, NM_PLATFORM_REASON_EXTERNAL); announce_object (platform, (struct nl_object *) rtnllink, is_changed ? CHANGED : ADDED, NM_PLATFORM_REASON_EXTERNAL);
} }
static void static void
@@ -3128,7 +3130,7 @@ handle_udev_event (GUdevClient *client,
action, subsys, g_udev_device_get_name (udev_device), action, subsys, g_udev_device_get_name (udev_device),
ifindex ? ifindex : "unknown", seqnum); ifindex ? ifindex : "unknown", seqnum);
if (!strcmp (action, "add")) if (!strcmp (action, "add") || !strcmp (action, "move"))
udev_device_added (platform, udev_device); udev_device_added (platform, udev_device);
if (!strcmp (action, "remove")) if (!strcmp (action, "remove"))
udev_device_removed (platform, udev_device); udev_device_removed (platform, udev_device);