chiark / gitweb /
net-util: match on the driver as exposed by ethtool if DRIVER not set
[elogind.git] / src / network / networkd-netdev.c
index ea6da69beb284051e33db297449d244fe2d62f4e..05f21fa87426272c08c51c695063ec73569a597e 100644 (file)
@@ -337,8 +337,8 @@ static int netdev_load_one(Manager *manager, const char *filename) {
         netdev->kind = _NETDEV_KIND_INVALID;
         netdev->vlanid = VLANID_MAX + 1;
 
-        r = config_parse(NULL, filename, file, "NetDev\0VLAN\0", config_item_perf_lookup,
-                        (void*) network_gperf_lookup, false, false, netdev);
+        r = config_parse(NULL, filename, file, "Match\0NetDev\0VLAN\0", config_item_perf_lookup,
+                        (void*) network_netdev_gperf_lookup, false, false, netdev);
         if (r < 0) {
                 log_warning("Could not parse config file %s: %s", filename, strerror(-r));
                 return r;
@@ -363,6 +363,12 @@ static int netdev_load_one(Manager *manager, const char *filename) {
         if (!netdev->filename)
                 return log_oom();
 
+        if (net_match_config(NULL, NULL, NULL, NULL, NULL,
+                             netdev->match_host, netdev->match_virt,
+                             netdev->match_kernel, netdev->match_arch,
+                             NULL, NULL, NULL, NULL, NULL, NULL) <= 0)
+                return 0;
+
         r = hashmap_put(netdev->manager->netdevs, netdev->name, netdev);
         if (r < 0)
                 return r;