From 1d0a26e19de1133bb1ea8294f8f5d8472bedd859 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 15 Oct 2013 19:45:42 +0200 Subject: [PATCH] core: print ifindex when logging UDEV event Signed-off-by: Thomas Haller --- src/nm-atm-manager.c | 7 +++++-- src/platform/nm-linux-platform.c | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/nm-atm-manager.c b/src/nm-atm-manager.c index c4df9dc2a2..fb4bf964a4 100644 --- a/src/nm-atm-manager.c +++ b/src/nm-atm-manager.c @@ -145,6 +145,7 @@ handle_uevent (GUdevClient *client, { NMAtmManager *self = NM_ATM_MANAGER (user_data); const char *subsys; + const char *ifindex; g_return_if_fail (action != NULL); @@ -152,8 +153,10 @@ handle_uevent (GUdevClient *client, subsys = g_udev_device_get_subsystem (device); g_return_if_fail (!g_strcmp0 (subsys, "atm")); - nm_log_dbg (LOGD_HW, "UDEV event: action '%s' subsys '%s' device '%s'", - action, subsys, g_udev_device_get_name (device)); + ifindex = g_udev_device_get_sysfs_attr (device, "ifindex"); + + nm_log_dbg (LOGD_HW, "UDEV event: action '%s' subsys '%s' device '%s' (%s)", + action, subsys, g_udev_device_get_name (device), ifindex ? ifindex : "unknown"); if (!strcmp (action, "add")) adsl_add (self, device); diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index dd8bf63263..519a570dd7 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -2546,6 +2546,7 @@ handle_udev_event (GUdevClient *client, { NMPlatform *platform = NM_PLATFORM (user_data); const char *subsys; + const char *ifindex; g_return_if_fail (action != NULL); @@ -2553,8 +2554,11 @@ handle_udev_event (GUdevClient *client, subsys = g_udev_device_get_subsystem (udev_device); g_return_if_fail (!g_strcmp0 (subsys, "net")); - debug ("UDEV event: action '%s' subsys '%s' device '%s'", - action, subsys, g_udev_device_get_name (udev_device)); + ifindex = g_udev_device_get_sysfs_attr (udev_device, "ifindex"); + + debug ("UDEV event: action '%s' subsys '%s' device '%s' (%s)", + action, subsys, g_udev_device_get_name (udev_device), + ifindex ? ifindex : "unknown"); if (!strcmp (action, "add")) udev_device_added (platform, udev_device);