chiark / gitweb /
udev - link-setup - expose ID_NET_DRIVER
[elogind.git] / src / udev / udev-builtin-net_setup_link.c
index e6ffa53400c6952c41d11a67d74bc3936444e9f6..3cd384e94dc8ecf144dc039317175fc9bc7a959c 100644 (file)
 #include "udev.h"
 #include "log.h"
 
-link_config_ctx *ctx;
+static link_config_ctx *ctx = NULL;
 
 static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv, bool test) {
+        _cleanup_free_ char *driver = NULL;
         const char *name;
         link_config *link;
         int r;
@@ -35,6 +36,10 @@ static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv
                 return EXIT_FAILURE;
         }
 
+        r = link_get_driver(ctx, dev, &driver);
+        if (r >= 0)
+                udev_builtin_add_property(dev, test, "ID_NET_DRIVER", driver);
+
         r = link_config_get(ctx, dev, &link);
         if (r < 0) {
                 if (r == -ENOENT) {