chiark / gitweb /
net-util: match on the driver as exposed by ethtool if DRIVER not set
[elogind.git] / src / network / networkd-netdev.c
index 01ea8f6..05f21fa 100644 (file)
@@ -94,8 +94,8 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
         assert(link);
         assert(callback);
 
-        r = sd_rtnl_message_new_link(netdev->manager->rtnl, RTM_SETLINK,
-                                     link->ifindex, &req);
+        r = sd_rtnl_message_new_link(netdev->manager->rtnl, &req,
+                                     RTM_SETLINK, link->ifindex);
         if (r < 0) {
                 log_error_netdev(netdev,
                                  "Could not allocate RTM_SETLINK message: %s",
@@ -172,7 +172,7 @@ static int netdev_create(NetDev *netdev, Link *link, sd_rtnl_message_handler_t c
         assert(netdev->manager);
         assert(netdev->manager->rtnl);
 
-        r = sd_rtnl_message_new_link(netdev->manager->rtnl, RTM_NEWLINK, 0, &req);
+        r = sd_rtnl_message_new_link(netdev->manager->rtnl, &req, RTM_NEWLINK, 0);
         if (r < 0) {
                 log_error_netdev(netdev,
                                  "Could not allocate RTM_NEWLINK message: %s",
@@ -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;