diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2020-06-11 15:02:38 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2020-06-11 17:33:09 +0200 |
commit | 8a2219af77503513219656b426856573b71c1dea (patch) | |
tree | 25ef9c0397099b1d06e5200354f5c98351688be6 | |
parent | 106ad9ad4656d8788dfafc00fa29f37bb45db07c (diff) | |
download | NetworkManager-8a2219af77503513219656b426856573b71c1dea.tar.gz |
platform: add nm_platform_link_get_path()
Add a function to obtain the link path as exported by the ID_PATH udev
property.
-rw-r--r-- | src/platform/nm-platform.c | 10 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 5a3e1f8d46..c023f43574 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -1604,6 +1604,16 @@ nm_platform_link_get_udi (NMPlatform *self, int ifindex) return device ? udev_device_get_syspath (device) : NULL; } +const char * +nm_platform_link_get_path (NMPlatform *self, int ifindex) +{ + const char *value = NULL; + + link_get_udev_property (self, ifindex, "ID_PATH", &value); + + return value; +} + struct udev_device * nm_platform_link_get_udev_device (NMPlatform *self, int ifindex) { diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index c16e41f1a0..aa3551a6d1 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -1630,6 +1630,7 @@ gboolean nm_platform_link_set_arp (NMPlatform *self, int ifindex); gboolean nm_platform_link_set_noarp (NMPlatform *self, int ifindex); const char *nm_platform_link_get_udi (NMPlatform *self, int ifindex); +const char *nm_platform_link_get_path (NMPlatform *self, int ifindex); struct udev_device *nm_platform_link_get_udev_device (NMPlatform *self, int ifindex); |